//检查更新 private void CheckNewVersion_Tick(object sender, EventArgs e) { try { _checkUpdate = new CheckUpdate(); if (_checkUpdate.IsConnectedInternet()) { if (_checkUpdate.Download()) { if (_checkUpdate.HasNewVersion()) { form_Update = UpdateForm.GetInstance(_checkUpdate.NewVersion); form_Update.CloseHandlor += new UpdateForm.CloseHandler(CloseDeskHelper); form_Update.ShowForm(); } } } } catch (Exception ex) { log.WriteLog(ex.ToString()); } finally { updateTimer.Enabled = false; } }
//检查更新 private void UpdateMenuItem_Click(object sender, EventArgs e) { try { check = new CheckUpdate(); if (check.IsConnectedInternet()) { if (check.Download()) { if (check.HasNewVersion()) { updateForm = UpdateForm.GetInstance(check.NewVersion); updateForm.CloseHandlor += new UpdateForm.CloseHandler(CloseDeskHelper); updateForm.ShowForm(); } else//HasNewVersion() { MessageBox.Show("已经是最新版本"); } } else//Download() { MessageBox.Show("已经是最新版本"); } } else//IsConnectedInternet() { MessageBox.Show("本机没有连接互联网"); } } catch { } }
//检查更新 private void UpdateToolStripMenuItem_Click(object sender, EventArgs e) { try { _checkUpdate = new CheckUpdate(); if (_checkUpdate.IsConnectedInternet()) { if (_checkUpdate.Download()) { if (_checkUpdate.HasNewVersion()) { form_Update = UpdateForm.GetInstance(_checkUpdate.NewVersion); form_Update.CloseHandlor += new UpdateForm.CloseHandler(CloseDeskHelper); form_Update.ShowForm(); } else//HasNewVersion() { MessageBox.Show("已经是最新版本"); } } else//Download() { MessageBox.Show("已经是最新版本"); } } else//IsConnectedInternet() { MessageBox.Show("本机没有连接互联网"); } } catch (Exception ex) { log.WriteLog(ex.ToString()); } }
//检查更新 private void CheckNewVersion() { try { check = new CheckUpdate(); if (check.IsConnectedInternet()) { if (check.Download()) { if (check.HasNewVersion()) { updateForm = UpdateForm.GetInstance(check.NewVersion); updateForm.CloseHandlor += new UpdateForm.CloseHandler(CloseDeskHelper); updateForm.ShowForm(); } } } } catch { } }