static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ThreadExceptionHandler handler = new ThreadExceptionHandler(); Application.ThreadException += handler.Application_ThreadException; Application.Run(new FrmContainer()); }
/// <summary> /// Вызывает методы чтения из файла, сжатия/распаковки файла и записи в файл /// </summary> public int Start() { string operation; operation = gZipStreamCommand == CompressionMode.Compress ? "сжатия" : "распаковки"; Console.WriteLine($"Начато выполнение {operation}." + $"\nПосле завершения операции, приложение будет закрыто"); OnException += (e) => ThreadExceptionHandler.Run(e); ReadFile(); ModifyFile(); WriteFile(); countdown.Wait(); return(0); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ThreadExceptionHandler handler = new ThreadExceptionHandler(); Application.ThreadException += new ThreadExceptionEventHandler(handler.LanzadorExcepciones); try { Application.Run(new frmContructor()); } catch (Exception exc) { Log_Excepciones.CapturadorExcepciones(exc, "program.cs", "Main()"); } }
static void Main() { AELogger.Prepare(); try { AppDomain currentDomain = AppDomain.CurrentDomain; ThreadExceptionHandler handler = new ThreadExceptionHandler(); currentDomain.UnhandledException += new UnhandledExceptionEventHandler(handler.ApplicationThreadException); Application.ThreadException += new ThreadExceptionEventHandler(handler.ApplicationThreadException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new LALEForm()); } catch (Exception e) { AELogger.Log("Exception: " + e.Message); AELogger.Log("Exception: " + e.StackTrace); int i = 1; while (e.InnerException != null) { e = e.InnerException; AELogger.Log("InnerException " + i + ": " + e.Message); AELogger.Log("InnerException " + i + ": " + e.StackTrace); i++; } Console.WriteLine(e.Message); MessageBox.Show("UNHAPPY ERROR :(\nhey, you should save the logfile.txt and give it to the developers of this tool \n--------------\n " + e.Message + "\n" + e.StackTrace, "Exception!", MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); } AELogger.WriteLog(); }