/// <summary> /// Checks for updates /// </summary> public void CheckForUpdates() { updater.currentVersion = new Version(Application.ProductVersion); updater.updateInfoURL = new Uri(Constants.UpdateXMLUrl); updater.SaveName = Main.StartupPath + @"\Wnmp-Upgrade-Installer.exe"; updater.CheckForUpdate(); if (updater.UpdateAvailable) { UpdatePrompt updatePrompt = new UpdatePrompt(); updatePrompt.StartPosition = FormStartPosition.CenterParent; updatePrompt.currentversion.Text = updater.currentVersion.ToString(); updatePrompt.newversion.Text = updater.newVersion.ToString(); if (updatePrompt.ShowDialog() == DialogResult.Yes) { mainForm.Enabled = false; updater.Update(UpdateDownloaded, UpdateCanceled); } } else { Log.wnmp_log_notice("Your version: " + updater.currentVersion + " is up to date.", Log.LogSection.WNMP_MAIN); } }
private static Uri Wnmp_Upgrade_URL; // Wnmp upgrade installer url #endregion Fields #region Methods /// <summary> /// Checks for updates /// </summary> public static void CheckForUpdates(bool AutoUpdate) { if (!ReadUpdateXML()) return; if (WNMP_VER.CompareTo(NEW_WNMP_VERSION) < 0) { // If it returns less than 0 than theres a new version var CV = new UpdatePrompt(); CV.StartPosition = FormStartPosition.CenterScreen; CV.cversion.Text = WNMP_VER.ToString(); CV.newversion.Text = NEW_WNMP_VERSION.ToString(); if (CV.ShowDialog() == DialogResult.Yes) DownloadWnmpUpdate(Wnmp_Upgrade_URL, UpdateExe); } else { Log.wnmp_log_notice("Your version: " + WNMP_VER + " is up to date.", Log.LogSection.WNMP_MAIN); } if (AutoUpdate) { Options.settings.Lastcheckforupdate = DateTime.Now; Options.settings.UpdateSettings(); } }