예제 #1
0
        /// <summary>
        ///     Creates the window and performs any protocol logic needed
        /// </summary>
        /// <param name="parameters">Param string, (soundbyte://core/user?id=454345)</param>
        /// <returns></returns>
        private async Task InitializeShellAsync(string parameters = null)
        {
            // Get the main shell
            var shell = Window.Current.Content as MainShell;

            // If the shell is null, we need to set it up.
            if (shell == null)
            {
                shell = new MainShell(parameters);

                // Hook the key pressed event for the global app
                Window.Current.CoreWindow.KeyUp += CoreWindowOnKeyUp;
            }
            else
            {
                await shell.HandleProtocolAsync(parameters);
            }

            // Set the root shell as the window content
            Window.Current.Content = shell;

            try
            {
                // Setup the lights
                LightsSourceHelper.Initialize(() => new PointerPositionSpotLight
                {
                    Active = !(!SettingsService.Instance.IsHighQualityArtwork || DeviceHelper.IsXbox)
                });

                LightsSourceHelper.SetIsLightsContainer(Window.Current.Content, true);
            }
            catch
            {
                // Temp fix around light helper already existing, proper fix later
            }

            // If on xbox display the screen to the full width and height
            if (DeviceHelper.IsXbox)
            {
                ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
            }

            // Activate the window
            Window.Current.Activate();
        }
예제 #2
0
        /// <summary>
        ///     Create the main app shell and load app logic
        /// </summary>
        /// <returns>The main app shell</returns>
        private async Task <MainShell> CreateMainShellAsync(string path = null)
        {
            // Get the main shell
            var shell = Window.Current.Content as MainShell;

            // If the shell is null, we need to set it up.
            if (shell != null)
            {
                if (!string.IsNullOrEmpty(path))
                {
                    await shell.HandleProtocolAsync(path);
                }

                return(shell);
            }

            // Create the main shell
            shell = new MainShell(path);
            // Hook the key pressed event for the global app
            Window.Current.CoreWindow.KeyUp += CoreWindowOnKeyUp;
            // Return the created shell
            return(shell);
        }