39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using FoxTube.Classes;
|
|
using System;
|
|
using Windows.UI.Xaml;
|
|
using Windows.UI.Xaml.Controls;
|
|
using Windows.UI.Xaml.Navigation;
|
|
|
|
namespace FoxTube.Controls
|
|
{
|
|
public sealed partial class ContentFrame : UserControl
|
|
{
|
|
public Frame Frame => content;
|
|
public LoadingPage LoadingPage => loading;
|
|
public event NavigatedEventHandler Navigated;
|
|
|
|
public new object Content => content.Content;
|
|
|
|
public ContentFrame()
|
|
{
|
|
InitializeComponent();
|
|
content.Navigated += (s, e) => Navigated?.Invoke(s, e);
|
|
}
|
|
|
|
public void Navigate(Type sourcePageType, object parameter) =>
|
|
content.Navigate(sourcePageType, parameter);
|
|
|
|
void Content_Navigating(object sender, NavigatingCancelEventArgs e) =>
|
|
loading.Refresh();
|
|
|
|
void Loading_RefreshPage(object sender, RoutedEventArgs e)
|
|
{
|
|
content.Navigate(content.CurrentSourcePageType, (content.Content as INavigationPage).Parameter);
|
|
content.BackStack.RemoveAt(content.BackStack.Count - 1);
|
|
}
|
|
|
|
public void Refresh() =>
|
|
Loading_RefreshPage(this, null);
|
|
}
|
|
}
|