Broke everything; #220: Fixed
This commit is contained in:
+14
-2
@@ -1,5 +1,6 @@
|
||||
using Google.Apis.YouTube.v3;
|
||||
using Google.Apis.YouTube.v3.Data;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -13,6 +14,7 @@ using Windows.Globalization;
|
||||
using Windows.Storage;
|
||||
using Windows.System.Power;
|
||||
using Windows.UI.Notifications;
|
||||
using Windows.UI.Popups;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
@@ -258,10 +260,20 @@ namespace FoxTube
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the suspend request.</param>
|
||||
/// <param name="e">Details about the suspend request.</param>
|
||||
private void OnSuspending(object sender, SuspendingEventArgs e)
|
||||
private async void OnSuspending(object sender, SuspendingEventArgs e)
|
||||
{
|
||||
var deferral = e.SuspendingOperation.GetDeferral();
|
||||
//TODO: Save application state and stop any background activity
|
||||
//await new MessageDialog("suspending").ShowAsync();
|
||||
//Saving history
|
||||
await FileIO.WriteTextAsync(
|
||||
await ApplicationData.Current.RoamingFolder.CreateFileAsync("history.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(SecretsVault.UserHistory));
|
||||
//Saving WL playlist
|
||||
await FileIO.WriteTextAsync(
|
||||
await ApplicationData.Current.RoamingFolder.CreateFileAsync("watchlater.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(SecretsVault.WatchLater));
|
||||
//Saving downloads
|
||||
Methods.MainPage.Agent.QuitPrompt();
|
||||
deferral.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using Newtonsoft.Json;
|
||||
using Windows.UI.Popups;
|
||||
using YoutubeExplode.Models.MediaStreams;
|
||||
using Google.Apis.YouTube.v3.Data;
|
||||
using Windows.Foundation;
|
||||
|
||||
namespace FoxTube.Controls
|
||||
{
|
||||
@@ -14,6 +15,7 @@ namespace FoxTube.Controls
|
||||
{
|
||||
public List<DownloadItem> items = new List<DownloadItem>();
|
||||
StorageFolder roaming = ApplicationData.Current.RoamingFolder;
|
||||
public IAsyncOperation<IUICommand> prompt;
|
||||
|
||||
public DownloadAgent()
|
||||
{
|
||||
@@ -50,13 +52,13 @@ namespace FoxTube.Controls
|
||||
items.Remove(item);
|
||||
}
|
||||
|
||||
public async void QuitPrompt()
|
||||
public void QuitPrompt()
|
||||
{
|
||||
if(items.Find(x => x.InProgress) != null)
|
||||
if(items.Exists(x => x.InProgress))
|
||||
{
|
||||
MessageDialog dialog = new MessageDialog("You have some unfinished downloads. Quitting now will erase all downloaded data. Are you sure to continue?", "Some downloads are still pending");
|
||||
MessageDialog dialog = new MessageDialog($"Waiting pending downloads ({items.FindAll(x => x.InProgress).Count})...");
|
||||
|
||||
dialog.Commands.Add(new UICommand("Yes", async (command) =>
|
||||
dialog.Commands.Add(new UICommand("Force quit", async (command) =>
|
||||
{
|
||||
foreach (DownloadItem i in items.FindAll(x => x.InProgress))
|
||||
i.Cancel();
|
||||
@@ -70,10 +72,8 @@ namespace FoxTube.Controls
|
||||
await roaming.CreateFileAsync("downloads.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(containers));
|
||||
}));
|
||||
dialog.Commands.Add(new UICommand("No"));
|
||||
|
||||
dialog.DefaultCommandIndex = 1;
|
||||
await dialog.ShowAsync();
|
||||
|
||||
prompt = dialog.ShowAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,24 @@ using Windows.UI.Popups;
|
||||
|
||||
namespace FoxTube
|
||||
{
|
||||
public class HistoryItem
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public double LeftOn { get; set; }
|
||||
|
||||
public HistoryItem(string id, TimeSpan elapsed, TimeSpan total)
|
||||
{
|
||||
Id = id;
|
||||
LeftOn = elapsed.TotalSeconds / total.TotalSeconds * 100;
|
||||
}
|
||||
|
||||
public HistoryItem(string id)
|
||||
{
|
||||
Id = id;
|
||||
LeftOn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SecretsVault
|
||||
{
|
||||
public static event EventHandler AuthorizationStateChanged;
|
||||
@@ -40,7 +58,7 @@ namespace FoxTube
|
||||
|
||||
public static Channel UserChannel { get; private set; }
|
||||
public static List<string> WatchLater { get; private set; } = new List<string>();
|
||||
public static List<string> UserHistory { get; private set; } = new List<string>();
|
||||
public static List<HistoryItem> UserHistory { get; private set; } = new List<HistoryItem>();
|
||||
public static List<Subscription> Subscriptions { get; private set; } = new List<Subscription>();
|
||||
|
||||
public static YouTubeService NoAuthService => new YouTubeService(new BaseClientService.Initializer()
|
||||
@@ -59,35 +77,13 @@ namespace FoxTube
|
||||
}
|
||||
}
|
||||
|
||||
public static async void HistoryAdd(string id)
|
||||
public static void HistoryAdd(string id, TimeSpan elapsed, TimeSpan total)
|
||||
{
|
||||
UserHistory.Remove(id);
|
||||
UserHistory.Add(id);
|
||||
UserHistory.Remove(UserHistory.Find(x => x.Id == id));
|
||||
UserHistory.Add(new HistoryItem(id, elapsed, total));
|
||||
|
||||
if (UserHistory.Count > 100)
|
||||
UserHistory.RemoveAt(UserHistory.Count - 1);
|
||||
|
||||
await FileIO.WriteTextAsync(
|
||||
await ApplicationData.Current.RoamingFolder.CreateFileAsync("history.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(UserHistory));
|
||||
}
|
||||
|
||||
public static async void LaterAdd(string id)
|
||||
{
|
||||
WatchLater.Add(id);
|
||||
|
||||
await FileIO.WriteTextAsync(
|
||||
await ApplicationData.Current.RoamingFolder.CreateFileAsync("watchlater.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(UserHistory));
|
||||
}
|
||||
|
||||
public static async void LaterRemove(string id)
|
||||
{
|
||||
WatchLater.Remove(id);
|
||||
|
||||
await FileIO.WriteTextAsync(
|
||||
await ApplicationData.Current.RoamingFolder.CreateFileAsync("watchlater.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(UserHistory));
|
||||
}
|
||||
|
||||
public static async Task<bool> ChangeSubscriptionState(string id)
|
||||
@@ -95,7 +91,7 @@ namespace FoxTube
|
||||
if (!IsAuthorized)
|
||||
return false;
|
||||
|
||||
if(Subscriptions.Find(x => x.Snippet.ResourceId.ChannelId == id) != null)
|
||||
if(Subscriptions.Exists(x => x.Snippet.ResourceId.ChannelId == id))
|
||||
{
|
||||
Subscription s = Subscriptions.Find(x => x.Snippet.ResourceId.ChannelId == id);
|
||||
|
||||
@@ -151,6 +147,8 @@ namespace FoxTube
|
||||
return false;
|
||||
Subscriptions.Add(s);
|
||||
SubscriptionsChanged.Invoke(null, "add", s);
|
||||
|
||||
SaveSubscriptions();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -213,27 +211,28 @@ namespace FoxTube
|
||||
try
|
||||
{
|
||||
await ApplicationData.Current.RoamingFolder.GetFileAsync("history.json");
|
||||
UserHistory = JsonConvert.DeserializeObject<List<HistoryItem>>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("history.json")));
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
catch
|
||||
{
|
||||
await FileIO.WriteTextAsync(
|
||||
await ApplicationData.Current.RoamingFolder.CreateFileAsync("history.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(new List<string>()));
|
||||
JsonConvert.SerializeObject(new List<HistoryItem>()));
|
||||
UserHistory = new List<HistoryItem>();
|
||||
}
|
||||
try
|
||||
{
|
||||
await ApplicationData.Current.RoamingFolder.GetFileAsync("watchlater.json");
|
||||
WatchLater = JsonConvert.DeserializeObject<List<string>>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("watchlater.json")));
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
catch
|
||||
{
|
||||
await FileIO.WriteTextAsync(
|
||||
await ApplicationData.Current.RoamingFolder.CreateFileAsync("watchlater.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(new List<string>()));
|
||||
WatchLater = new List<string>();
|
||||
}
|
||||
|
||||
UserHistory = JsonConvert.DeserializeObject<List<string>>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("history.json")));
|
||||
WatchLater = JsonConvert.DeserializeObject<List<string>>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("watchlater.json")));
|
||||
|
||||
/*PlaylistItemsResource.ListRequest playlistRequest = Service.PlaylistItems.List("snippet");
|
||||
playlistRequest.PlaylistId = UserChannel.ContentDetails.RelatedPlaylists.WatchHistory;
|
||||
playlistRequest.MaxResults = 50;
|
||||
@@ -280,12 +279,7 @@ namespace FoxTube
|
||||
foreach (Subscription s in subResponse.Items)
|
||||
Subscriptions.Add(s);
|
||||
}
|
||||
|
||||
Dictionary<string, string> subs = new Dictionary<string, string>();
|
||||
Subscriptions.ForEach(x => subs.Add(x.Snippet.ResourceId.ChannelId, x.Snippet.Thumbnails.Medium.Url));
|
||||
await FileIO.WriteTextAsync(
|
||||
await ApplicationData.Current.RoamingFolder.CreateFileAsync("background.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(subs));
|
||||
SaveSubscriptions();
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -309,6 +303,15 @@ namespace FoxTube
|
||||
AuthorizationStateChanged.Invoke(null, null);
|
||||
}
|
||||
|
||||
public static async void SaveSubscriptions()
|
||||
{
|
||||
Dictionary<string, string> subs = new Dictionary<string, string>();
|
||||
Subscriptions.ForEach(x => subs.Add(x.Snippet.ResourceId.ChannelId, x.Snippet.Thumbnails.Medium.Url));
|
||||
await FileIO.WriteTextAsync(
|
||||
await ApplicationData.Current.RoamingFolder.CreateFileAsync("background.json", CreationCollisionOption.ReplaceExisting),
|
||||
JsonConvert.SerializeObject(subs));
|
||||
}
|
||||
|
||||
public static async void Deauthenticate()
|
||||
{
|
||||
if(await Credential.RevokeTokenAsync(CancellationToken.None))
|
||||
|
||||
@@ -15,6 +15,7 @@ using Windows.UI.Popups;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.UI.Notifications;
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
using Windows.Foundation;
|
||||
|
||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<StackPanel Margin="5" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" VerticalAlignment="Top" HorizontalAlignment="Left" Padding="5,2,5,2" BorderBrush="Gray" BorderThickness="1">
|
||||
<TextBlock Text="Watched" Foreground="Gray" FontSize="12"/>
|
||||
</StackPanel>
|
||||
<ProgressBar VerticalAlignment="Bottom" Margin="54,0,0,0" Foreground="Red" Name="leftOn"/>
|
||||
</Grid>
|
||||
<StackPanel Margin="0,0,5,5" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,2,5,3">
|
||||
<TextBlock Name="info" Text="[Duration] | [Published at]" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="12"/>
|
||||
|
||||
@@ -82,8 +82,11 @@ namespace FoxTube.Controls
|
||||
}
|
||||
catch { }
|
||||
|
||||
if(SecretsVault.UserHistory.Contains(videoId))
|
||||
if(SecretsVault.UserHistory.Exists(x => x.Id == videoId))
|
||||
{
|
||||
watched.Visibility = Visibility.Visible;
|
||||
leftOn.Value = SecretsVault.UserHistory.Find(x => x.Id == videoId).LeftOn;
|
||||
}
|
||||
}
|
||||
|
||||
public async void Button_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace FoxTube
|
||||
else
|
||||
s = (string)settings.Values["quality"];
|
||||
|
||||
if (quality.Items.ToList().Find(x => (x as ComboBoxItem).Content as string == s) != null)
|
||||
if (quality.Items.ToList().Exists(x => (x as ComboBoxItem).Content as string == s))
|
||||
quality.SelectedItem = quality.Items.First(x => (x as ComboBoxItem).Content as string == s);
|
||||
else
|
||||
quality.SelectedItem = quality.Items.First();
|
||||
@@ -203,6 +203,8 @@ namespace FoxTube
|
||||
systemControls.ButtonPressed += SystemControls_Engaged;
|
||||
systemControls.IsEnabled = true;
|
||||
|
||||
SecretsVault.HistoryAdd(videoId, elapsed, total);
|
||||
|
||||
t.Start();
|
||||
|
||||
Visibility = Visibility.Visible;
|
||||
@@ -348,7 +350,7 @@ namespace FoxTube
|
||||
|
||||
settings.Values["rememberedQuality"] = (quality.SelectedItem as ComboBoxItem).Content as string;
|
||||
|
||||
if(streamInfo.Muxed.ToList().Find(x => x.VideoQualityLabel == (quality.SelectedItem as ComboBoxItem).Content as string) != null)
|
||||
if(streamInfo.Muxed.ToList().Exists(x => x.VideoQualityLabel == (quality.SelectedItem as ComboBoxItem).Content as string))
|
||||
{
|
||||
isMuxed = true;
|
||||
videoSource.Source = streamInfo.Muxed.First(x => x.VideoQualityLabel == (quality.SelectedItem as ComboBoxItem).Content as string).Url.ToUri();
|
||||
@@ -612,6 +614,8 @@ namespace FoxTube
|
||||
systemControls.PlaybackStatus = MediaPlaybackStatus.Closed;
|
||||
break;
|
||||
}
|
||||
|
||||
SecretsVault.HistoryAdd(videoId, elapsed, total);
|
||||
}
|
||||
|
||||
private async void miniView_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<AssemblyName>FoxTube</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17134.0</TargetPlatformVersion>
|
||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17763.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
<ScrollViewer Name="scroll">
|
||||
<local:VideoGrid/>
|
||||
</ScrollViewer>
|
||||
<CommandBar Grid.Row="1">
|
||||
<CommandBar Grid.Row="1" DefaultLabelPosition="Right">
|
||||
<AppBarButton LabelPosition="Default" Icon="Help" Label="Missing some stuff?" Name="help" Click="help_Click"/>
|
||||
<AppBarButton Label="Open in browser" Icon="Globe" Name="toBrowser" Click="toBrowser_Click"/>
|
||||
</CommandBar>
|
||||
<foxtube:LoadingPage Visibility="Collapsed" Grid.RowSpan="2"/>
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace FoxTube.Pages
|
||||
loading.Refresh();
|
||||
|
||||
list.Clear();
|
||||
SecretsVault.UserHistory.ForEach(i => list.Add(new VideoCard(i)));
|
||||
SecretsVault.UserHistory.ForEach(i => list.Add(new VideoCard(i.Id)));
|
||||
|
||||
loading.Close();
|
||||
}
|
||||
@@ -45,5 +45,10 @@ namespace FoxTube.Pages
|
||||
{
|
||||
await Launcher.LaunchUriAsync(new Uri("youtube.com/feed/history"));
|
||||
}
|
||||
|
||||
private void help_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Methods.MainPage.GoToDeveloper("local-history");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
-25
@@ -33,47 +33,48 @@
|
||||
</NavigationView.MenuItems>
|
||||
|
||||
<NavigationView.PaneFooter>
|
||||
<StackPanel>
|
||||
<Button Visibility="Visible" Name="feedback" Click="feedback_Click" Height="40" HorizontalAlignment="Stretch" Background="Transparent" HorizontalContentAlignment="Left">
|
||||
<NavigationViewList>
|
||||
<NavigationViewItem x:Uid="/Main/feedback" Name="feedback" Content="Give a feedback" Tapped="feedback_Click">
|
||||
<NavigationViewItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</NavigationViewItem.Icon>
|
||||
</NavigationViewItem>
|
||||
|
||||
<NavigationViewItem x:Uid="/Main/adsFree" Content="Remove ads" Visibility="Collapsed" Name="removeAds">
|
||||
<NavigationViewItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</NavigationViewItem.Icon>
|
||||
</NavigationViewItem>
|
||||
|
||||
<NavigationViewItem Name="account" Tapped="openContext">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<FontIcon Glyph="" FontSize="16" Margin="6,0,16,0"/>
|
||||
<TextBlock x:Uid="/Main/feedback" Text="Give a feedback"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Visibility="Collapsed" Name="removeAds" Height="40" HorizontalAlignment="Stretch" Background="Transparent" HorizontalContentAlignment="Left">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<FontIcon Glyph="" FontSize="16" Margin="6,0,16,0"/>
|
||||
<TextBlock x:Uid="/Main/adsFree" Text="Remove ads"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Visibility="Visible" Name="account" Height="40" HorizontalAlignment="Stretch" Background="Transparent" HorizontalContentAlignment="Left">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<FontIcon Glyph="" FontSize="16" Margin="6,0,16,0"/>
|
||||
<FontIcon Glyph="" FontSize="16" Margin="0,0,16,0"/>
|
||||
<TextBlock x:Uid="/Main/signIn" Text="Add account"/>
|
||||
</StackPanel>
|
||||
|
||||
<Button.Flyout>
|
||||
<NavigationViewItem.ContextFlyout>
|
||||
<MenuFlyout>
|
||||
<MenuFlyoutItem x:Uid="/Main/signEx" Text="Sign in with existing account" Name="signIn" Click="signIn_Click"/>
|
||||
<MenuFlyoutItem x:Uid="/Main/signNew" Text="Create new Google account" Name="createAccount" Click="createAccount_Click"/>
|
||||
</MenuFlyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
<Button Visibility="Collapsed" Name="avatar" Height="40" HorizontalAlignment="Stretch" Background="Transparent" HorizontalContentAlignment="Left">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<PersonPicture Height="23" Margin="3,0,12,0"/>
|
||||
</NavigationViewItem.ContextFlyout>
|
||||
</NavigationViewItem>
|
||||
|
||||
<NavigationViewItem Visibility="Collapsed" Name="avatar" Tapped="openContext" Padding="-5">
|
||||
<StackPanel Orientation="Horizontal" Padding="5">
|
||||
<PersonPicture Height="20" Margin="-5,0,15,0"/>
|
||||
<TextBlock Name="myName" Text="My account"/>
|
||||
</StackPanel>
|
||||
|
||||
<Button.Flyout>
|
||||
<NavigationViewItem.ContextFlyout>
|
||||
<MenuFlyout>
|
||||
<MenuFlyoutItem x:Uid="/Main/myChannelContext" Text="My channel" Name="myChannel" Click="myChannel_Click"/>
|
||||
<MenuFlyoutSeparator/>
|
||||
<MenuFlyoutItem x:Uid="/Main/signOut" Text="Log out" Name="logout" Click="logout_Click"/>
|
||||
</MenuFlyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</NavigationViewItem.ContextFlyout>
|
||||
</NavigationViewItem>
|
||||
</NavigationViewList>
|
||||
</NavigationView.PaneFooter>
|
||||
|
||||
<NavigationView.AutoSuggestBox>
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace FoxTube
|
||||
try
|
||||
{
|
||||
XmlDocument changelog = new XmlDocument();
|
||||
changelog.Load("http://foxgame.hol.es/foxtube-changelog.xml");
|
||||
changelog.Load("http://foxgame-studio.000webhostapp.com/foxtube-changelog.xml");
|
||||
XmlElement e = changelog["items"].ChildNodes[0] as XmlElement;
|
||||
|
||||
ToastNotificationManager.CreateToastNotifier().Show(FoxTube.Background.Notification.GetChangelogToast(e.GetAttribute("version")));
|
||||
@@ -100,6 +100,11 @@ namespace FoxTube
|
||||
Initialize();
|
||||
}
|
||||
|
||||
async void GetVideosFromToday()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async void Initialize()
|
||||
{
|
||||
if (await ApplicationData.Current.RoamingFolder.GetFileAsync("notifications.json") != null)
|
||||
@@ -130,7 +135,7 @@ namespace FoxTube
|
||||
titleBar.ButtonBackgroundColor = Colors.Red;
|
||||
titleBar.ButtonHoverBackgroundColor = Colors.IndianRed;
|
||||
titleBar.ButtonPressedBackgroundColor = Colors.DarkRed;
|
||||
titleBar.ButtonInactiveBackgroundColor = Colors.DarkRed;
|
||||
titleBar.ButtonInactiveBackgroundColor = Colors.Black;
|
||||
titleBar.ForegroundColor = Colors.White;
|
||||
|
||||
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false;
|
||||
@@ -141,18 +146,23 @@ namespace FoxTube
|
||||
if ((string)args[0] == "add" && nav.MenuItems.Count < 19)
|
||||
{
|
||||
Subscription s = args[1] as Subscription;
|
||||
StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal };
|
||||
StackPanel panel = new StackPanel()
|
||||
{
|
||||
Orientation = Orientation.Horizontal,
|
||||
Padding = new Thickness(5)
|
||||
};
|
||||
panel.Children.Add(new PersonPicture()
|
||||
{
|
||||
Height = 20,
|
||||
Margin = new Thickness(0, 0, 13, 0),
|
||||
Margin = new Thickness(-5, 0, 15, 0),
|
||||
ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url))
|
||||
});
|
||||
panel.Children.Add(new TextBlock() { Text = s.Snippet.Title });
|
||||
nav.MenuItems.Add(new NavigationViewItem()
|
||||
{
|
||||
Content = panel,
|
||||
Name = (nav.MenuItems.Count - 9).ToString()
|
||||
Name = (nav.MenuItems.Count - 9).ToString(),
|
||||
Padding = new Thickness(-5)
|
||||
});
|
||||
}
|
||||
else if ((string)args[0] == "remove" && (int)args[1] < 10)
|
||||
@@ -190,18 +200,23 @@ namespace FoxTube
|
||||
try
|
||||
{
|
||||
Subscription s = SecretsVault.Subscriptions[k];
|
||||
StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal };
|
||||
StackPanel panel = new StackPanel()
|
||||
{
|
||||
Orientation = Orientation.Horizontal,
|
||||
Padding = new Thickness(5)
|
||||
};
|
||||
panel.Children.Add(new PersonPicture()
|
||||
{
|
||||
Height = 20,
|
||||
Margin = new Thickness(0, 0, 13, 0),
|
||||
Margin = new Thickness(-5, 0, 15, 0),
|
||||
ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url))
|
||||
});
|
||||
panel.Children.Add(new TextBlock() { Text = s.Snippet.Title });
|
||||
nav.MenuItems.Add(new NavigationViewItem()
|
||||
{
|
||||
Content = panel,
|
||||
Name = k.ToString()
|
||||
Name = k.ToString(),
|
||||
Padding = new Thickness(-5)
|
||||
});
|
||||
}
|
||||
catch { continue; }
|
||||
@@ -234,7 +249,7 @@ namespace FoxTube
|
||||
GoToVideo((videoPlaceholder.Content as VideoPage).videoId);
|
||||
}
|
||||
|
||||
private async void feedback_Click(object sender, RoutedEventArgs e)
|
||||
private async void feedback_Click(object sender, TappedRoutedEventArgs e)
|
||||
{
|
||||
await Launcher.LaunchUriAsync(new Uri("feedback-hub:"));
|
||||
}
|
||||
@@ -466,33 +481,37 @@ namespace FoxTube
|
||||
|
||||
private void nav_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
|
||||
{
|
||||
if (s == Sender.None)
|
||||
try
|
||||
{
|
||||
s = Sender.Menu;
|
||||
if (args.IsSettingsSelected)
|
||||
content.Navigate(typeof(Settings));
|
||||
else
|
||||
if (s == Sender.None)
|
||||
{
|
||||
if (args.SelectedItem == toHome)
|
||||
content.Navigate(typeof(Home));
|
||||
else if (args.SelectedItem == toHistory)
|
||||
content.Navigate(typeof(History));
|
||||
else if (args.SelectedItem == toLiked)
|
||||
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes);
|
||||
else if (args.SelectedItem == toLater)
|
||||
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchLater);
|
||||
else if (args.SelectedItem == toSubscriptions)
|
||||
content.Navigate(typeof(Subscriptions));
|
||||
else if (args.SelectedItem == toDownloads)
|
||||
content.Navigate(typeof(Downloads));
|
||||
else if (args.SelectedItem == toChannel)
|
||||
content.Navigate(typeof(ChannelPage), SecretsVault.UserChannel.Id);
|
||||
s = Sender.Menu;
|
||||
if (args.IsSettingsSelected)
|
||||
content.Navigate(typeof(Settings));
|
||||
else
|
||||
content.Navigate(typeof(ChannelPage), SecretsVault.Subscriptions[Convert.ToInt32((args.SelectedItem as NavigationViewItem).Name)].Snippet.ResourceId.ChannelId);
|
||||
{
|
||||
if (args.SelectedItem == toHome)
|
||||
content.Navigate(typeof(Home));
|
||||
else if (args.SelectedItem == toHistory)
|
||||
content.Navigate(typeof(History));
|
||||
else if (args.SelectedItem == toLiked)
|
||||
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes);
|
||||
else if (args.SelectedItem == toLater)
|
||||
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchLater);
|
||||
else if (args.SelectedItem == toSubscriptions)
|
||||
content.Navigate(typeof(Subscriptions));
|
||||
else if (args.SelectedItem == toDownloads)
|
||||
content.Navigate(typeof(Downloads));
|
||||
else if (args.SelectedItem == toChannel)
|
||||
content.Navigate(typeof(ChannelPage), SecretsVault.UserChannel.Id);
|
||||
else
|
||||
content.Navigate(typeof(ChannelPage), SecretsVault.Subscriptions[Convert.ToInt32((args.SelectedItem as NavigationViewItem).Name)].Snippet.ResourceId.ChannelId);
|
||||
}
|
||||
}
|
||||
else
|
||||
s = Sender.None;
|
||||
}
|
||||
else
|
||||
s = Sender.None;
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void content_Navigated(object sender, NavigationEventArgs e)
|
||||
@@ -681,5 +700,10 @@ namespace FoxTube
|
||||
(videoPlaceholder.Content as VideoPage).player.KeyUpPressed(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void openContext(object sender, TappedRoutedEventArgs e)
|
||||
{
|
||||
((NavigationViewItem)sender).ContextFlyout.ShowAt((NavigationViewItem)sender);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,14 +40,14 @@ namespace FoxTube.Pages.SettingsPages
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
||||
doc.Load("http://foxgame.hol.es/foxtube-changelog.xml");
|
||||
doc.Load("http://foxgame-studio.000webhostapp.com/foxtube-changelog.xml");
|
||||
foreach (XmlElement e in doc["items"].ChildNodes)
|
||||
items.Add(new InboxItem(
|
||||
e.GetAttribute("version"),
|
||||
e["content"].InnerText,
|
||||
e.GetAttribute("time")));
|
||||
|
||||
doc.Load("http://foxgame.hol.es/foxtube-messages.xml");
|
||||
doc.Load("http://foxgame-studio.000webhostapp.com/foxtube-messages.xml");
|
||||
foreach (XmlElement e in doc["posts"].ChildNodes)
|
||||
items.Add(new InboxItem(
|
||||
e["header"].InnerText,
|
||||
|
||||
@@ -208,8 +208,6 @@ namespace FoxTube.Pages
|
||||
}
|
||||
}
|
||||
subscribe.Visibility = Visibility.Visible;
|
||||
|
||||
SecretsVault.HistoryAdd(videoId);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -117,13 +117,13 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="adsFree.Text" xml:space="preserve">
|
||||
<data name="adsFree.Content" xml:space="preserve">
|
||||
<value>Remove ads</value>
|
||||
</data>
|
||||
<data name="downloads.Content" xml:space="preserve">
|
||||
<value>Downloads</value>
|
||||
</data>
|
||||
<data name="feedback.Text" xml:space="preserve">
|
||||
<data name="feedback.Content" xml:space="preserve">
|
||||
<value>Give a feedback</value>
|
||||
</data>
|
||||
<data name="history.Content" xml:space="preserve">
|
||||
|
||||
@@ -117,13 +117,13 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="adsFree.Text" xml:space="preserve">
|
||||
<data name="adsFree.Content" xml:space="preserve">
|
||||
<value>Убрать рекламу</value>
|
||||
</data>
|
||||
<data name="downloads.Content" xml:space="preserve">
|
||||
<value>Загрузки</value>
|
||||
</data>
|
||||
<data name="feedback.Text" xml:space="preserve">
|
||||
<data name="feedback.Content" xml:space="preserve">
|
||||
<value>Оставить отзыв</value>
|
||||
</data>
|
||||
<data name="history.Content" xml:space="preserve">
|
||||
|
||||
Reference in New Issue
Block a user