private void EnsureRootFrame()

in TpmRcDecoder/TpmRcDecoder.Universal/App.xaml.cs [39:87]


        private void EnsureRootFrame(ApplicationExecutionState previousExecutionState, string arguments)
        {
            AppShell shell = Window.Current.Content as AppShell;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (shell == null)
            {
                // Create a AppShell to act as the navigation context and navigate to the first page
                shell = new AppShell();

                // Set the default language
                shell.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                shell.AppFrame.NavigationFailed += OnNavigationFailed;

                if (previousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
            }

            // Place our app shell in the current Window
            Window.Current.Content = shell;

            if (shell.AppFrame.Content == null)
            {
                ApplicationDataContainer roamingSettings = ApplicationData.Current.RoamingSettings;
                const string DontShowLandingPageSetting = "DontShowLandingPage";

                if (roamingSettings.Values[DontShowLandingPageSetting] != null &&
                    roamingSettings.Values[DontShowLandingPageSetting].Equals(true.ToString()))
                {
                    // When the navigation stack isn't restored, navigate to the first page
                    // suppressing the initial entrance animation. Because landing page is disabled,
                    // got to first content page.
                    shell.AppFrame.Navigate(typeof(RcDecoder), arguments, new Windows.UI.Xaml.Media.Animation.SuppressNavigationTransitionInfo());
                }
                else
                {
                    // When the navigation stack isn't restored, navigate to the first page
                    // suppressing the initial entrance animation.
                    shell.AppFrame.Navigate(typeof(LandingPage), arguments, new Windows.UI.Xaml.Media.Animation.SuppressNavigationTransitionInfo());
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }