예제 #1
0
 //立即更新
 private void btnUpdate_Click(object sender, RoutedEventArgs e)
 {
     this.Hide();
     MainWindow mainWindow = new MainWindow();
     mainWindow.ShowDialog();
     this.Close();
 }
예제 #2
0
 void _backWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     //如果是正常完成,进入安装界面
     if (_isNormal)
     {
         this.Hide();
         MainWindow mw = new MainWindow();
         mw.ShowDialog();
     }
     NamedPipeClientHelper.Close();
     this.Close();
 }
예제 #3
0
파일: App.xaml.cs 프로젝트: liujf5566/Tool
 protected override void OnStartup(StartupEventArgs e)
 {
     //后台提示更新
     if (e.Args != null && e.Args.Length != 0 && e.Args[0] == "backPrompt")
     {
         BackPromptWindow promptWindow = new BackPromptWindow();
         promptWindow.ShowDialog();
     }
     else
     {
         bool isDowanloaded = CheckUpdateHelper.IsDownloaded();
         bool isMustUpdate = CheckUpdateHelper.IsMustUpdate();
         //如果下载完成
         if (isDowanloaded)
         {
             //如果是强制更新
             if (isMustUpdate)
             {
                 MainWindow mw = new MainWindow();
                 mw.ShowDialog();
             }
             //如果不是强制更新
             else
             {
                 UpdatePromptWindow upw = new UpdatePromptWindow();
                 upw.ShowDialog();
             }
         }
         //如果未下载完成
         else
         {
             //如果是强制更新
             if (isMustUpdate)
             {
                 WaitDownloadWindow wdw = new WaitDownloadWindow();
                 wdw.ShowDialog();
             }
             //如果不是强制更新
             else
             {
                 //启动MVP客户端
                 string clientPath = AppDomain.CurrentDomain.BaseDirectory + ConfigurationManager.AppSettings["ClientApp"];
                 System.Diagnostics.Process clientApp = new System.Diagnostics.Process { StartInfo = { FileName = clientPath } };
                 clientApp.Start();
             }
         }
     }
 }
예제 #4
0
 //下载安装
 private void btnInstall_Click(object sender, RoutedEventArgs e)
 {
     //检查客户端程序是否正在运行
     string clientApp = ConfigurationManager.AppSettings["ClientApp"];
     var clientPros = ProcessHelper.GetCurrentUserProcess(Path.GetFileNameWithoutExtension(clientApp));
     //如果客户端正在运行,关闭客户端
     if (clientPros != null && clientPros.Count != 0)
     {
         foreach (var client in clientPros)
         {
             client.Kill();
         }
     }
     //启动更新程序
     this.Hide();
     MainWindow mainWindow = new MainWindow();
     mainWindow.ShowDialog();
 }