/// <summary> /// If we get a good version back, show the user their options<br/> /// 1) There's a new version<br/> /// 2) They're up to date<br/> /// 3) Communication or file error<br/> /// 4) Nothing if we're the version is ignored or if they are up to date and in startup /// </summary> private void CheckForUpdate() { Log("Check for update start"); _newVersion = GetAvailableVersion(); var thisVersion = Utils.GetVersion(GetType()); Log("This version " + thisVersion); if (_newVersion != ErrorIndicatorVersion) { _preferences.SetString(LastChecked, DateTime.Parse(DateTime.Now.ToString("s"), CultureInfo.InvariantCulture).ToString("s")); _preferences.SaveSettings(); if (_newVersion == _preferences.GetString(SkippedVersion)) { Log("Version skipped: " + _newVersion); DialogResult = DialogResult.No; return; } if (new Version(_newVersion) > new Version(thisVersion)) { Log(string.Format("current: {1}, new: {0}", _newVersion, thisVersion)); SetupDialogShowHide(true); pbDownload.Visible = false; Text = "New update available"; lblPrompt.Text = string.Format( "Version {0} of {1} is available would you like to download and install this version?\n\nYou are running version {2}", _newVersion, Vendor.ProductName, thisVersion); } else if (!_isInStartup) { Log("Up to date NOT in startup"); SetupDialogForOkay(); Text = "You're up to date"; lblPrompt.Text = string.Format("You have version {0}, which is the latest version of {1} ", thisVersion, Vendor.ProductName); } else { Log("Up to date in startup"); DialogResult = DialogResult.No; } } else { Log("Communication/firewall error"); SetupDialogForOkay(); Text = "OOPS!"; lblPrompt.Text = string.Format("Could not reach the {0} web site, check your internet connection or firewall.", Vendor.ProductName); } }
private void WriteGeneralNodes() { _preferences.SetString("MouseWheelVerticalDelta", textBoxMouseWheelVertical.Text); _preferences.SetString("MouseWheelHorizontalDelta", textBoxMouseWheelHorizontal.Text); _preferences.SetString("ShutdownTime", !dateTimePickerAutoShutdownTime.Checked ? string.Empty : dateTimePickerAutoShutdownTime.Value.ToString("h:mm tt")); _preferences.SetString("AutoUpdateCheckFreq", cbUpdateFrequency.SelectedItem.ToString()); _preferences.SetInteger("HistoryImages", (int)numericUpDownHistoryImages.Value); _preferences.SetInteger("RecentFiles", (int)nudRecentFiles.Value); _preferences.SetBoolean("AutoSaveToolbars", cbToolbarAutoSave.Checked); }