private void InitPanelForControl(Control ctrl) { for (int i = 0; i < ctrl.Controls.Count; i++) { Control ctrl2 = ctrl.Controls[i]; for (int l = 0; l < ctrl2.DataBindings.Count; l++) { Binding bind = ctrl2.DataBindings[l]; String prop = bind.BindingMemberInfo.BindingMember; try { Object value = _OptionsForm.AppSettings[prop]; if (value != null) { bind.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged; bind.ControlUpdateMode = ControlUpdateMode.Never; System.Configuration.SettingsProperty sett = new System.Configuration.SettingsProperty(prop); sett.DefaultValue = value; _OptionsForm.Settings.Add(sett); } } catch { } } InitPanelForControl(ctrl2); } }
private void CreateUserSetting() { System.Configuration.SettingsProperty property = new System.Configuration.SettingsProperty(_settingsName); property.DefaultValue = ""; property.IsReadOnly = false; property.PropertyType = typeof(string); property.Attributes.Add(typeof(System.Configuration.UserScopedSettingAttribute), new System.Configuration.UserScopedSettingAttribute()); property.Provider = Properties.Settings.Default.Providers[""]; Properties.Settings.Default.Properties.Add(property); Properties.Settings.Default.Reload(); }
public Main() { InitializeComponent(); lblStockStatus.Text = "Stock satus: OK!"; lblStockStatus.ForeColor = Color.Green; // Add extra settings when application starts up. System.Configuration.SettingsProperty lmf = new System.Configuration.SettingsProperty("lastModFiles"); if (lmf.DefaultValue == null) { lmf.DefaultValue = "Park_P"; lmf.IsReadOnly = false; lmf.PropertyType = typeof(string); lmf.Attributes.Add(typeof(System.Configuration.UserScopedSettingAttribute), new System.Configuration.UserScopedSettingAttribute()); //Properties.Settings.Default.Properties.Add(lmf); } System.Configuration.SettingsProperty dtu = new System.Configuration.SettingsProperty("defaultToLastUsed"); if (dtu.DefaultValue == null) { dtu.DefaultValue = "Null_Just_Do_Not_Name_Your_Mod_Directory_Like_This"; dtu.IsReadOnly = false; dtu.PropertyType = typeof(string); dtu.Attributes.Add(typeof(System.Configuration.UserScopedSettingAttribute), new System.Configuration.UserScopedSettingAttribute()); //Properties.Settings.Default.Properties.Add(dtu); } // Load settings now. //Properties.Settings.Default.Reload(); Properties.Settings.Default.Save(); //Create 'Mods' and 'Stock' directory, if non-existant DirectoryInfo modsDirectoryInfo = new DirectoryInfo(rootDirectory + modsDirectory); if (modsDirectoryInfo.Exists == false) { Directory.CreateDirectory(rootDirectory + modsDirectory); Directory.CreateDirectory(rootDirectory + modsDirectory + "\\Stock"); MessageBox.Show("Welcome to the Rocket League Mod Manager, to get started, place mods in the 'Mods' directory I've just created for you.\n\nAlso make sure to make a copy of your (unmodified) 'Park_P.upk' file to the 'Mods/Stock' directory."); } DirectoryInfo rlDirectoryInfo = new DirectoryInfo(rootDirectory + coockedPCConsoleDirectory); if (rlDirectoryInfo.Exists == false) { Directory.CreateDirectory(rootDirectory + coockedPCConsoleDirectory); MessageBox.Show("Make sure you have extracted the application in your Rocket League root directory."); } }
private void savePropertiesTest(string propertyName, string value) { System.Configuration.SettingsProperty property = new System.Configuration.SettingsProperty(propertyName); property.DefaultValue = value; property.IsReadOnly = false; property.PropertyType = typeof(string); property.Provider = Properties.Settings.Default.Providers["LocalFileSettingsProvider"]; property.Attributes.Add(typeof(System.Configuration.UserScopedSettingAttribute), new System.Configuration.UserScopedSettingAttribute()); try { Properties.Settings.Default.Properties.Add(property); } catch { Properties.Settings.Default.Properties.Remove(property.Name); Properties.Settings.Default.Properties.Add(property); } }
public MainWindow() { InitializeComponent(); if (!Directory.Exists(AppDirectory)) { Directory.CreateDirectory(AppDirectory); } System.Configuration.SettingsProperty property = new System.Configuration.SettingsProperty("AppDirectory"); property.DefaultValue = "Default"; property.IsReadOnly = false; property.PropertyType = typeof(string); property.Provider = Properties.Settings.Default.Providers["LocalFileSettingsProvider"]; property.Attributes.Add(typeof(System.Configuration.UserScopedSettingAttribute), new System.Configuration.UserScopedSettingAttribute()); Properties.Settings.Default.Save(); Properties.Settings.Default.Properties.Add(property); Properties.Settings.Default["AppDirectory"] = AppDirectory; Properties.Settings.Default.Save(); }
public void SetSoftwareSetting(string KeyName, string NewValue) { try { Properties.Settings.Default.Properties[KeyName].DefaultValue = NewValue; } catch (NullReferenceException) { //Copy the Mode setting to a new setting System.Configuration.SettingsProperty newProp = new System.Configuration.SettingsProperty(Properties.Settings.Default.Properties["Mode"]); newProp.Name = KeyName; newProp.DefaultValue = NewValue; Properties.Settings.Default.Properties.Add(newProp); Properties.Settings.Default.Save(); } catch (System.Exception) { throw; } }
public void SaveSettings() { Properties.Settings.Default.EmulatorExecutable = emulatorExecutable; Properties.Settings.Default.DirectoryListingsFolder = dirListingsFolder; Properties.Settings.Default.CheckForUpdatesOnStartup = checkForUpdatesOnStartup; Properties.Settings.Default.TapeFolders = tapeFolders; Properties.Settings.Default.DiskFolders = diskFolders; Properties.Settings.Default.RomFolders = romFolders; Properties.Settings.Default.PageBackground = pageBackground; foreach (SyntaxHighlightingItems item in Enum.GetValues(typeof(SyntaxHighlightingItems))) { TextStyle textStyle = colours[item]; SolidBrush tmp = (SolidBrush)textStyle.ForeBrush; String fontStyle = textStyle.FontStyle.ToString(); try { Properties.Settings.Default["Basic" + item.ToString() + "Color"] = tmp.Color; Properties.Settings.Default["Basic" + item.ToString() + "Style"] = textStyle.FontStyle.ToString(); } catch (System.Configuration.SettingsPropertyNotFoundException) { System.Configuration.SettingsProperty property = new System.Configuration.SettingsProperty("Basic" + item.ToString() + "Color"); property.PropertyType = typeof(string); property.DefaultValue = "TEST"; Properties.Settings.Default.Properties.Add(property); } } Properties.Settings.Default.Save(); }
public System.Configuration.SettingsPropertyValue GetPreviousVersion(System.Configuration.SettingsContext context, System.Configuration.SettingsProperty property) { throw new NotImplementedException(); }
private void SetSetting(System.Configuration.SettingsProperty setting, string val) { }
public SettingsProperty(System.Configuration.SettingsProperty propertyToCopy) { Contract.Requires(propertyToCopy != null); }
public void SetPropertyValuesAnonnymous() { System.Configuration.SettingsContext sc = new System.Configuration.SettingsContext(); sc.Add("UserName", new Guid().ToString()); sc.Add("IsAuthenticated", false); System.Configuration.SettingsPropertyValueCollection properties = new System.Configuration.SettingsPropertyValueCollection(); var nSettingsProp = new System.Configuration.SettingsProperty("Test") { DefaultValue = "", PropertyType = typeof(string) }; nSettingsProp.Attributes.Add("AllowAnonymous", true); var propVal = new System.Configuration.SettingsPropertyValue( nSettingsProp ); propVal.PropertyValue = "test string"; properties.Add(propVal); ProfileManager.Provider.SetPropertyValues(sc, properties); }