diff --git a/FoxTube/App.xaml.cs b/FoxTube/App.xaml.cs
index 2882eb7..5fe7b58 100644
--- a/FoxTube/App.xaml.cs
+++ b/FoxTube/App.xaml.cs
@@ -5,8 +5,10 @@ using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
+using Windows.ApplicationModel.Core;
using Windows.Foundation;
using Windows.Foundation.Collections;
+using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
@@ -71,6 +73,8 @@ namespace FoxTube
// Ensure the current window is active
Window.Current.Activate();
}
+
+ CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
}
///
diff --git a/FoxTube/Classes/Methods.cs b/FoxTube/Classes/Methods.cs
index e3abc67..5141c13 100644
--- a/FoxTube/Classes/Methods.cs
+++ b/FoxTube/Classes/Methods.cs
@@ -61,21 +61,34 @@ namespace FoxTube
{
if (isWWW.IsMatch(item))
{
- Debug.WriteLine(item);
- Hyperlink link = new Hyperlink { NavigateUri = new Uri(item), Foreground = new SolidColorBrush(Colors.Red) };
- link.Inlines.Add(new Run { Text = item });
- block.Inlines.Add(link);
+ try
+ {
+ Hyperlink link = new Hyperlink { NavigateUri = new Uri(item), Foreground = new SolidColorBrush(Colors.Red) };
+ link.Inlines.Add(new Run { Text = item });
+ block.Inlines.Add(link);
+ }
+ catch
+ {
+ block.Inlines.Add(new Run { Text = item });
+ }
}
else if (isEmail.IsMatch(item))
{
- Debug.WriteLine(item);
- Hyperlink link = new Hyperlink { NavigateUri = new Uri($"mailto:{item}"), Foreground = new SolidColorBrush(Colors.Red) };
- link.Inlines.Add(new Run { Text = item });
- block.Inlines.Add(link);
+ try
+ {
+ Hyperlink link = new Hyperlink { NavigateUri = new Uri($"mailto:{item}"), Foreground = new SolidColorBrush(Colors.Red) };
+ link.Inlines.Add(new Run { Text = item });
+ block.Inlines.Add(link);
+ }
+ catch
+ {
+ block.Inlines.Add(new Run { Text = item });
+ }
}
else if (item == "s")
continue;
- else block.Inlines.Add(new Run { Text = item });
+ else
+ block.Inlines.Add(new Run { Text = item });
}
}
diff --git a/FoxTube/Controls/VideoPlayer.xaml.cs b/FoxTube/Controls/VideoPlayer.xaml.cs
index 625da40..54a95fc 100644
--- a/FoxTube/Controls/VideoPlayer.xaml.cs
+++ b/FoxTube/Controls/VideoPlayer.xaml.cs
@@ -627,7 +627,7 @@ namespace FoxTube
{
await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.Default);
- Methods.MainPage.SetTitleBar();
+ //Methods.MainPage.SetTitleBar();
mainControls.Visibility = Visibility.Visible;
header.Visibility = Visibility.Visible;
diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj
index 812523d..1207fca 100644
--- a/FoxTube/FoxTube.csproj
+++ b/FoxTube/FoxTube.csproj
@@ -142,6 +142,9 @@
Home.xaml
+
+ General.xaml
+
Inbox.xaml
@@ -331,6 +334,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/FoxTube/Pages/ChannelPage.xaml b/FoxTube/Pages/ChannelPage.xaml
index f363825..0736e93 100644
--- a/FoxTube/Pages/ChannelPage.xaml
+++ b/FoxTube/Pages/ChannelPage.xaml
@@ -11,18 +11,12 @@
-
-
+
-
-
-
-
-
+
+
@@ -51,7 +45,7 @@
-
+
@@ -63,70 +57,56 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
-
-
-
-
-
-
-
-
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
+
diff --git a/FoxTube/Pages/ChannelPage.xaml.cs b/FoxTube/Pages/ChannelPage.xaml.cs
index 2b57676..5b2bdd3 100644
--- a/FoxTube/Pages/ChannelPage.xaml.cs
+++ b/FoxTube/Pages/ChannelPage.xaml.cs
@@ -53,7 +53,7 @@ namespace FoxTube.Pages
public ChannelPage()
{
this.InitializeComponent();
- loading = grid.Children[3] as LoadingPage;
+ loading = grid.Children[2] as LoadingPage;
playlistLoading = playlists.Children[1] as LoadingPage;
videoList = videos.Children[2] as VideoGrid;
@@ -181,57 +181,10 @@ namespace FoxTube.Pages
}
}
- private void searchButton_Click(object sender, RoutedEventArgs e)
- {
- if (content.Items.Count == 4)
- (((content.Items[3] as PivotItem).Content as Frame).Content as Search).Initialize(new SearchParameters(item.Id, searchField.Text));
- else
- {
- content.Items.Add(new PivotItem()
- {
- Content = new Frame()
- });
- ((content.Items[3] as PivotItem).Content as Frame).Navigate(typeof(Search), new SearchParameters(item.Id, searchField.Text));
- }
-
- content.SelectedIndex = 3;
- }
-
private void content_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- toVideos.FontWeight = FontWeights.Normal;
- toPlaylists.FontWeight = FontWeights.Normal;
- toAbout.FontWeight = FontWeights.Normal;
-
- switch (content.SelectedIndex)
- {
- case 0:
- toVideos.FontWeight = FontWeights.Bold;
- break;
- case 1:
- toPlaylists.FontWeight = FontWeights.Bold;
- if (!playlistLoaded)
- LoadPlaylist();
- break;
- case 2:
- toAbout.FontWeight = FontWeights.Bold;
- break;
- }
- }
-
- private void toVideos_Click(object sender, RoutedEventArgs e)
- {
- content.SelectedIndex = 0;
- }
-
- private void toPlaylists_Click(object sender, RoutedEventArgs e)
- {
- content.SelectedIndex = 1;
- }
-
- private void toAbout_Click(object sender, RoutedEventArgs e)
- {
- content.SelectedIndex = 2;
+ if (content.SelectedIndex == 1 && !playlistLoaded)
+ LoadPlaylist();
}
private async void showMorePlaylists_Click()
@@ -297,6 +250,22 @@ namespace FoxTube.Pages
SecretsVault.Authorize();
}
+ private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
+ {
+ if (content.Items.Count == 4)
+ (((content.Items[3] as PivotItem).Content as Frame).Content as Search).Initialize(new SearchParameters(item.Id, search.Text));
+ else
+ {
+ content.Items.Add(new PivotItem()
+ {
+ Content = new Frame()
+ });
+ ((content.Items[3] as PivotItem).Content as Frame).Navigate(typeof(Search), new SearchParameters(item.Id, search.Text));
+ }
+
+ content.SelectedIndex = 3;
+ }
+
private void refresh_Click(object sender, RoutedEventArgs e)
{
Initialize(channelId);
diff --git a/FoxTube/Pages/CommentsPage.xaml b/FoxTube/Pages/CommentsPage.xaml
index 15f74bd..1669f9c 100644
--- a/FoxTube/Pages/CommentsPage.xaml
+++ b/FoxTube/Pages/CommentsPage.xaml
@@ -13,7 +13,7 @@
-
+
@@ -22,15 +22,15 @@
-
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/FoxTube/Pages/MainPage.xaml.cs b/FoxTube/Pages/MainPage.xaml.cs
index 5b7538f..6bafe86 100644
--- a/FoxTube/Pages/MainPage.xaml.cs
+++ b/FoxTube/Pages/MainPage.xaml.cs
@@ -47,19 +47,13 @@ namespace FoxTube
/// An empty page that can be used on its own or navigated to within a Frame.
///
- public enum RightPaneState { Full, Collapsed, Hidden }
-
public sealed partial class MainPage : Page
{
public DownloadAgent Agent = new DownloadAgent();
- RightPaneState paneState = RightPaneState.Full;
- bool isForcedCollapsed = false;
-
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
NotificationsCenter notificationsCenter = new NotificationsCenter();
- SuggestionsQueries suggestions = new SuggestionsQueries();
public MainPage()
{
this.InitializeComponent();
@@ -89,8 +83,6 @@ namespace FoxTube
if (settings.Values["defaultDownload"] == null)
settings.Values.Add("defaultDownload", Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\DownloadedVideos");
- notificationPane.Child = notificationsCenter;
-
SecretsVault.AuthorizationStateChanged += Vault_AuthorizationStateChanged;
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
SecretsVault.CheckAuthorization();
@@ -98,27 +90,41 @@ namespace FoxTube
content.Navigate(typeof(Home));
}
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ base.OnNavigatedTo(e);
+ SetTitleBar();
+ }
+
+ public void SetTitleBar()
+ {
+ var titleBar = ApplicationView.GetForCurrentView().TitleBar;
+
+ titleBar.ButtonBackgroundColor = Colors.Transparent;
+ titleBar.ButtonHoverBackgroundColor = Colors.IndianRed;
+ titleBar.ButtonPressedBackgroundColor = Colors.DarkRed;
+
+ CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
+ coreTitleBar.ExtendViewIntoTitleBar = false;
+ }
+
private void SecretsVault_SubscriptionsChanged(object sender, params object[] args)
{
- if ((string)args[0] == "add" && subscriptionsList.Items.Count < 10)
+ if ((string)args[0] == "add" && nav.MenuItems.Count < 16)
{
Subscription s = args[1] as Subscription;
StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal };
panel.Children.Add(new PersonPicture()
{
- Height = 25,
- Margin = new Thickness(0, 0, 17, 0),
+ Height = 20,
+ Margin = new Thickness(0, 0, 13, 0),
ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url))
});
- panel.Children.Add(new TextBlock()
- {
- VerticalAlignment = VerticalAlignment.Center,
- Text = s.Snippet.Title
- });
- subscriptionsList.Items.Add(new ListBoxItem() { Content = panel });
+ panel.Children.Add(new TextBlock() { Text = s.Snippet.Title });
+ nav.MenuItems.Add(new NavigationViewItem() { Content = panel });
}
else if ((string)args[0] == "remove" && (int)args[1] < 10)
- subscriptionsList.Items.RemoveAt((int)args[1]);
+ nav.MenuItems.RemoveAt((int)args[1]);
}
private async void Vault_AuthorizationStateChanged(object sender, EventArgs e)
@@ -144,7 +150,7 @@ namespace FoxTube
if (SecretsVault.Subscriptions.Count > 0)
{
- subscriptionsList.Visibility = Visibility.Visible;
+ subsHeader.Visibility = Visibility.Visible;
int l = SecretsVault.Subscriptions.Count;
int n = 10;
for(int k = 0; k < l && k < n; k++)
@@ -154,18 +160,14 @@ namespace FoxTube
StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal };
panel.Children.Add(new PersonPicture()
{
- Height = 25,
- Margin = new Thickness(0, 0, 17, 0),
+ Height = 20,
+ Margin = new Thickness(0, 0, 13, 0),
ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url))
});
- panel.Children.Add(new TextBlock()
- {
- VerticalAlignment = VerticalAlignment.Center,
- Text = s.Snippet.Title
- });
- subscriptionsList.Items.Add(new ListBoxItem() { Content = panel });
+ panel.Children.Add(new TextBlock() { Text = s.Snippet.Title });
+ nav.MenuItems.Add(new NavigationViewItem() { Content = panel });
}
- catch { n++; }
+ catch { continue; }
}
}
else
@@ -179,9 +181,9 @@ namespace FoxTube
toSubscriptions.Visibility = Visibility.Collapsed;
toChannel.Visibility = Visibility.Collapsed;
- subscriptionsList.Visibility = Visibility.Collapsed;
- for(int k = 1; k < subscriptionsList.Items.Count; k++)
- subscriptionsList.Items.RemoveAt(k);
+ subsHeader.Visibility = Visibility.Collapsed;
+ for(int k = 7; k < nav.MenuItems.Count; k++)
+ nav.MenuItems.RemoveAt(k);
}
content.CacheSize = 0;
@@ -191,36 +193,12 @@ namespace FoxTube
(videoPlaceholder.Content as VideoPage).refresh_Click(this, null);
}
- protected override void OnNavigatedTo(NavigationEventArgs e)
- {
- base.OnNavigatedTo(e);
- SetTitleBar();
- }
-
- public void SetTitleBar()
- {
- var titleBar = ApplicationView.GetForCurrentView().TitleBar;
-
- titleBar.BackgroundColor = titleBar.ButtonBackgroundColor = Colors.Red;
- titleBar.ForegroundColor = titleBar.ButtonForegroundColor = Colors.White;
- titleBar.ButtonHoverBackgroundColor = Colors.IndianRed;
- titleBar.ButtonPressedBackgroundColor = Colors.DarkRed;
-
- CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
- coreTitleBar.ExtendViewIntoTitleBar = false;
- }
-
- private void menuButton_Click(object sender, RoutedEventArgs e)
- {
- menu.IsPaneOpen = !menu.IsPaneOpen;
- }
-
public void GotNotification()
{
- notificationMenu.Content = "";
+ notificationMenu.Content = "\xED0C";
}
- void MainListSelected(object sender, SelectionChangedEventArgs e)
+ /*void MainListSelected(object sender, SelectionChangedEventArgs e)
{
try
{
@@ -283,12 +261,12 @@ namespace FoxTube
GoToChannel(SecretsVault.Subscriptions[subscriptionsList.SelectedIndex - 1].Snippet.ResourceId.ChannelId);
}
catch { }
- }
+ }*/
public void notificationMenu_Click(object sender, RoutedEventArgs e)
{
- notificationMenu.Content = "";
- notificationPane.IsOpen = !notificationPane.IsOpen;
+ notificationMenu.Content = "\xED0D";
+ //notificationPane.IsOpen = !notificationPane.IsOpen;
}
private void feedback_Click(object sender, RoutedEventArgs e)
@@ -301,20 +279,6 @@ namespace FoxTube
content.Navigate(typeof(Settings), $"feedback&isProblem={isProblem}&meta={meta}");
}
- private void menu_PaneClosed(SplitView sender, object args)
- {
- subsTitle.Visibility = Visibility.Collapsed;
- }
-
- private void menu_PaneOpened(SplitView sender, object args)
- {
- try
- {
- subsTitle.Visibility = Visibility.Visible;
- }
- catch { }
- }
-
private async void createAccount_Click(object sender, RoutedEventArgs e)
{
await Launcher.LaunchUriAsync(new Uri("https://accounts.google.com/signup/v2/webcreateaccount?ManageAccount&flowName=GlifWebSignIn&flowEntry=SignUp"));
@@ -335,92 +299,17 @@ namespace FoxTube
SecretsVault.Deauthenticate();
}
- private void searchField_TextChanged(object sender, TextChangedEventArgs e)
+ public void GoToSearch(string keyword = null)
{
- if (searchField.Text.Length > 2)
- suggestions.BuildList(searchField.Text);
- else
- suggestions.Hide();
- }
+ if(keyword != null)
+ search.Text = keyword;
- private void searchField_GotFocus(object sender, RoutedEventArgs e)
- {
- suggestions.Hide();
- if (Window.Current.Bounds.Width >= 500)
- {
- searchSuggestions.Child = suggestions;
- searchSuggestions.IsOpen = !searchSuggestions.IsOpen;
- }
- else
- popupPlaceholder.Content = suggestions;
- }
-
- private void searchButton_Click(object sender, RoutedEventArgs e)
- {
- if(!string.IsNullOrWhiteSpace(searchField.Text))
+ if (!string.IsNullOrWhiteSpace(search.Text))
{
if (!(content.Content is Search))
- content.Navigate(typeof(Search), searchField.Text);
- else if ((content.Content as Search).Term != searchField.Text)
- (content.Content as Search).Initialize(searchField.Text);
- }
- }
-
- public void GoToSearch(string keyword)
- {
- searchField.Text = keyword;
- searchButton_Click(this, null);
- }
-
- /*private async void StartSearch(string keyword)
- {
- content.Navigate(typeof(Search));
- HamburgerSelectionChanged(null, null);
-
- YouTubeService ytService = SecretsVault.IsAuthorized ? SecretsVault.Service : SecretsVault.NoAuthService;
-
- var searchListRequest = ytService.Search.List("snippet");
- searchListRequest.Q = keyword;
- searchListRequest.SafeSearch = (SearchResource.ListRequest.SafeSearchEnum)(int)settings.Values["safeSearch"];
- searchListRequest.MaxResults = 25;
- try
- {
- searchListRequest.RelevanceLanguage = settings.Values["region"].ToString().Remove(2).ToLower();
- }
- catch(ArgumentOutOfRangeException)
- {
- searchListRequest.RelevanceLanguage = settings.Values["region"].ToString().ToLower();
- }
-
- var response = await searchListRequest.ExecuteAsync();
-
- Search s = content.Content as Search;
- s.SetResults(keyword, (int)response.PageInfo.TotalResults);
- Debug.WriteLine("building items tree...");
- foreach (SearchResult result in response.Items)
- s.AddItem(result);
- s.ring.IsActive = false;
- s.content.Visibility = Visibility.Visible;
- Debug.WriteLine("done");
- }*/
-
- private void searchField_KeyUp(object sender, KeyRoutedEventArgs e)
- {
- if (e.Key == VirtualKey.Enter)
- {
- searchButton_Click(this, null);
- content.Focus(FocusState.Pointer);
- searchSuggestions.IsOpen = false;
- }
- }
-
- private void searchSuggestionsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if(e.AddedItems.Count > 0)
- {
- ListBoxItem item = e.AddedItems[0] as ListBoxItem;
- searchField.Text = item.Content.ToString();
- searchButton_Click(this, null);
+ content.Navigate(typeof(Search), search.Text);
+ else if ((content.Content as Search).Term != search.Text)
+ (content.Content as Search).Initialize(search.Text);
}
}
@@ -432,16 +321,11 @@ namespace FoxTube
public void GoToVideo(string id)
{
- menu.DisplayMode = SplitViewDisplayMode.CompactOverlay;
- menu.IsPaneOpen = false;
- isForcedCollapsed = true;
+ nav.IsPaneOpen = false;
videoPlaceholder.Content = null;
- videoPlaceholder.Width = double.NaN;
- videoPlaceholder.Height = double.NaN;
- videoPlaceholder.VerticalAlignment = VerticalAlignment.Stretch;
- videoPlaceholder.HorizontalAlignment = HorizontalAlignment.Stretch;
- videoPlaceholder.Margin = new Thickness(0);
+ MaximizeVideo();
+ Fullscreen(false);
videoPlaceholder.Navigate(typeof(VideoPage), id);
}
@@ -462,51 +346,11 @@ namespace FoxTube
{
if (videoPlaceholder.Content != null)
(videoPlaceholder.Content as VideoPage).player.UpdateSize();
-
- if(isForcedCollapsed)
- {
- if (e.NewSize.Width >= 600 && paneState != RightPaneState.Collapsed)
- {
- menu.DisplayMode = SplitViewDisplayMode.CompactOverlay;
- menu.IsPaneOpen = false;
- paneState = RightPaneState.Collapsed;
- }
- else if (e.NewSize.Width < 600 && paneState != RightPaneState.Hidden)
- {
- menu.DisplayMode = SplitViewDisplayMode.Overlay;
- menu.IsPaneOpen = false;
- paneState = RightPaneState.Hidden;
- }
- }
- else
- {
- if (e.NewSize.Width >= 1000 && paneState != RightPaneState.Full)
- {
- menu.DisplayMode = SplitViewDisplayMode.CompactInline;
- menu.IsPaneOpen = true;
- paneState = RightPaneState.Full;
- }
- else if(e.NewSize.Width >= 600 && e.NewSize.Width < 1000 && paneState != RightPaneState.Collapsed)
- {
- menu.DisplayMode = SplitViewDisplayMode.CompactOverlay;
- menu.IsPaneOpen = false;
- paneState = RightPaneState.Collapsed;
- }
- else if(e.NewSize.Width < 600 && paneState != RightPaneState.Hidden)
- {
- menu.DisplayMode = SplitViewDisplayMode.Overlay;
- menu.IsPaneOpen = false;
- paneState = RightPaneState.Hidden;
- }
- }
}
public void MinimizeAsInitializer()
{
- try
- {
- (videoPlaceholder.Content as VideoPage).player.minimize_Click(this, null);
- }
+ try { (videoPlaceholder.Content as VideoPage).player.minimize_Click(this, null); }
catch { }
}
@@ -532,15 +376,15 @@ namespace FoxTube
{
if(on)
{
- grid.RowDefinitions[0].Height = new GridLength(0);
- menu.CompactPaneLength = 0;
- menu.OpenPaneLength = 0;
+ nav.AlwaysShowHeader = false;
+ nav.CompactPaneLength = 0;
+ nav.OpenPaneLength = 0;
}
else
{
- grid.RowDefinitions[0].Height = new GridLength(50);
- menu.CompactPaneLength = 50;
- menu.OpenPaneLength = 250;
+ nav.AlwaysShowHeader = true;
+ nav.CompactPaneLength = 48;
+ nav.OpenPaneLength = 300;
}
}
@@ -554,5 +398,32 @@ namespace FoxTube
videoPlaceholder.Content = null;
MaximizeVideo();
}
+
+ private void search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
+ {
+ GoToSearch();
+ }
+
+ private void search_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
+ {
+ if(search.Text.Length > 2)
+ {
+ XmlDocument doc = new XmlDocument();
+ doc.Load($"http://suggestqueries.google.com/complete/search?output=toolbar&hl={(settings.Values["region"] as string)[0] + (settings.Values["region"] as string)[1]}&q={search.Text}");
+
+ if (doc["toplevel"].HasChildNodes)
+ for (int k = 0; k < 5; k++)
+ try
+ {
+ search.Items.Add(doc["toplevel"].ChildNodes[k]["suggestion"].GetAttribute("data"));
+ }
+ catch { break; }
+ }
+ }
+
+ private void nav_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
+ {
+
+ }
}
}
diff --git a/FoxTube/Pages/Settings.xaml b/FoxTube/Pages/Settings.xaml
index bda4df0..53f094e 100644
--- a/FoxTube/Pages/Settings.xaml
+++ b/FoxTube/Pages/Settings.xaml
@@ -10,82 +10,32 @@
mc:Ignorable="d">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
+
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/FoxTube/Pages/Settings.xaml.cs b/FoxTube/Pages/Settings.xaml.cs
index ef64e53..00e2726 100644
--- a/FoxTube/Pages/Settings.xaml.cs
+++ b/FoxTube/Pages/Settings.xaml.cs
@@ -27,28 +27,9 @@ namespace FoxTube
///
public sealed partial class Settings : Page
{
- ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
public Settings()
{
this.InitializeComponent();
-
- language.SelectedIndex = (int)settings.Values["language"];
- quality.SelectedIndex = (int)settings.Values["quality"];
-
- newVideo.IsChecked = (bool)settings.Values["newVideoNotification"];
- messages.IsChecked = (bool)settings.Values["newmessagesNotification"];
-
- mobileWarning.IsOn = (bool)settings.Values["moblieWarning"];
- autoplay.IsOn = (bool)settings.Values["videoAutoplay"];
-
- safeSearch.SelectedIndex = (int)settings.Values["safeSearch"];
-
- foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
- {
- region.Items.Add(culture.DisplayName);
- if (culture.Name == (string)settings.Values["region"])
- region.SelectedIndex = region.Items.Count - 1;
- }
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -58,7 +39,7 @@ namespace FoxTube
{
if((e.Parameter as string).Contains("feedback"))
{
- toFeedback_Click(this, null);
+ pivot.SelectedIndex = 1;
if ((string)e.Parameter != "feedback")
{
((pivot.Items[1] as PivotItem).Content as Feedback).PreDefine(Convert.ToBoolean((e.Parameter as string).Split('&', '=')[2]), (e.Parameter as string).Split('&', '=')[4]);
@@ -68,104 +49,16 @@ namespace FoxTube
switch(e.Parameter as string)
{
case "about":
- toAbout_Click(this, null);
+ pivot.SelectedIndex = 2;
break;
case "translate":
- toTranslate_Click(this, null);
+ pivot.SelectedIndex = 3;
break;
case "inbox":
- toInbox_Click(this, null);
+ pivot.SelectedIndex = 4;
break;
}
}
}
-
- private void language_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if ((int)settings.Values["language"] != language.SelectedIndex)
- {
- settings.Values["language"] = language.SelectedIndex;
- restartNote.Visibility = Visibility.Visible;
- }
- }
-
- private void quality_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- settings.Values["quality"] = quality.SelectedIndex;
- }
-
- private void notification_IsEnabledChanged(object sender, RoutedEventArgs e)
- {
- if ((bool)settings.Values["newVideoNotification"] != newVideo.IsChecked)
- settings.Values["newVideoNotification"] = newVideo.IsChecked;
-
- if ((bool)settings.Values["newmessagesNotification"] != messages.IsChecked)
- settings.Values["newmessagesNotification"] = messages.IsChecked;
-
- if ((bool)settings.Values["moblieWarning"] != mobileWarning.IsOn)
- settings.Values["moblieWarning"] = mobileWarning.IsOn;
-
- if ((bool)settings.Values["videoAutoplay"] != autoplay.IsOn)
- settings.Values["videoAutoplay"] = autoplay.IsOn;
- }
-
- private void toGeneral_Click(object sender, RoutedEventArgs e)
- {
- pivot.SelectedIndex = 0;
- }
-
- private void toFeedback_Click(object sender, RoutedEventArgs e)
- {
- pivot.SelectedIndex = 1;
- }
-
- private void toTranslate_Click(object sender, RoutedEventArgs e)
- {
- pivot.SelectedIndex = 3;
- }
-
- private void content_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- toGeneral.FontWeight = FontWeights.Normal;
- toFeedback.FontWeight = FontWeights.Normal;
- toAbout.FontWeight = FontWeights.Normal;
- toTranslate.FontWeight = FontWeights.Normal;
- toInbox.FontWeight = FontWeights.Normal;
-
- if (pivot.SelectedIndex == 0)
- toGeneral.FontWeight = FontWeights.Bold;
- else if (pivot.SelectedIndex == 1)
- toFeedback.FontWeight = FontWeights.Bold;
- else if (pivot.SelectedIndex == 2)
- toAbout.FontWeight = FontWeights.Bold;
- else if (pivot.SelectedIndex == 3)
- toTranslate.FontWeight = FontWeights.Bold;
- else if (pivot.SelectedIndex == 4)
- {
- toInbox.FontWeight = FontWeights.Bold;
- if (!((pivot.SelectedItem as PivotItem).Content as Inbox).Loaded)
- ((pivot.SelectedItem as PivotItem).Content as Inbox).LoadItems();
- }
- }
-
- private void toAbout_Click(object sender, RoutedEventArgs e)
- {
- pivot.SelectedIndex = 2;
- }
-
- private void region_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- settings.Values["region"] = CultureInfo.GetCultures(CultureTypes.AllCultures)[region.SelectedIndex].Name;
- }
-
- private void safeSearch_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- settings.Values["safeSearch"] = safeSearch.SelectedIndex;
- }
-
- private void toInbox_Click(object sender, RoutedEventArgs e)
- {
- pivot.SelectedIndex = 4;
- }
}
}
diff --git a/FoxTube/Pages/SettingsPages/General.xaml b/FoxTube/Pages/SettingsPages/General.xaml
new file mode 100644
index 0000000..8472cd9
--- /dev/null
+++ b/FoxTube/Pages/SettingsPages/General.xaml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FoxTube/Pages/SettingsPages/General.xaml.cs b/FoxTube/Pages/SettingsPages/General.xaml.cs
new file mode 100644
index 0000000..9b08a4c
--- /dev/null
+++ b/FoxTube/Pages/SettingsPages/General.xaml.cs
@@ -0,0 +1,86 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.Storage;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+
+// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
+
+namespace FoxTube.Pages.SettingsPages
+{
+ ///
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ ///
+ public sealed partial class General : Page
+ {
+ ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
+ public General()
+ {
+ this.InitializeComponent();
+
+ language.SelectedIndex = (int)settings.Values["language"];
+ quality.SelectedIndex = (int)settings.Values["quality"];
+
+ newVideo.IsOn = (bool)settings.Values["newVideoNotification"];
+
+ mobileWarning.IsOn = (bool)settings.Values["moblieWarning"];
+ autoplay.IsOn = (bool)settings.Values["videoAutoplay"];
+
+ safeSearch.SelectedIndex = (int)settings.Values["safeSearch"];
+
+ foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
+ {
+ region.Items.Add(culture.DisplayName);
+ if (culture.Name == (string)settings.Values["region"])
+ region.SelectedIndex = region.Items.Count - 1;
+ }
+ }
+
+ private void language_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if ((int)settings.Values["language"] != language.SelectedIndex)
+ {
+ settings.Values["language"] = language.SelectedIndex;
+ restartNote.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void quality_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ settings.Values["quality"] = quality.SelectedIndex;
+ }
+
+ private void notification_IsEnabledChanged(object sender, RoutedEventArgs e)
+ {
+ if ((bool)settings.Values["newVideoNotification"] != newVideo.IsOn)
+ settings.Values["newVideoNotification"] = newVideo.IsOn;
+
+ if ((bool)settings.Values["moblieWarning"] != mobileWarning.IsOn)
+ settings.Values["moblieWarning"] = mobileWarning.IsOn;
+
+ if ((bool)settings.Values["videoAutoplay"] != autoplay.IsOn)
+ settings.Values["videoAutoplay"] = autoplay.IsOn;
+ }
+
+ private void region_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ settings.Values["region"] = CultureInfo.GetCultures(CultureTypes.AllCultures)[region.SelectedIndex].Name;
+ }
+
+ private void safeSearch_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ settings.Values["safeSearch"] = safeSearch.SelectedIndex;
+ }
+ }
+}
diff --git a/FoxTube/Pages/VideoPage.xaml b/FoxTube/Pages/VideoPage.xaml
index b980372..45c64a7 100644
--- a/FoxTube/Pages/VideoPage.xaml
+++ b/FoxTube/Pages/VideoPage.xaml
@@ -94,46 +94,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/FoxTube/Pages/VideoPage.xaml.cs b/FoxTube/Pages/VideoPage.xaml.cs
index 883d959..b518a6b 100644
--- a/FoxTube/Pages/VideoPage.xaml.cs
+++ b/FoxTube/Pages/VideoPage.xaml.cs
@@ -79,13 +79,12 @@ namespace FoxTube.Pages
pivot.Items.Insert(0, new PivotItem()
{
Content = descriptionPanel,
- Margin = new Thickness(0, -48, 0, 0)
+ Header = "Description"
});
- tabsPlaceholder.Children.Remove(tabs);
- mainContent.Children.Add(tabs);
-
- toDescription.Visibility = Visibility.Visible;
+ tabsPlaceholder.Children.Remove(pivot);
+ mainContent.Children.Add(pivot);
+
grid.ColumnDefinitions[1].Width = new GridLength(0);
pivot.SelectedIndex = 0;
@@ -287,17 +286,15 @@ namespace FoxTube.Pages
if (e.NewSize.Width > 1000 && e.PreviousSize.Width <= 1000 && !isExtended)
{
- if (mainContent.Children.Contains(tabs))
+ if (mainContent.Children.Contains(pivot))
{
- mainContent.Children.Remove(tabs);
- tabsPlaceholder.Children.Add(tabs);
-
- (pivot.Items[0] as PivotItem).Content = null;
+ mainContent.Children.Remove(pivot);
+ tabsPlaceholder.Children.Add(pivot);
+
pivot.Items.RemoveAt(0);
mainContent.Children.Add(descriptionPanel);
}
-
- toDescription.Visibility = Visibility.Collapsed;
+
grid.ColumnDefinitions[1].Width = new GridLength(400);
}
else if (e.NewSize.Width <= 1000 & e.PreviousSize.Width > 1000)
@@ -308,39 +305,17 @@ namespace FoxTube.Pages
pivot.Items.Insert(0, new PivotItem()
{
Content = descriptionPanel,
- Margin = new Thickness(0, -48, 0, 0)
+ Header = "Description"
});
- tabsPlaceholder.Children.Remove(tabs);
- mainContent.Children.Add(tabs);
+ tabsPlaceholder.Children.Remove(pivot);
+ mainContent.Children.Add(pivot);
}
-
- toDescription.Visibility = Visibility.Visible;
+
grid.ColumnDefinitions[1].Width = new GridLength(0);
}
pivot.SelectedIndex = 0;
- pivot_SelectionChanged(this, null);
- }
-
- private void toDescription_Click(object sender, RoutedEventArgs e)
- {
- pivot.SelectedIndex = 0;
- }
-
- private void toPlaylist_Click(object sender, RoutedEventArgs e)
- {
- pivot.SelectedIndex = pivot.Items.Count - 3;
- }
-
- private void toComments_Click(object sender, RoutedEventArgs e)
- {
- pivot.SelectedIndex = pivot.Items.Count - 1;
- }
-
- private void toSuggestions_Click(object sender, RoutedEventArgs e)
- {
- pivot.SelectedIndex = pivot.Items.Count - 2;
}
private async void Share(DataTransferManager sender, DataRequestedEventArgs args)
@@ -387,51 +362,6 @@ namespace FoxTube.Pages
DataTransferManager.ShowShareUI();
}
- private void pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- toDescription.FontWeight = FontWeights.Normal;
- toPlaylist.FontWeight = FontWeights.Normal;
- toSuggestions.FontWeight = FontWeights.Normal;
- toComments.FontWeight = FontWeights.Normal;
-
- if (pivot.SelectedIndex == 0)
- {
- if (toDescription.Visibility != Visibility.Collapsed)
- toDescription.FontWeight = FontWeights.Bold;
- else if (toPlaylist.Visibility != Visibility.Collapsed)
- toPlaylist.FontWeight = FontWeights.Bold;
- else
- toSuggestions.FontWeight = FontWeights.Bold;
- }
- else if (pivot.SelectedIndex == 1)
- {
- if (toDescription.Visibility == Visibility.Collapsed)
- {
- if (toPlaylist.Visibility == Visibility.Collapsed)
- toComments.FontWeight = FontWeights.Bold;
- else
- toSuggestions.FontWeight = FontWeights.Bold;
- }
- else
- {
- if (toPlaylist.Visibility != Visibility.Collapsed)
- toPlaylist.FontWeight = FontWeights.Bold;
- else
- toSuggestions.FontWeight = FontWeights.Bold;
- }
-
- }
- else if (pivot.SelectedIndex == 2)
- {
- if(toDescription.Visibility != Visibility.Collapsed && toPlaylist.Visibility != Visibility.Collapsed)
- toSuggestions.FontWeight = FontWeights.Bold;
- else if (toDescription.Visibility != Visibility.Collapsed || toPlaylist.Visibility != Visibility.Collapsed)
- toComments.FontWeight = FontWeights.Bold;
- }
- else if (pivot.SelectedIndex == 3)
- toComments.FontWeight = FontWeights.Bold;
- }
-
private async void dislike_Click(object sender, RoutedEventArgs e)
{
if (SecretsVault.IsAuthorized)