internal RuntimeController( AppConfig appConfig, ILogger logger, IMessageBox messageBox, IOperationSequence bootstrapSequence, IRepeatableOperationSequence sessionSequence, IRuntimeHost runtimeHost, IRuntimeWindow runtimeWindow, IServiceProxy service, SessionContext sessionContext, Action shutdown, ISplashScreen splashScreen, IText text, IUserInterfaceFactory uiFactory) { this.appConfig = appConfig; this.bootstrapSequence = bootstrapSequence; this.logger = logger; this.messageBox = messageBox; this.runtimeHost = runtimeHost; this.runtimeWindow = runtimeWindow; this.sessionSequence = sessionSequence; this.service = service; this.sessionContext = sessionContext; this.shutdown = shutdown; this.splashScreen = splashScreen; this.text = text; this.uiFactory = uiFactory; }
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); }