예제 #1
0
        public void TestAboutPanelAboveContentPanel()
        {
            SettingsForm settingsForm = new SettingsForm();
            int aboutIndex = -1, contentIndex = -1;
            for (int i = 0; i < settingsForm.Controls.Count; ++i)
            {
                if (settingsForm.Controls[i].Name == "panelAbout")
                {
                    aboutIndex = i;
                }
                else if (settingsForm.Controls[i].Name == "panelContent")
                {
                    contentIndex = i;
                }
            }

            Assert.AreNotEqual(-1, aboutIndex);
            Assert.AreNotEqual(-1, contentIndex);
            Assert.IsTrue(aboutIndex < contentIndex);
        }
예제 #2
0
        /// <summary>
        /// Handles the Click event of the buttonSettings control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void ButtonSettings_Click(object sender, EventArgs e)
        {
            SettingsForm form = new SettingsForm();
            form.Settings = new Settings(this.Settings);    // pass a copied settings object
            form.UpdateAvailable = this.UpdateAvailable;
            form.CurrentVersion = this.CurrentlyInstalledVersion;

            DialogResult result = form.ShowDialog(this);
            if (result == DialogResult.OK)
            {
                bool dayOneFolderChanged = this.Settings.DayOneFolderPath != form.Settings.DayOneFolderPath;
                bool spellCheckEnabledChanged = this.Settings.SpellCheckEnabled != form.Settings.SpellCheckEnabled;
                bool languageChanged = this.Settings.SpellCheckLanguage != form.Settings.SpellCheckLanguage;
                bool typefaceChanged = this.Settings.Typeface != form.Settings.Typeface;
                bool textSizeChanged = this.Settings.TextSize != form.Settings.TextSize;

                this.Settings = form.Settings;
                this.Settings.Save();

                if (spellCheckEnabledChanged)
                {
                    this.UpdateSpellCheckEnabled();
                }

                if (languageChanged)
                {
                    this.UpdateSpellCheckLanguage();
                }

                if (textSizeChanged)
                {
                    // Update the text editor font size.
                    this.UpdateSpellCheckedEntryTextSize();

                    // Update the web browser font size.
                    this.UpdateWebBrowser();
                }

                if (typefaceChanged)
                {
                    this.UpdateSpellCheckedEntryTypeface();
                    this.UpdateWebBrowser();
                }

                if (dayOneFolderChanged)
                {
                    this.ReloadEntries();
                }
            }
        }