예제 #1
0
 public static void Protect()
 {
     if (!alive)
     {
         if (count < 2)
         {
             count += 1;
             LogCore.Write("【守护线程】超过2分钟无活动,重置监控线程");
             ComCore.ReMake();
             ProgressCore.KillProcess(false);
             ConfigCore.SwitchNetTest();
             TaskInfos.Clear();
             Form1.MainRestart();
         }
         else
         {
             Process.Start("shutdown.exe", "-r -t 0");
             Form1.MainClose();
         }
     }
     alive = false;
 }
예제 #2
0
 public static void MonitorThread()
 {
     Notification.Show("启动监控程序", ToolTipIcon.Info);
     try
     {
         ComCore.ReMake();
         TaskCore taskCore = GetTaskCore();
         taskCore.InitTask();
         while (true)
         {
             taskCore.TaskMonitor();
         }
     }
     catch (ThreadAbortException)
     {
     }
     catch (Exception e)
     {
         LogCore.Write(e.StackTrace);
         MessageBox.Show(e.StackTrace);
     }
 }