Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public Resource(TShell shell, TObject fillings)
 {
     Shell    = new WeakReference(shell);
     Fillings = fillings;
 }