Exemple #1
0
        private async Task InitializeShellAsync(string?parameters = null)
        {
            _isInit = true;

            // If the shell is already setup, handle the protocol, otherwise create the shell.
            if (Window.Current.Content is DesktopShell || Window.Current.Content is XboxShell)
            {
                await SetLoadingAsync(true);

                await ProtocolHelper.HandleProtocolAsync(parameters);
                await SetLoadingAsync(false);
            }
            else
            {
                // Initialize the service
                InitV3Service();

                // This must be run asap
                ViewModelLocator.EarlyInit();

#if DEBUG
                // Opt Out
                await SimpleIoc.Default.GetInstance <ITelemetryService>().OptOutAsync();
#endif

                // If we are running on Xbox, or interactive mode is enable, load the
                // Xbox shell
                if (DeviceHelper.IsXbox || SettingsService.Instance.IsInteractiveMode)
                {
                    // Create the shell
                    Window.Current.Content = new XboxShell(parameters);

                    // Display the screen to the full width and height
                    ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
                }
                else
                {
                    // Live tile helpers
                    TileHelper.Init();

                    // Create the shell
                    Window.Current.Content = new DesktopShell(parameters);
                }

                // Hook the key pressed event for the global app
                Window.Current.CoreWindow.KeyDown += CoreWindowOnKeyDown;
            }

            // Activate the window
            Window.Current.Activate();
        }