private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { ISLogger.MessageOut -= ISLogger_MessageOut; if (server == null || server.Running) { server.Stop(); } trayIcon.Visible = false; ISLogger.Exit(); }
protected override void OnStop() { try { ISLogger.Write($"Stopping service..."); ipcRead?.Close(); spMon?.StopMonitoring(); launcher.KillSp(); namedIpc?.Dispose(); cSocket?.Dispose(); ISLogger.Exit(); }catch (Exception) { } }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Console.WriteLine("UNHANDLED EXCEPTION"); Exception ex = e.ExceptionObject as Exception; while (ex.InnerException != null) { ex = ex.InnerException; } ISLogger.Write(ex.Message); ISLogger.Exit(); }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Console.WriteLine("UNHANDLED EXCEPTION"); Exception ex = e.ExceptionObject as Exception; while (ex.InnerException != null) { ex = ex.InnerException; } ISLogger.Write(ex.Message); ISLogger.Exit(); Process.GetCurrentProcess().Kill(); //kill process which will cause the service to restart the process }