public void Initialize()
        {
            ProjectDocument doc = new ProjectDocument();
            doc.LoadXml(NUnitProjectXml.NormalProject);
            model = new ProjectModel(doc);

            view = Substitute.For<IConfigurationEditorDialog>();

            editor = new ConfigurationEditor(model, view);
        }
        void MainControl_Loaded(object sender, RoutedEventArgs e)
        {
            try {
                ConfigurableObject obj = new ConfigurableObject();
                obj.SetValues();

                savedConfig = Configurator.SaveConfiguration(obj);
                obj = new ConfigurableObject();
                Configurator.LoadConfiguration(obj, savedConfig);

                editor = Configurator.CreateEditor(typeof(ConfigurableObject));
                uiEditorContainer.Child = editor;
                editor.LoadConfiguration(savedConfig);
            } catch (Exception ex) {
                throw;
            }
        }
 private void SaveAppSetting(string key, string value)
 {
     Configuration manager = OpenConfigFile();
     if (manager != null)
     {
         // NOTE: Most likey scenario in a production environment
         if (!string.IsNullOrEmpty(manager.AppSettings.Settings[key].Value))
             manager.AppSettings.Settings.Remove(key);
         manager.AppSettings.Settings.Add(key, value);
         manager.Save(ConfigurationSaveMode.Modified);
         ConfigurationManager.RefreshSection("appSettings");
     }
     else
     {
         // NOTE: Alternate scenario when settings cannot be saved through a ConfigurationManager, particulary when running under the Visual Studio Web Development Server (as opposed to IIS or IIS Express).
         ConfigurationEditor editor = new ConfigurationEditor(Path.Combine(Server.MapPath(LocalWebConfig), "Web.config"));
         if (editor.KeyExists(key))
             editor.UpdateKey(key, value);
         else
             editor.AddKey(key, value);
         editor.SaveDoc();
     }
 }