private void StartProgram(Settings p_Settings) { Logger.SetLogger(new FormLogger(richTextBox1, LogLevel.Info)); Task.Run(() => { try { _logic = new Logic.Logic(p_Settings, gMapControl1, summaryPanel); _logic.Execute().Wait(); } catch (PtcOfflineException) { Logger.Write("PTC Servers are probably down OR your credentials are wrong. Try google", LogLevel.Error); Logger.Write("Trying again in 20 seconds..."); Thread.Sleep(20000); new Logic.Logic(new Settings(), gMapControl1, summaryPanel).Execute().Wait(); } catch (AccountNotVerifiedException) { Logger.Write("Account not verified. - Exiting"); Environment.Exit(0); } catch (Exception ex) { Logger.Write($"Unhandled exception: {ex}", LogLevel.Error); new Logic.Logic(new Settings(), gMapControl1, summaryPanel).Execute().Wait(); } }); System.Console.ReadLine(); }