private void btnSave_Click(object sender, EventArgs e) { StoreSettingsInAppStrings(); _pas.Save(); btnSave.Enabled = false; btnCheckForUpdates.Enabled = true; }
private void BeginCheck() { string sMyVersionDate = _pas.GetString("VersionDate"); string sCurrentVersionDate = GetCurrentVersionDate(); if (!string.IsNullOrWhiteSpace(sCurrentVersionDate) && sMyVersionDate != sCurrentVersionDate) { if (_pas.GetBoolean("AutomaticUpdates") || MessageBox.Show("A newer version of Quote of the Day is available. Would you like to update?", "Update Available", MessageBoxButtons.YesNo) == DialogResult.Yes) { string sSaveLocation = this.GetType().Assembly.Location; if (GetCurrentVersion(sSaveLocation + ".newversion")) { try { File.Delete(sSaveLocation + ".previousversion"); File.Move(sSaveLocation, sSaveLocation + ".previousversion"); File.Move(sSaveLocation + ".newversion", sSaveLocation); if (!_pas.GetBoolean("AutomaticUpdates")) { MessageBox.Show( "Quote of the Day has been updated. Update will be applied on next restart of LaunchBox/BigBox", "Update Successful", MessageBoxButtons.OK); } _pas.SetString("VersionDate", sCurrentVersionDate); _pas.Save(); } catch (Exception exception) { if (!_pas.GetBoolean("AutomaticUpdates")) { MessageBox.Show( "Quote of the Day could not be updated. Exception: " + exception.Message, "Update Unsuccessful", MessageBoxButtons.OK); } } } } } else if (!_pas.GetBoolean("AutomaticUpdates") && string.IsNullOrWhiteSpace(sCurrentVersionDate)) { MessageBox.Show( "A version number could not be found. This may indicate a network issue or a configuration issue. Check VersionUrl in QuoteOfTheDay.dll.config.", "Version not fond", MessageBoxButtons.OK); } else if (!_pas.GetBoolean("AutomaticUpdates")) { MessageBox.Show("You are up to date.", "No Update Available", MessageBoxButtons.OK); } }