Created
October 10, 2019 13:01
-
-
Save bluewalk/f6d45e2a9782b902092bc921eb629a74 to your computer and use it in GitHub Desktop.
Revisions
-
bluewalk created this gist
Oct 10, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ class Program { // AutoResetEvent to signal when to exit the application. private static readonly AutoResetEvent WaitHandle = new AutoResetEvent(false); static async Task Main(string[] args) { var version = FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.Location).ProductVersion; Console.WriteLine($"[APP] version {version}"); Console.WriteLine("[GITHUB_LINK]\n"); var logic = new Logic(); // Fire and forget Task.Run(async () => { await logic.Start(); WaitHandle.WaitOne(); }); // Handle Control+C or Control+Break Console.CancelKeyPress += async (o, e) => { Console.WriteLine("Exit"); await logic.Stop(); // Allow the manin thread to continue and exit... WaitHandle.Set(); }; // Wait WaitHandle.WaitOne(); } }