public static void RunApp() { // Inject platform-specific logic try { using (var ts = new CancellationTokenSource()) using (var solarcar = new CommManager()) { Task solarcar_loop = solarcar.BusinessLoop(ts.Token); // System.Diagnostics.Process.Start(Config.HTTPSERVER_CAR_URL); System.Console.WriteLine("Press any key to halt..."); System.Console.ReadKey(); ts.Cancel(); solarcar_loop.Wait(); } } catch (Exception e) { Debug.WriteLine("PROGRAM:\tEXCEPTION: " + e.ToString()); } finally { Debug.WriteLine("PROGRAM:\tRun finished"); } }
public async Task SolarCarMain() { try { using (var solarcar = new CommManager()) { await solarcar.BusinessLoop(this.solarcar_cancel.Token); } } catch (Exception e) { Debug.WriteLine("PROGRAM: EXCEPTION: " + e.ToString()); } finally { this.mainWindowController.Close(); } }