Exemple #1
0
        public bool TryStart()
        {
            logger.Info("Initiating startup procedure...");

            runtimeWindow = uiFactory.CreateRuntimeWindow(appConfig);
            splashScreen  = uiFactory.CreateSplashScreen(appConfig);

            bootstrapSequence.ProgressChanged += BootstrapSequence_ProgressChanged;
            bootstrapSequence.StatusChanged   += BootstrapSequence_StatusChanged;
            sessionSequence.ActionRequired    += SessionSequence_ActionRequired;
            sessionSequence.ProgressChanged   += SessionSequence_ProgressChanged;
            sessionSequence.StatusChanged     += SessionSequence_StatusChanged;

            splashScreen.Show();

            var initialized = bootstrapSequence.TryPerform() == OperationResult.Success;

            if (initialized)
            {
                RegisterEvents();

                logger.Info("Application successfully initialized.");
                logger.Log(string.Empty);
                logger.Subscribe(runtimeWindow);
                splashScreen.Close();

                StartSession();
            }
            else
            {
                logger.Info("Application startup aborted!");
                logger.Log(string.Empty);

                messageBox.Show(TextKey.MessageBox_StartupError, TextKey.MessageBox_StartupErrorTitle, icon: MessageBoxIcon.Error, parent: splashScreen);
            }

            return(initialized && SessionIsRunning);
        }