예제 #1
0
        /// <summary>
        ///     Invoked when the application is launched normally by the end user.  Other entry points
        ///     will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            var content = Window.Current.Content as IFrameView;
            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (content == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                var bootstrapper = new SplitViewBootstrapper();
                await bootstrapper.InitializeAsync();

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        // Something went wrong restoring state.
                        // Assume there is no state and continue
                    }
                }
                bootstrapper.Start();
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
예제 #2
0
        /// <summary>
        ///     Invoked when the application is launched normally by the end user.  Other entry points
        ///     will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            var content = Window.Current.Content as IFrameView;
            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (content == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                var bootstrapper = new SplitViewBootstrapper();
                await bootstrapper.InitializeAsync();

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        // Something went wrong restoring state.
                        // Assume there is no state and continue
                    }
                }
                bootstrapper.Start();
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }