Пример #1
0
        private static void WaitAppClose(int waitSec = 30)
        {
            DateTime now = DateTime.Now;

            while ((DateTime.Now - now).TotalSeconds < (double)waitSec)
            {
                if (!BootUp.IsProcessRuning("Bot"))
                {
                    break;
                }
                Thread.Sleep(100);
            }
            if ((DateTime.Now - now).TotalSeconds > (double)waitSec)
            {
                throw new Exception("启动程序超时");
            }
        }
Пример #2
0
 public static void Main(string[] args)
 {
     try
     {
         if (BootUp.IsReboot(args))
         {
             BootUp.WaitAppClose(30);
         }
         var exeFileName = InstalledVersionManager.GetExeFileName();
         if (string.IsNullOrEmpty(exeFileName))
         {
             throw new Exception("找不到可执行文件");
         }
         Process.Start(exeFileName);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "引导器错误");
     }
 }