private ExitCode RunAppStart(IAppStart appStart) { // Run this in a separate thread to avoid deadlocks var exitCode = ExitCode.Ok; var thread = new Thread(() => exitCode = appStart.Run().GetAwaiter().GetResult()); thread.SetApartmentState(ApartmentState.STA); thread.Start(); thread.Join(); return(exitCode); }
private void App_OnStartup(object sender, StartupEventArgs e) { try { _appStart.CheckApplicationConditions(); } catch (StartupConditionFailedException ex) { _logger.Error($"Error while starting the application: {ex.Message} ({ex.ExitCode})"); Shutdown(ex.ExitCode); return; } var exitCode = _appStart.Run(); Shutdown(exitCode); }
protected override void OnStartup(StartupEventArgs e) { try { if (!_appStart.SkipStartupConditionCheck) { // Load settings to have the proper translation available _settingsManager.LoadAllSettings(); _appStart.CheckApplicationConditions(); } } catch (StartupConditionFailedException ex) { _logger.Error($"Error while starting the application: {ex.Message} ({ex.ExitCode})"); Shutdown(ex.ExitCode); return; } var exitCode = _appStart.Run(); Shutdown((int)exitCode); }