Пример #1
0
 static void Main()
 {
     Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
     AppDomain.CurrentDomain.UnhandledException +=
         new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
     Application.ThreadException +=
         new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     try {
         ThisProgram = new UI161();
         Application.Run(ThisProgram);
     } catch (Exception ex) {
         try {
             GetTextWriter(ex);
             if (twError != null)
             {
                 twError.WriteLine(DateTime.Now + " Exception in Main: " + ex.ToString());
                 twError.Flush();
                 twError.Close();
                 twError = null;
             }
         } finally {
             if (twError != null)
             {
                 twError.Flush();
                 twError.Close();
             }
         }
         MessageBox.Show("Exception in Main: " + ex.Message);
         Application.Exit();
     }
 }
Пример #2
0
 public DoSubs(UI161 parent, Modbus MB, GroupBox gb)
 {
     this.MB     = MB;
     this.parent = parent;
     this.gb     = gb;
 }