Skip to content

Commit 1c892d9

Browse files
Merge pull request #1 from Dhanaguvi/main
WINUI-737 (Sample attached)
2 parents 570ace3 + 86efc6c commit 1c892d9

34 files changed

+1585
-0
lines changed

WinUI/.vs/WinUI_TreeGrid/v16/.suo

493 KB
Binary file not shown.

WinUI/App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application
2+
x:Class="WinUI_TreeGrid.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:WinUI_TreeGrid" RequestedTheme="Light">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>

WinUI/App.xaml.cs

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
using Windows.ApplicationModel;
7+
using Windows.ApplicationModel.Activation;
8+
using Windows.Foundation;
9+
using Windows.Foundation.Collections;
10+
using Microsoft.UI.Xaml;
11+
using Microsoft.UI.Xaml.Controls;
12+
using Microsoft.UI.Xaml.Controls.Primitives;
13+
using Microsoft.UI.Xaml.Data;
14+
using Microsoft.UI.Xaml.Input;
15+
using Microsoft.UI.Xaml.Media;
16+
using Microsoft.UI.Xaml.Navigation;
17+
18+
// To learn more about WinUI, the WinUI project structure,
19+
// and more about our project templates, see: http://aka.ms/winui-project-info.
20+
21+
namespace WinUI_TreeGrid
22+
{
23+
/// <summary>
24+
/// Provides application-specific behavior to supplement the default Application class.
25+
/// </summary>
26+
sealed partial class App : Application
27+
{
28+
/// <summary>
29+
/// Initializes the singleton application object. This is the first line of authored code
30+
/// executed, and as such is the logical equivalent of main() or WinMain().
31+
/// </summary>
32+
public App()
33+
{
34+
this.InitializeComponent();
35+
this.Suspending += OnSuspending;
36+
}
37+
38+
/// <summary>
39+
/// Invoked when the application is launched normally by the end user. Other entry points
40+
/// will be used such as when the application is launched to open a specific file.
41+
/// </summary>
42+
/// <param name="e">Details about the launch request and process.</param>
43+
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs e)
44+
{
45+
Frame rootFrame = Window.Current.Content as Frame;
46+
47+
// Do not repeat app initialization when the Window already has content,
48+
// just ensure that the window is active
49+
if (rootFrame == null)
50+
{
51+
// Create a Frame to act as the navigation context and navigate to the first page
52+
rootFrame = new Frame();
53+
54+
rootFrame.NavigationFailed += OnNavigationFailed;
55+
56+
if (e.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Terminated)
57+
{
58+
//TODO: Load state from previously suspended application
59+
}
60+
61+
// Place the frame in the current Window
62+
Window.Current.Content = rootFrame;
63+
}
64+
65+
if (e.UWPLaunchActivatedEventArgs.PrelaunchActivated == false)
66+
{
67+
if (rootFrame.Content == null)
68+
{
69+
// When the navigation stack isn't restored navigate to the first page,
70+
// configuring the new page by passing required information as a navigation
71+
// parameter
72+
rootFrame.Navigate(typeof(MainPage), e.Arguments);
73+
}
74+
// Ensure the current window is active
75+
Window.Current.Activate();
76+
}
77+
}
78+
79+
/// <summary>
80+
/// Invoked when Navigation to a certain page fails
81+
/// </summary>
82+
/// <param name="sender">The Frame which failed navigation</param>
83+
/// <param name="e">Details about the navigation failure</param>
84+
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
85+
{
86+
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
87+
}
88+
89+
/// <summary>
90+
/// Invoked when application execution is being suspended. Application state is saved
91+
/// without knowing whether the application will be terminated or resumed with the contents
92+
/// of memory still intact.
93+
/// </summary>
94+
/// <param name="sender">The source of the suspend request.</param>
95+
/// <param name="e">Details about the suspend request.</param>
96+
private void OnSuspending(object sender, SuspendingEventArgs e)
97+
{
98+
var deferral = e.SuspendingOperation.GetDeferral();
99+
//TODO: Save application state and stop any background activity
100+
deferral.Complete();
101+
}
102+
}
103+
}

WinUI/Assets/Carter.png

49.6 KB
Loading

WinUI/Assets/Coolidge.png

57 KB
Loading

WinUI/Assets/Fillmore.png

60.7 KB
Loading

WinUI/Assets/Garfield.png

44.4 KB
Loading

WinUI/Assets/Grant.png

36.5 KB
Loading

WinUI/Assets/Hayes.png

48.6 KB
Loading

WinUI/Assets/Jackson.png

52.5 KB
Loading

0 commit comments

Comments
 (0)