public AddSetting ( string name, object val, string desc, string category, ValueChangedDelegate eh, bool reflect, object refObj ) : void | ||
name | string | property name |
val | object | start value of the property |
desc | string | property description |
category | string | property category |
eh | ValueChangedDelegate | event handler to recieve the PropertyValueChanged event |
reflect | bool | if true, an internal event handler will be created - the refObj must not be null and the name must be the name of a property of the type that refObj is |
refObj | object | the object that will recieve the changed property values |
Résultat | void |
private void loadDefaults() { RegistryKey swKey = Registry.CurrentUser.CreateSubKey("Software"); RegistryKey mvKey = swKey.CreateSubKey("MapView"); RegistryKey riKey = mvKey.CreateSubKey("MainView"); Left = (int)riKey.GetValue("Left", Left); Top = (int)riKey.GetValue("Top", Top); Width = (int)riKey.GetValue("Width", Width); Height = (int)riKey.GetValue("Height", Height); riKey.Close(); mvKey.Close(); swKey.Close(); Settings settings = new Settings(); //Color.FromArgb(175,69,100,129) ValueChangedDelegate eh = new ValueChangedDelegate(changeSetting); settings.AddSetting("Animation", MapViewPanel.Updating, "If true, the map will animate itself", "Main", eh, false, null); settings.AddSetting("Doors", false, "If true, the door tiles will animate themselves", "Main", eh, false, null); settings.AddSetting("SaveWindowPositions", PathsEditor.SaveRegistry, "If true, the window positions and sizes will be saved in the windows registry", "Main", eh, false, null); settings.AddSetting("UseGrid", MapViewPanel.Instance.View.UseGrid, "If true, a grid will show up at the current level of editing", "MapView", null, true, MapViewPanel.Instance.View); settings.AddSetting("GridColor", MapViewPanel.Instance.View.GridColor, "Color of the grid in (a,r,g,b) format", "MapView", null, true, MapViewPanel.Instance.View); settings.AddSetting("GridLineColor", MapViewPanel.Instance.View.GridLineColor, "Color of the lines that make up the grid", "MapView", null, true, MapViewPanel.Instance.View); settings.AddSetting("GridLineWidth", MapViewPanel.Instance.View.GridLineWidth, "Width of the grid lines in pixels", "MapView", null, true, MapViewPanel.Instance.View); settings.AddSetting("SelectGrayscale", MapViewPanel.Instance.View.SelectGrayscale, "If true, the selection area will show up in gray", "MapView", null, true, MapViewPanel.Instance.View); //settings.AddSetting("SaveOnExit",true,"If true, these settings will be saved on program exit","Main",null,false,null); settingsHash["MainWindow"] = settings; }
protected override void LoadDefaultSettings(Settings settings) { brushes = new Hashtable(); ValueChangedDelegate bc = new ValueChangedDelegate(brushChanged); foreach(string s in Enum.GetNames(typeof(SpecialType))) { brushes[s]=new SolidBrush(TilePanel.tileTypes[(int)Enum.Parse(typeof(SpecialType),s)]); settings.AddSetting(s,((SolidBrush)brushes[s]).Color,"Color of specified tile type","TileView",bc,false,null); } TilePanel.Colors=brushes; }
private void loadDefaults() { RegistryKey swKey = Registry.CurrentUser.CreateSubKey("Software"); RegistryKey mvKey = swKey.CreateSubKey("MapView"); RegistryKey riKey = mvKey.CreateSubKey("MainView"); Left = (int)riKey.GetValue("Left", Left); Top = (int)riKey.GetValue("Top", Top); Width = (int)riKey.GetValue("Width", Width); Height = (int)riKey.GetValue("Height", Height); riKey.Close(); mvKey.Close(); swKey.Close(); var settings = new Settings(); // Color.FromArgb(175, 69, 100, 129) var eh = new ValueChangedDelegate(ChangeSetting); settings.AddSetting( "Animation", MapViewPanel.Updating, "If true the map will animate itself", "Main", eh, false, null); settings.AddSetting( "Doors", false, "If true the door tiles will animate themselves", "Main", eh, false, null); settings.AddSetting( "SaveWindowPositions", PathsEditor.SaveRegistry, "If true the window positions and sizes will be saved in the windows registry", "Main", eh, false, null); settings.AddSetting( "UseGrid", MapViewPanel.Instance.MapView.UseGrid, "If true a grid will show up at the current level of editing", "MapView", null, true, MapViewPanel.Instance.MapView); settings.AddSetting( "GridColor", MapViewPanel.Instance.MapView.GridColor, "Color of the grid in (a,r,g,b) format", "MapView", null, true, MapViewPanel.Instance.MapView); settings.AddSetting( "GridLineColor", MapViewPanel.Instance.MapView.GridLineColor, "Color of the lines that make up the grid", "MapView", null, true, MapViewPanel.Instance.MapView); settings.AddSetting( "GridLineWidth", MapViewPanel.Instance.MapView.GridLineWidth, "Width of the grid lines in pixels", "MapView", null, true, MapViewPanel.Instance.MapView); settings.AddSetting( "SelectGrayscale", MapViewPanel.Instance.MapView.SelectGrayscale, "If true the selection area will show up in gray", "MapView", null, true, MapViewPanel.Instance.MapView); // settings.AddSetting( // "SaveOnExit", // true, // "If true these settings will be saved on program exit", // "Main", // null, false, null); SetSettings(settings); }