private async static Task Main(string[] args) { // Error handling AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnUnhandledException); // Setup IOC container var container = GlobalScope(args); if (container == null) { Environment.ExitCode = -1; if (Environment.UserInteractive) { Console.WriteLine(" Press <Enter> to close"); Console.ReadLine(); } return; } // The main class might change the character encoding // save the original setting so that it can be restored // after the run. var original = Console.OutputEncoding; try { // Load instance of the main class and start the program var wacs = new Wacs(container); Environment.ExitCode = await wacs.Start(); } catch (Exception ex) { Console.WriteLine("Error in main function: " + ex.Message); Environment.ExitCode = -1; } // Restore original code page Console.OutputEncoding = original; }
private async static Task Main(string[] args) { // Error handling AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnUnhandledException); // Uncomment to debug with a local proxy like Fiddler // System.Net.ServicePointManager.ServerCertificateValidationCallback += // (sender, cert, chain, sslPolicyErrors) => true; // Setup IOC container var container = GlobalScope(args); if (container == null) { Environment.ExitCode = -1; return; } // The main class might change the character encoding // save the original setting so that it can be restored // after the run. var original = Console.OutputEncoding; try { // Load instance of the main class and start the program var wacs = new Wacs(container); Environment.ExitCode = await wacs.Start(); } catch (Exception ex) { Console.WriteLine("Error in main function: " + ex.Message); Environment.ExitCode = -1; } // Restore original code page Console.OutputEncoding = original; }