示例#1
0
 public bool CompareVersion()
 {
     try
     {
         string versionName;
         versionName = "Order_Easy";
         tb_Version version = SelectVersion(versionName);
         if (version != null)
         {
             if (currentVersion != version.Version)
             {
                 if (MessageBox.Show("发现新版本" + version.Version + ",是否更新?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                 {
                     string updatePath = Application.StartupPath + "\\Update\\Update.exe";
                     System.Diagnostics.Process.Start(updatePath, version.Path);
                     //System.Environment.Exit(System.Environment.ExitCode);
                     Application.Exit();
                     Program.log.Info("更新为版本:" + version.Version);
                     return(true);
                 }
             }
         }
         else
         {
             string msg = "错误:获取版本信息失败!";
             Program.log.Error(msg);
             MessageBox.Show(msg);
         }
     }
     catch (Exception ex)
     {
         string msg = "错误:获取版本信息失败!";
         Program.log.Error(msg + ex.Message);
         MessageBox.Show(msg);
     }
     return(false);
 }