private void btnCheckForUpdates_Click(object sender, EventArgs e) { try { UpdateHelper helper = new UpdateHelper(Consts.Application.UpdateCheckURL, Consts.Application.Version); if (helper.IsUpdateAvailable()) { if (MessageBox.Show(String.Format(Resources.Labels.UpdateAvailableFormat, Consts.Application.Version, helper.AvailableVersion()), Resources.Labels.UpdateAvailableTitle, MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) == DialogResult.OK) { helper.StartUpdate(this); } } else { MessageBox.Show(String.Format(Resources.Labels.NoUpdatesFormat, Consts.Application.Version), Resources.Labels.NoUpdatesTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } Parameters.LastUpdateDate = DateTime.Now; } catch (Exception ex) { MessageBox.Show(String.Format(Resources.Labels.UpdateErrorFormat, ex.Message), Resources.Labels.UpdateErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); Log.Write(ex); } }
/// <summary> /// Background worker procedure /// </summary> private void bgwUpdateCheck_DoWork(object sender, DoWorkEventArgs e) { try { UpdateHelper helper = new UpdateHelper(Consts.Application.UpdateCheckURL, Consts.Application.Version); helper.IsUpdateAvailable(); e.Result = helper; } catch (Exception ex) { Log.Write(ex); e.Result = ex; } }