33using System . IO ;
44using System . Linq ;
55using System . Runtime . InteropServices . WindowsRuntime ;
6- using Windows . ApplicationModel ;
7- using Windows . ApplicationModel . Activation ;
8- using Windows . Foundation ;
9- using Windows . Foundation . Collections ;
106using Microsoft . UI . Xaml ;
117using Microsoft . UI . Xaml . Controls ;
128using Microsoft . UI . Xaml . Controls . Primitives ;
139using Microsoft . UI . Xaml . Data ;
1410using Microsoft . UI . Xaml . Input ;
1511using Microsoft . UI . Xaml . Media ;
1612using Microsoft . UI . Xaml . Navigation ;
13+ using Microsoft . UI . Xaml . Shapes ;
14+ using Windows . ApplicationModel ;
15+ using Windows . ApplicationModel . Activation ;
16+ using Windows . Foundation ;
17+ using Windows . Foundation . Collections ;
1718
1819// To learn more about WinUI, the WinUI project structure,
1920// and more about our project templates, see: http://aka.ms/winui-project-info.
2021
21- namespace WinUIDemoApp
22+ namespace SfDataGrid_Demo
2223{
2324 /// <summary>
2425 /// Provides application-specific behavior to supplement the default Application class.
2526 /// </summary>
26- sealed partial class App : Application
27+ public partial class App : Application
2728 {
2829 /// <summary>
2930 /// Initializes the singleton application object. This is the first line of authored code
@@ -32,72 +33,21 @@ sealed partial class App : Application
3233 public App ( )
3334 {
3435 this . InitializeComponent ( ) ;
35- this . Suspending += OnSuspending ;
3636 }
3737
3838 /// <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.
39+ /// Invoked when the application is launched.
4140 /// </summary>
42- /// <param name="e ">Details about the launch request and process.</param>
43- protected override void OnLaunched ( Microsoft . UI . Xaml . LaunchActivatedEventArgs e )
41+ /// <param name="args ">Details about the launch request and process.</param>
42+ protected override void OnLaunched ( Microsoft . UI . Xaml . LaunchActivatedEventArgs args )
4443 {
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- }
44+ m_window = new MainWindow ( ) ;
45+ page = new Page ( ) ;
46+ m_window . Activate ( ) ;
7747 }
7848
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- }
49+ public static Window ? m_window ;
50+ public static Page ? page ;
8851
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- }
10252 }
10353}
0 commit comments