Exemple #1
0
        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);
            }
        }
Exemple #2
0
        private void StoreSettingsInAppStrings()
        {
            _pas.SetString("ShowInBigBox", chkBigBox.Checked.ToString());
            _pas.SetString("ShowInLaunchBox", chkLaunchBox.Checked.ToString());

            _pas.SetString("QOTD_Type", cmbQOTD_Type.SelectedItem.ToString());
            _pas.SetString("LocalFileLocation", txtLocalFileLocation.Text);

            _pas.SetString("FontStyle", new FontConverter().ConvertToInvariantString(fontDialog1.Font));
            _pas.SetString("FontColor", new ColorConverter().ConvertToInvariantString(fontDialog1.Color));
            _pas.SetString("BackgroundColor", new ColorConverter().ConvertToInvariantString(colorDialog1.Color));

            _pas.SetString("SecondsToDisplayQuotePerWord", nudSecondsToDisplayQuotePerWord.Text);
            _pas.SetString("BackgroundOpacityPercentage", nudBackgroundOpacityPercentage.Text);
            _pas.SetString("TransparancyAlphaValue", nudTransparancyAlphaValue.Text);
            _pas.SetString("MaxNumberOfLines", nudMaxNumberOfLines.Text);

            _pas.SetString("AutomaticUpdates", cmbAutomaticUpdates.SelectedItem.ToString() == "On" ? "True" : "False");
        }