/// <summary> /// Opens the Download window that download the update and execute the installer when download completes. /// </summary> public static bool DownloadUpdate(UpdateInfoEventArgs args) { if (DownloadUpdateDialogType == null) { using (var downloadDialog = new DownloadUpdateDialog(args)) { try { return(downloadDialog.ShowDialog().Equals(DialogResult.OK)); } catch (TargetInvocationException) { } } return(false); } else { var form = (IForm)Activator.CreateInstance(DownloadUpdateDialogType, args); try { var ret = form.ShowDialog(); return(ret.HasValue && ret.Value == true); } catch (TargetInvocationException) { } return(false); } }
private void ButtonRemindLaterClick(object sender, EventArgs e) { if (AutoUpdater.LetUserSelectRemindLater) { var remindLaterForm = new RemindLaterForm(); var dialogResult = remindLaterForm.ShowDialog(); if (dialogResult.Equals(DialogResult.OK)) { AutoUpdater.RemindLaterTimeSpan = remindLaterForm.RemindLaterFormat; AutoUpdater.RemindLaterAt = remindLaterForm.RemindLaterAt; } else if (dialogResult.Equals(DialogResult.Abort)) { var downloadDialog = new DownloadUpdateDialog(AutoUpdater.DownloadURL); try { downloadDialog.ShowDialog(); } catch (System.Reflection.TargetInvocationException) { return; } return; } else { DialogResult = DialogResult.None; return; } } RegistryKey updateKey = Registry.CurrentUser.CreateSubKey(AutoUpdater.RegistryLocation); if (updateKey != null) { updateKey.SetValue("version", AutoUpdater.CurrentVersion); updateKey.SetValue("skip", 0); DateTime remindLaterDateTime = DateTime.Now; switch (AutoUpdater.RemindLaterTimeSpan) { case RemindLaterFormat.Days: remindLaterDateTime = DateTime.Now + TimeSpan.FromDays(AutoUpdater.RemindLaterAt); break; case RemindLaterFormat.Hours: remindLaterDateTime = DateTime.Now + TimeSpan.FromHours(AutoUpdater.RemindLaterAt); break; case RemindLaterFormat.Minutes: remindLaterDateTime = DateTime.Now + TimeSpan.FromMinutes(AutoUpdater.RemindLaterAt); break; } updateKey.SetValue("remindlater", remindLaterDateTime.ToString(CultureInfo.CreateSpecificCulture("en-US"))); SetTimer(remindLaterDateTime); updateKey.Close(); } }
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(); }
/// <summary> /// Opens the Download window that download the update and execute the installer when download completes. /// </summary> public static void DownloadUpdate() { var downloadDialog = new DownloadUpdateDialog(DownloadURL); try { downloadDialog.ShowDialog(); } catch (TargetInvocationException) {} }
private void ButtonUpdateClick(object sender, EventArgs e) { var downloadDialog = new DownloadUpdateDialog(_downloadUrl); try { downloadDialog.ShowDialog(); } catch (System.Reflection.TargetInvocationException) { } }
/// <summary> /// 打开下载窗口,开始下载更新包 /// </summary> public static bool DownloadUpdate() { var downloadDialog = new DownloadUpdateDialog(DownloadURL); try { return(downloadDialog.ShowDialog().Equals(DialogResult.OK)); } catch (TargetInvocationException) { } return(false); }
/// <summary> /// Opens the Download window that download the update and execute the installer when download completes. /// </summary> public static bool DownloadUpdate(UpdateInfoEventArgs args) { using (var downloadDialog = new DownloadUpdateDialog(args)) { try { return(downloadDialog.ShowDialog().Equals(DialogResult.OK)); } catch (TargetInvocationException) { } } return(false); }
/// <summary> /// Opens the Download window that download the update and execute the installer when download completes. /// <paramref name="restart">Restart after update.</paramref> /// </summary> public static bool DownloadUpdate(bool restart = true) { using (var downloadDialog = new DownloadUpdateDialog(DownloadURL, restart)) { try { return(downloadDialog.ShowDialog().Equals(DialogResult.OK)); } catch (TargetInvocationException) { } } return(false); }
private void ButtonUpdateClick(object sender, EventArgs e) { if (AutoUpdater.OpenDownloadPage) { var processStartInfo = new ProcessStartInfo(AutoUpdater.DownloadURL); Process.Start(processStartInfo); } else { var downloadDialog = new DownloadUpdateDialog(AutoUpdater.DownloadURL); try { downloadDialog.ShowDialog(); } catch (System.Reflection.TargetInvocationException) { } } }
/// <summary> /// Opens the download window that download the update and execute the installer when download completes. /// </summary> public static bool DownloadUpdate(UpdateInfoEventArgs args) { using (var downloadDialog = new DownloadUpdateDialog(args)) { try { if (UseImpersonation) { DomainAuthentication domainAuthentication = new DomainAuthentication(ImpersonationUser, ImpersonationPassword, ImpersonationDomain); return(Impersonator.DoWorkUnderImpersonation(() => downloadDialog.ShowDialog().Equals(DialogResult.OK), domainAuthentication)); } else { return(downloadDialog.ShowDialog().Equals(DialogResult.OK)); } } catch (TargetInvocationException) { } } return(false); }
private void ButtonRemindLaterClick(object sender, EventArgs e) { if(AutoUpdater.LetUserSelectRemindLater) { var remindLaterForm = new RemindLaterForm(); var dialogResult = remindLaterForm.ShowDialog(); if(dialogResult.Equals(DialogResult.OK)) { AutoUpdater.RemindLaterTimeSpan = remindLaterForm.RemindLaterFormat; AutoUpdater.RemindLaterAt = remindLaterForm.RemindLaterAt; } else if(dialogResult.Equals(DialogResult.Abort)) { var downloadDialog = new DownloadUpdateDialog(AutoUpdater.DownloadURL); try { downloadDialog.ShowDialog(); } catch (System.Reflection.TargetInvocationException) { return; } return; } else { DialogResult = DialogResult.None; return; } } RegistryKey updateKey = Registry.CurrentUser.CreateSubKey(AutoUpdater.RegistryLocation); if (updateKey != null) { updateKey.SetValue("version", AutoUpdater.CurrentVersion); updateKey.SetValue("skip", 0); DateTime remindLaterDateTime = DateTime.Now; switch (AutoUpdater.RemindLaterTimeSpan) { case AutoUpdater.RemindLaterFormat.Days: remindLaterDateTime = DateTime.Now + TimeSpan.FromDays(AutoUpdater.RemindLaterAt); break; case AutoUpdater.RemindLaterFormat.Hours: remindLaterDateTime = DateTime.Now + TimeSpan.FromHours(AutoUpdater.RemindLaterAt); break; case AutoUpdater.RemindLaterFormat.Minutes: remindLaterDateTime = DateTime.Now + TimeSpan.FromMinutes(AutoUpdater.RemindLaterAt); break; } updateKey.SetValue("remindlater", remindLaterDateTime.ToString(CultureInfo.CreateSpecificCulture("en-US"))); SetTimer(remindLaterDateTime); updateKey.Close(); } }
public static void DownloadUpdate() { var downloadDialog = new DownloadUpdateDialog(DownloadURL); try { downloadDialog.ShowDialog(); } catch (TargetInvocationException) { } }