Skip to content

Commit c8e8b2c

Browse files
authored
Merge branch 'master' into Kyaa-UpdateTemplate
2 parents 1f46480 + d21e7af commit c8e8b2c

31 files changed

+1217
-77
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,8 @@ msbuild.binlog
227227
!/build/tools/packages.config
228228

229229
# Generated file from .ttinclude
230-
**/Generated/TypeInfo.g.cs
230+
**/Generated/TypeInfo.g.cs
231+
232+
# TAEF Log output
233+
WexLogFileOutput
234+
*.wtl

UITests/UITests.App/App.xaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Application
2+
x:Class="UITests.App.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:UITests.App">
6+
7+
</Application>

UITests/UITests.App/App.xaml.cs

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System;
6+
using Windows.ApplicationModel;
7+
using Windows.ApplicationModel.Activation;
8+
using Windows.UI.Xaml;
9+
using Windows.UI.Xaml.Controls;
10+
using Windows.UI.Xaml.Navigation;
11+
12+
namespace UITests.App
13+
{
14+
public sealed partial class App
15+
{
16+
public App()
17+
{
18+
this.InitializeComponent();
19+
this.Suspending += OnSuspending;
20+
}
21+
22+
/// <summary>
23+
/// Invoked when the application is launched normally by the end user. Other entry points
24+
/// will be used such as when the application is launched to open a specific file.
25+
/// </summary>
26+
/// <param name="e">Details about the launch request and process.</param>
27+
protected override void OnLaunched(LaunchActivatedEventArgs e)
28+
{
29+
Frame rootFrame = Window.Current.Content as Frame;
30+
31+
// Do not repeat app initialization when the Window already has content,
32+
// just ensure that the window is active
33+
if (rootFrame == null)
34+
{
35+
// Create a Frame to act as the navigation context and navigate to the first page
36+
rootFrame = new Frame();
37+
38+
rootFrame.NavigationFailed += OnNavigationFailed;
39+
40+
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
41+
{
42+
// TODO: Load state from previously suspended application
43+
}
44+
45+
// Place the frame in the current Window
46+
Window.Current.Content = rootFrame;
47+
}
48+
49+
if (e.PrelaunchActivated == false)
50+
{
51+
if (rootFrame.Content == null)
52+
{
53+
// When the navigation stack isn't restored navigate to the first page,
54+
// configuring the new page by passing required information as a navigation
55+
// parameter
56+
rootFrame.Navigate(typeof(MainPage), e.Arguments);
57+
}
58+
59+
// Ensure the current window is active
60+
Window.Current.Activate();
61+
}
62+
}
63+
64+
/// <summary>
65+
/// Invoked when Navigation to a certain page fails
66+
/// </summary>
67+
/// <param name="sender">The Frame which failed navigation</param>
68+
/// <param name="e">Details about the navigation failure</param>
69+
private void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
70+
{
71+
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
72+
}
73+
74+
/// <summary>
75+
/// Invoked when application execution is being suspended. Application state is saved
76+
/// without knowing whether the application will be terminated or resumed with the contents
77+
/// of memory still intact.
78+
/// </summary>
79+
/// <param name="sender">The source of the suspend request.</param>
80+
/// <param name="e">Details about the suspend request.</param>
81+
private void OnSuspending(object sender, SuspendingEventArgs e)
82+
{
83+
var deferral = e.SuspendingOperation.GetDeferral();
84+
85+
// TODO: Save application state and stop any background activity
86+
deferral.Complete();
87+
}
88+
}
89+
}
1.4 KB
Loading
7.52 KB
Loading
2.87 KB
Loading
1.61 KB
Loading
1.23 KB
Loading
1.42 KB
Loading
3.13 KB
Loading

0 commit comments

Comments
 (0)