예제 #1
0
        public async Task <TShell> CreateAsync <TShell>()
            where TShell : class, IShell
        {
            await _applicationInitializationService.InitializeBeforeShowingSplashScreenAsync();

            TShell shell = null;

            if (_applicationInitializationService.ShowSplashScreen)
            {
                Log.Debug("Showing splash screen");

                var splashScreen = _splashScreenService.CreateSplashScreen();
                splashScreen.Show();

                shell = await CreateShellInternalAsync <TShell>(splashScreen.Close);
            }
            else
            {
                Log.Debug("Not showing splash screen");

                // Note: it's important to change the application mode. If we are not showing a splash screen,
                // the app won't have a window and will immediately close (if we start any task that is awaited)
                var application = Application.Current;
                var currentApplicationCloseMode = application.ShutdownMode;
                application.ShutdownMode = ShutdownMode.OnExplicitShutdown;

                shell = await CreateShellInternalAsync <TShell>();

                application.ShutdownMode = currentApplicationCloseMode;
            }

            return(shell);
        }
예제 #2
0
        public async Task <TShell> CreateWithSplash <TShell>()
            where TShell : IShell
        {
            var splashScreen = _splashScreenService.CreateSplashScreen();

            splashScreen.Show();

            var shell = await CreateShellInternal <TShell>(splashScreen.Close);

            return(shell);
        }
예제 #3
0
        public async Task <TShell> CreateWithSplashAsync <TShell>()
            where TShell : IShell
        {
            await _applicationInitializationService.InitializeBeforeShowingSplashScreenAsync();

            var splashScreen = _splashScreenService.CreateSplashScreen();

            splashScreen.Show();

            var shell = await CreateShellInternalAsync <TShell>(splashScreen.Close);

            return(shell);
        }
예제 #4
0
        /// <summary>
        /// Creates a new shell and shows a splash during the initialization.
        /// </summary>
        /// <typeparam name="TShell">The type of the shell.</typeparam>
        /// <param name="preInitialize">The pre initialize handler to initialize custom logic. If <c>null</c>, this value will be ignored.</param>
        /// <param name="initializeCommands">The initialize commands handler. If <c>null</c>, no commands will be initialized.</param>
        /// <param name="postInitialize">The post initialize handler to initialize custom logic. If <c>null</c>, this value will be ignored.</param>
        /// <returns>The created shell.</returns>
        /// <exception cref="OrchestraException">The shell is already created and cannot be created again.</exception>
        public TShell CreateWithSplash <TShell>(Action preInitialize = null, Action <ICommandManager> initializeCommands = null, Action postInitialize = null)
            where TShell : IShell
        {
            var splashScreen = _splashScreenService.CreateSplashScreen();

            splashScreen.Show();

            var shell = Create <TShell>(preInitialize, initializeCommands, postInitialize);

            splashScreen.Close();

            return(shell);
        }