Example #1
0
 public static void LoadSettings()
 {
     string path = GetSettingsPath(false/*create*/);
     if (File.Exists(path))
     {
         try
         {
             Config = new EditorConfigList(path);
         }
         catch (Exception exception)
         {
             //Debug.Assert(false);
             MessageBox.Show(String.Format("Exception reading settings file: {0}", exception));
         }
     }
 }
        public Settings(EditorConfigList configArg)
        {
            this.config = new EditorConfigList(configArg);

            InitializeComponent();
            this.Icon = TextEditorApp.Properties.Resources.Icon2;

            switch (config.BackingStore)
            {
                default:
                    Debug.Assert(false);
                    throw new ArgumentException();
                case BackingStore.String:
                    comboBoxBackingStore.SelectedItem = "String";
                    break;
                case BackingStore.Utf8SplayGapBuffer:
                    comboBoxBackingStore.SelectedItem = "Utf8SplayGapBuffer";
                    break;
            }

            switch (config.TextService)
            {
                default:
                    Debug.Assert(false);
                    throw new ArgumentException();
                case TextService.Simple:
                    comboBoxTextService.SelectedItem = "Simple";
                    break;
                case TextService.Uniscribe:
                    comboBoxTextService.SelectedItem = "Uniscribe";
                    break;
                case TextService.DirectWrite:
                    comboBoxTextService.SelectedItem = "DirectWrite";
                    break;
            }

            ((SettingsPanel)((TabPage)tabControlSettings.Controls[0]).Controls[0]).All = this.config[0];
            for (int i = 1; i < this.config.Count; i++)
            {
                AddPage(this.config[i]);
            }
        }