private void btnCheckForUpdates_Click(object sender, EventArgs e) { try { tlsStatusText.Text = iPlaylist.Resources.Labels.UpdateCheckStatus; UpdateHelper helper = new UpdateHelper(Consts.Maintenance.UpdateURL, Consts.Version); if (helper.IsUpdateAvailable()) { if (MessageBox.Show(String.Format(iPlaylist.Resources.Maintenance.UpdateTextFormat, Consts.Version, helper.AvailableVersion()), iPlaylist.Resources.Maintenance.UpdateTitle, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.OK) { tlsStatusText.Text = iPlaylist.Resources.Labels.UpdateDownloadingStatus; helper.StartUpdate(this); } } else { tlsStatusText.Text = iPlaylist.Resources.Labels.UpdatesNotFoundStatus; MessageBox.Show(String.Format(iPlaylist.Resources.Maintenance.NoUpdatesTextFormat, Consts.Version), iPlaylist.Resources.Maintenance.NoUpdatesTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } Parameters.LastUpdateDate = DateTime.Now; } catch (Exception ex) { tlsStatusText.Text = iPlaylist.Resources.Labels.UpdateFailedStatus; MessageBox.Show(String.Format(iPlaylist.Resources.Maintenance.UpdateErrorTextFormat, ex.Message), iPlaylist.Resources.Maintenance.UpdateErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); Log.Write(ex); } }
private void bgwUpdateCheck_DoWork(object sender, DoWorkEventArgs e) { try { UpdateHelper helper = new UpdateHelper(Consts.Maintenance.UpdateURL, Consts.Version); bool UpdateAvailable = helper.IsUpdateAvailable(); e.Result = helper; } catch (Exception ex) { Log.Write(ex); e.Result = ex; } }