diff --git a/FoxTube.Core/FoxTube.Core.csproj b/FoxTube.Core/FoxTube.Core.csproj
index 379eda5..f869b67 100644
--- a/FoxTube.Core/FoxTube.Core.csproj
+++ b/FoxTube.Core/FoxTube.Core.csproj
@@ -142,6 +142,7 @@
+
diff --git a/FoxTube.Core/Models/IRefreshable.cs b/FoxTube.Core/Models/IRefreshable.cs
index 59324f1..2137791 100644
--- a/FoxTube.Core/Models/IRefreshable.cs
+++ b/FoxTube.Core/Models/IRefreshable.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace FoxTube.Core.Models
+namespace FoxTube.Core.Models
{
public interface IRefreshable
{
diff --git a/FoxTube.Core/Models/PageView.cs b/FoxTube.Core/Models/PageView.cs
new file mode 100644
index 0000000..a48d696
--- /dev/null
+++ b/FoxTube.Core/Models/PageView.cs
@@ -0,0 +1,17 @@
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Navigation;
+
+namespace FoxTube.Core.Models
+{
+ public class PageView : Page
+ {
+ public string Header { get; set; }
+ public object Parameter { get; private set; }
+
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ base.OnNavigatedTo(e);
+ Parameter = e.Parameter;
+ }
+ }
+}
diff --git a/FoxTube/MainPage.xaml b/FoxTube/MainPage.xaml
index e022ca0..d72f36b 100644
--- a/FoxTube/MainPage.xaml
+++ b/FoxTube/MainPage.xaml
@@ -30,7 +30,9 @@
IsTitleBarAutoPaddingEnabled="False"
DisplayModeChanged="NavigationView_DisplayModeChanged"
PaneClosing="NavigationView_PaneClosing"
- PaneOpening="NavigationView_PaneOpening">
+ PaneOpening="NavigationView_PaneOpening"
+ BackRequested="NavigationViewControl_BackRequested"
+ ItemInvoked="NavigationViewControl_ItemInvoked">
@@ -58,8 +60,8 @@
-
-
+
+
@@ -67,20 +69,59 @@
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -89,7 +130,7 @@
-
+
diff --git a/FoxTube/MainPage.xaml.cs b/FoxTube/MainPage.xaml.cs
index e597046..a60b7fc 100644
--- a/FoxTube/MainPage.xaml.cs
+++ b/FoxTube/MainPage.xaml.cs
@@ -1,8 +1,8 @@
using FoxTube.Core.Helpers;
using FoxTube.Core.Models;
-using FoxTube.Views;
using System;
using System.Collections.Generic;
+using System.Linq;
using Windows.ApplicationModel.Core;
using Windows.Foundation.Metadata;
using Windows.UI;
@@ -27,8 +27,7 @@ namespace FoxTube
else if (Settings.Theme == 1)
RequestedTheme = ElementTheme.Dark;
- // TODO: Remove this
- content.Navigate(typeof(Views.Settings));
+ Navigate(typeof(Views.Home));
Window.Current.SetTitleBar(AppTitleBar);
@@ -108,7 +107,7 @@ namespace FoxTube
bool success = await StoreInterop.PurchaseApp();
if (success)
{
- MessageDialog dialog = new MessageDialog("Thanks for purchasing full version of the app (^∇^) In order to complete changes we need to reopen it. But you can do it later (some elements may be broken)", "Thank you for your purchase!");
+ MessageDialog dialog = new MessageDialog("Thanks for purchasing full version of the app (^∇^) In order to complete changes we need to reopen it. Or you can do it later (but some elements may be broken)", "Thank you for your purchase!");
dialog.Commands.Add(new UICommand("Restart", (command) => Utils.RestartApp()));
dialog.Commands.Add(new UICommand("Later"));
dialog.CancelCommandIndex = 1;
@@ -117,13 +116,35 @@ namespace FoxTube
}
}
- public static void Navigate(Type pageType)
+ public static void Navigate(Type pageType) =>
+ Navigate(pageType, null);
+
+ public static void Navigate(Type pageType, object param)
{
-
+ if (pageType == Current.content.CurrentSourcePageType && param == (Current.content.Content as PageView).Parameter)
+ return;
+ // TODO: Add navigation logic for videos
+ Current.content.Navigate(pageType, param);
}
- void Content_Navigated(object sender, NavigationEventArgs e) =>
+ void Content_Navigated(object sender, NavigationEventArgs e)
+ {
refresh.Visibility = (e.Content is IRefreshable) ? Visibility.Visible : Visibility.Collapsed;
+ NavigationViewControl.IsBackEnabled = content.CanGoBack;
+ title.Text = (e.Content as PageView).Header ?? "FoxTube";
+ switch(e.SourcePageType.Name)
+ {
+ case "Home":
+ NavigationViewControl.SelectedItem = home;
+ break;
+ case "Settings":
+ NavigationViewControl.SelectedItem = NavigationViewControl.SettingsItem;
+ break;
+ default:
+ NavigationViewControl.SelectedItem = null;
+ break;
+ }
+ }
void Refresh_Click(object sender, RoutedEventArgs e)
{
@@ -138,6 +159,9 @@ namespace FoxTube
if (sender.Text.Length < 3 || args.Reason != AutoSuggestionBoxTextChangeReason.UserInput)
return;
+ // TODO: Load suggestions
+
+ // TODO: Remove
sender.ItemsSource = new List
{
new SearchSuggestion("Suggestion 0"),
@@ -153,7 +177,53 @@ namespace FoxTube
void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
{
+ // TODO: Go to search
+ }
+ void NavigationViewControl_BackRequested(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewBackRequestedEventArgs args)
+ {
+ // TODO: Add backward navigation logic for videos
+ if (content.CanGoBack)
+ content.GoBack();
+ }
+
+ void NavigationViewControl_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs args)
+ {
+ if (args.IsSettingsInvoked)
+ Navigate(typeof(Views.Settings));
+ else
+ switch((args.InvokedItemContainer as Microsoft.UI.Xaml.Controls.NavigationViewItem).Name)
+ {
+ case "home":
+ Navigate(typeof(Views.Home));
+ break;
+ case "subscriptions":
+ break;
+ case "history":
+ break;
+ case "liked":
+ break;
+ case "wl":
+ break;
+ case "download":
+ break;
+ case "music":
+ break;
+ case "sports":
+ break;
+ case "movies":
+ break;
+ case "news":
+ break;
+ case "live":
+ break;
+ case "spotlight":
+ break;
+ case "vr":
+ break;
+ default:
+ break;
+ }
}
}
}
diff --git a/FoxTube/Views/Home.xaml b/FoxTube/Views/Home.xaml
index 566d7ce..861ee30 100644
--- a/FoxTube/Views/Home.xaml
+++ b/FoxTube/Views/Home.xaml
@@ -1,4 +1,5 @@
-
+ mc:Ignorable="d"
+ Header="Home">
@@ -56,4 +58,4 @@
-
+
diff --git a/FoxTube/Views/Home.xaml.cs b/FoxTube/Views/Home.xaml.cs
index 2bbaa15..c7b4489 100644
--- a/FoxTube/Views/Home.xaml.cs
+++ b/FoxTube/Views/Home.xaml.cs
@@ -1,6 +1,5 @@
using FoxTube.Controls.Cards;
using FoxTube.Core.Models;
-using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
@@ -10,7 +9,7 @@ namespace FoxTube.Views
///
/// An empty page that can be used on its own or navigated to within a Frame.
///
- public sealed partial class Home : Page, IRefreshable
+ public sealed partial class Home : PageView, IRefreshable
{
public Home() =>
InitializeComponent();
diff --git a/FoxTube/Views/Settings.xaml b/FoxTube/Views/Settings.xaml
index 0bbf70b..fabaece 100644
--- a/FoxTube/Views/Settings.xaml
+++ b/FoxTube/Views/Settings.xaml
@@ -1,11 +1,13 @@
-
+ mc:Ignorable="d"
+ Header="Settings">
-
+
@@ -79,7 +79,7 @@
-
+
diff --git a/FoxTube/Views/SettingsSections/Inbox.xaml.cs b/FoxTube/Views/SettingsSections/Inbox.xaml.cs
index deec8e4..6a8d3c6 100644
--- a/FoxTube/Views/SettingsSections/Inbox.xaml.cs
+++ b/FoxTube/Views/SettingsSections/Inbox.xaml.cs
@@ -1,5 +1,6 @@
using FoxTube.Core.Models;
using FoxTube.Core.Models.Inbox;
+using System;
using System.Collections.Generic;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@@ -21,6 +22,10 @@ namespace FoxTube.Views.SettingsSections
{
items = await Core.Helpers.Inbox.GetInbox();
+ // TODO: Remove
+ items.Add(new Changelog("1.0", "Changelog content", "Changelog description", DateTime.Now));
+ items.Add(new DeveloperMessage("id", "Message title", "Message content", DateTime.Now, ""));
+
filter.SelectedIndex = 0;
progressBar.Visibility = Visibility.Collapsed;