Exemplo n.º 1
0
        private void saveSettings()
        {
            HighlightWordProperties propHighlightWord = (HighlightWordProperties)this.propHighlightWord.SelectedObject;
            HighlightLineProperties propHighlightLine = (HighlightLineProperties)this.propHighlightLine.SelectedObject;

            singletonSettings = EditorSettings.getInstance();

            // General
            singletonSettings.GeneralSettings.EnableBM = EnableBM.Checked;
            singletonSettings.GeneralSettings.EnableCL = EnableCL.Checked;
            singletonSettings.GeneralSettings.EnableWH = EnableWH.Checked;
            singletonSettings.GeneralSettings.EnableOL = EnableOL.Checked;

            // Highliht selected word
            singletonSettings.HighlightWord.BackColor    = propHighlightWord.BackColor;
            singletonSettings.HighlightWord.FrameColor   = propHighlightWord.FrameColor;
            singletonSettings.HighlightWord.SelectedWord = SelectedCB.Checked;

            // Highlight current line
            singletonSettings.HighlightCurrentLine.BackColor   = propHighlightLine.BackColor;
            singletonSettings.HighlightCurrentLine.FrameColor  = propHighlightLine.FrameColor;
            singletonSettings.HighlightCurrentLine.BackOpacity = propHighlightLine.BackOpacity;

            // Outlining
            singletonSettings.Outlining.MaxRowsInTooltip = Convert.ToInt32(nRows.Value);

            singletonSettings.saveChanges();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Load settings from disk
        /// </summary>
        private void loadFromFile()
        {
            try
            {
                string settingsFilePath = Path.Combine(FILE_PATH, FILE_NAME);

                if (File.Exists(settingsFilePath))
                {
                    using (FileStream fs = new FileStream(settingsFilePath, FileMode.Open, FileAccess.Read))
                    {
                        if (fs != null)
                        {
                            SoapFormatter formatter = new SoapFormatter();
                            settings = formatter.Deserialize(fs) as EditorSettings;
                            fs.Close();
                        }
                    }
                }
                else
                {
                    settings = new EditorSettings();
                    settings.saveChanges();
                }
            }
            catch
            {
                settings = new EditorSettings();
            }
        }