Archived
1
0
This repository has been archived on 2026-04-22. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
FoxTube/FoxTube/Classes/Navigation.cs
T
Michael Gordeev a792132428 App UI development
Updated and enchanced MainPage
Updated Core
2020-05-12 01:32:41 +03:00

35 lines
879 B
C#

namespace FoxTube
{
public enum NavigationTarget
{
Home,
Settings,
Downloads
}
public static class Navigation
{
public static NavigationTarget CurrentPage { get; private set; }
public static object CurrentParameter { get; private set; }
public static void NavigateTo(NavigationTarget destination) =>
NavigateTo(destination, null);
public static void NavigateTo(NavigationTarget destination, object parameters)
{
MainPage.Current.Navigate(destination switch
{
NavigationTarget.Settings => typeof(Views.Settings),
NavigationTarget.Downloads => typeof(Views.Downloads),
_ => UserManagement.Authorized ? typeof(Views.Home) : typeof(Views.HomeSections.Trending),
},
parameters);
CurrentPage = destination;
CurrentParameter = parameters;
}
public static void RefreshCurrentPage() =>
MainPage.Current.Refresh();
}
}