public void checkUpdate() { if (string.IsNullOrEmpty(config.UpdateUrl)) config.UpdateUrl = updateUrl; SoftUpdate app = new SoftUpdate(config.UpdateUrl, Application.ExecutablePath, "zha7idle"); try { MyMessageForm mMsgForm = new MyMessageForm(); if (app.IsUpdate && mMsgForm.Show(string.Format("检查到新版本{0},是否更新?\r\n更新说明:\r\n{1}", app.NewVerson, app.UpdateHelp), "更新日志", MyMessageForm.MessageButton.YesNo) == DialogResult.Yes) { upform = new UpdateForm(app); upform.ShowDialog(); } tmpnotice = app.Notice; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 构造函数 /// </summary> /// <param name="url">升级Url</param> public UpdateForm(SoftUpdate app) { InitializeComponent(); this.Text = "更新中"; //app = new SoftUpdate(url, Application.ExecutablePath, "zha7idle"); app.UpdateFinish += new UpdateState(app_UpdateFinish); app.UpdateProgressChage += App_UpdateProgressChage; try { if (app.IsUpdate) { Thread update = new Thread(new ThreadStart(app.Update)); update.Start(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }