Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            EditorConfigurationSection section = cfg.GetEditorConfiguration();

            section.AllowCaretBeyondEOL.Value  = checkBox1.Checked;
            section.ShowEOLMarkers.Value       = checkBox2.Checked;
            section.ShowSpaces.Value           = checkBox3.Checked;
            section.ShowTabs.Value             = checkBox4.Checked;
            section.ShowVRuler.Value           = checkBox5.Checked;
            section.ShowHRuler.Value           = checkBox6.Checked;
            section.ShowInvalidLines.Value     = checkBox7.Checked;
            section.ShowLineNumbers.Value      = checkBox8.Checked;
            section.ShowMatchingBrackets.Value = checkBox9.Checked;
            section.AutoInsertBrackets.Value   = checkBox10.Checked;
            section.EnableFolding.Value        = checkBox11.Checked;
            section.ConvertTabsToSpaces.Value  = checkBox12.Checked;
            cfg.AppSettings.Settings.Add("AtomFeedLocation", this.textBoxAtomFeedFileLocation.Text);
            cfg.AppSettings.Settings.Add("SearchDirectory", this.textBoxSearchDirectory.Text);
            SaveIndexSettings();

            if (comboBox1.Text != string.Empty && comboBox2.Text != string.Empty)
            {
                try {
                    var fontSize = (float)Convert.ToDouble(comboBox2.Text, CultureInfo.InvariantCulture);
                    var f        = new Font(new FontFamily(comboBox1.Text), fontSize, FontStyle.Regular);
                    section.FontName.Value = f.Name;
                    section.FontSize.Value = fontSize;
                } catch (Exception ex) {
                    string err = ex.Message;
                }
            }
            cfg.SaveAll();
            DialogResult = DialogResult.OK;
        }
        void CopySettingsIntoControls()
        {
            EditorConfigurationSection section = cfg.GetEditorConfiguration();

            checkBox1.Checked  = section.AllowCaretBeyondEOL.Value;
            checkBox2.Checked  = section.ShowEOLMarkers.Value;
            checkBox3.Checked  = section.ShowSpaces.Value;
            checkBox4.Checked  = section.ShowTabs.Value;
            checkBox5.Checked  = section.ShowVRuler.Value;
            checkBox6.Checked  = section.ShowHRuler.Value;
            checkBox7.Checked  = section.ShowInvalidLines.Value;
            checkBox8.Checked  = section.ShowLineNumbers.Value;
            checkBox9.Checked  = section.ShowMatchingBrackets.Value;
            checkBox10.Checked = section.AutoInsertBrackets.Value;
            checkBox11.Checked = section.EnableFolding.Value;
            checkBox12.Checked = section.ConvertTabsToSpaces.Value;
            comboBox1.Text     = section.FontName.Value;
            comboBox2.Text     = section.FontSize.Value.ToString(CultureInfo.InvariantCulture);
            this.textBoxAtomFeedFileLocation.Text = cfg.AppSettings.Settings ["AtomFeedLocation"]?.Value;
            this.textBoxSearchDirectory.Text      = cfg.AppSettings.Settings ["SearchDirectory"]?.Value;
        }