public UpdateForm(DateTime remindLater, String appCast, String registryLocation, int remindLaterAt, AutoUpdater.RemindLaterFormat remindLaterFormat, bool letUserSelectRemindLater) { SetTimer(remindLater); _appCast = appCast; _remindLaterAt = remindLaterAt; _remindLaterFormat = remindLaterFormat; _registryLocation = registryLocation; _letUserSelectRemindLater = letUserSelectRemindLater; }
private void ButtonRemindLaterClick(object sender, EventArgs e) { if (_letUserSelectRemindLater) { var remindLaterForm = new RemindLaterForm(_appTitle); var dialogResult = remindLaterForm.ShowDialog(); if (dialogResult.Equals(DialogResult.OK)) { _remindLaterFormat = remindLaterForm.RemindLaterFormat; _remindLaterAt = remindLaterForm.RemindLaterAt; } else if (dialogResult.Equals(DialogResult.Abort)) { var downloadDialog = new DownloadUpdateDialog(_downloadUrl); try { downloadDialog.ShowDialog(); } catch (System.Reflection.TargetInvocationException) { return; } return; } else { DialogResult = DialogResult.None; return; } } RegistryKey updateKey = Registry.CurrentUser.CreateSubKey(_registryLocation); updateKey.SetValue("version", _currentVersion); updateKey.SetValue("skip", 0); switch (_remindLaterFormat) { case AutoUpdater.RemindLaterFormat.Days: updateKey.SetValue("remindlater", DateTime.Now + TimeSpan.FromDays(_remindLaterAt)); SetTimer(DateTime.Now + TimeSpan.FromDays(_remindLaterAt)); break; case AutoUpdater.RemindLaterFormat.Hours: updateKey.SetValue("remindlater", DateTime.Now + TimeSpan.FromHours(_remindLaterAt)); SetTimer(DateTime.Now + TimeSpan.FromHours(_remindLaterAt)); break; case AutoUpdater.RemindLaterFormat.Minutes: updateKey.SetValue("remindlater", DateTime.Now + TimeSpan.FromMinutes(_remindLaterAt)); SetTimer(DateTime.Now + TimeSpan.FromMinutes(_remindLaterAt)); break; } updateKey.Close(); }
public UpdateForm(String title, String appCast, String appTitle, Version currentVersion, Version installedVersion, String url, String downloadUrl, String registryLocation, int remindLaterAt, AutoUpdater.RemindLaterFormat remindLaterFormat, bool letUserSelectRemindLater) { InitializeComponent(); Text = title; _url = url; _appTitle = appTitle; _downloadUrl = downloadUrl; _currentVersion = currentVersion; _installedVersion = installedVersion; _remindLaterAt = remindLaterAt; _remindLaterFormat = remindLaterFormat; _appCast = appCast; _registryLocation = registryLocation; _letUserSelectRemindLater = letUserSelectRemindLater; labelUpdate.Text = string.Format("A new version of {0} is available!", appTitle); labelDescription.Text = string.Format("{0} {1} is now available. You have version {2} installed. Would you like to download it now?", appTitle, currentVersion, installedVersion.ToString(3)); }
private void ButtonOkClick(object sender, EventArgs e) { if (radioButtonYes.Checked) { switch (comboBoxRemindLater.SelectedIndex) { case 0: RemindLaterFormat = AutoUpdater.RemindLaterFormat.Minutes; RemindLaterAt = 30; break; case 1: RemindLaterFormat = AutoUpdater.RemindLaterFormat.Hours; RemindLaterAt = 12; break; case 2: RemindLaterFormat = AutoUpdater.RemindLaterFormat.Days; RemindLaterAt = 1; break; case 3: RemindLaterFormat = AutoUpdater.RemindLaterFormat.Days; RemindLaterAt = 2; break; case 4: RemindLaterFormat = AutoUpdater.RemindLaterFormat.Days; RemindLaterAt = 4; break; case 5: RemindLaterFormat = AutoUpdater.RemindLaterFormat.Days; RemindLaterAt = 8; break; case 6: RemindLaterFormat = AutoUpdater.RemindLaterFormat.Days; RemindLaterAt = 10; break; } DialogResult = DialogResult.OK; } else { DialogResult = DialogResult.Abort; } }