static void Main(string[] args) { _currentDomain.ProcessExit += CurrentDomain_ProcessExit; _currentDomain.UnhandledException += ExceptionsHandler; Console.WriteLine(@"Hello! This is OnLooker App!"); try { CDbDeploy.ConnectDataBase(); CDbDeploy.Update(); var t = new Thread(Go); t.Start(); t.Join(); } catch (Exception e) { SLogger.Log.Fatal("Unexpected termination: " + e.Message); Console.WriteLine($"Error: {e.Message}\nPress any key to close application"); } finally { CDbConnection.ConnectionClose(); } Console.ReadLine(); }
static void CurrentDomain_ProcessExit(object sender, EventArgs e) { SLogger.Log.Debug($"Application terminated {e}"); CDbConnection.ConnectionClose(); }