2015-08-09 20:04:44 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using Windows.ApplicationModel;
|
|
|
|
|
|
using Windows.ApplicationModel.Activation;
|
|
|
|
|
|
using Windows.UI.Xaml;
|
|
|
|
|
|
using Windows.UI.Xaml.Controls;
|
|
|
|
|
|
using Windows.UI.Xaml.Navigation;
|
|
|
|
|
|
|
2021-10-28 20:26:51 +02:00
|
|
|
|
namespace SampleApplication
|
2015-08-09 20:04:44 +02:00
|
|
|
|
{
|
|
|
|
|
|
sealed partial class App : Application
|
|
|
|
|
|
{
|
|
|
|
|
|
public App()
|
|
|
|
|
|
{
|
2017-10-07 17:43:28 +02:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
Suspending += OnSuspending;
|
2015-08-09 20:04:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Frame rootFrame = Window.Current.Content as Frame;
|
|
|
|
|
|
|
|
|
|
|
|
if (rootFrame == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
rootFrame = new Frame();
|
|
|
|
|
|
rootFrame.NavigationFailed += OnNavigationFailed;
|
|
|
|
|
|
|
|
|
|
|
|
Window.Current.Content = rootFrame;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (rootFrame.Content == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
rootFrame.Navigate(typeof(MainPage), e.Arguments);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Window.Current.Activate();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnSuspending(object sender, SuspendingEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var deferral = e.SuspendingOperation.GetDeferral();
|
|
|
|
|
|
deferral.Complete();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|