本文整理汇总了C#中Settings.AddSetting方法的典型用法代码示例。如果您正苦于以下问题:C# Settings.AddSetting方法的具体用法?C# Settings.AddSetting怎么用?C# Settings.AddSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings.AddSetting方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadDefaultPreferences
public override Boolean LoadDefaultPreferences()
{
try
{
foreach (String category in categories)
File.Create(GetCategoryFileFromName(category)).Dispose();
}
catch (Exception exception)
{
System.Windows.MessageBox.Show(exception.Message);
return false;
}
Settings generalSettings = new Settings("General");
generalSettings.AddSetting(new StringSetting("Project Name", Parent));
Settings engineSettings = new Settings("Engine 3D");
engineSettings.AddSetting(new DoubleSetting("Node Difference Acceptance Percentage", 5.0));
settings = new Collection<Settings>();
settings.Add(generalSettings);
settings.Add(engineSettings);
return true;
}
示例2: LoadDefaultPreferences
public override Boolean LoadDefaultPreferences()
{
try
{
foreach (String category in categories)
File.Create(GetCategoryFileFromName(category)).Dispose();
}
catch (Exception exception)
{
System.Windows.MessageBox.Show(exception.Message);
return false;
}
Settings softwareSettings = new Settings("Software");
softwareSettings.AddSetting(new StringSetting("Workspace path", System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "McKineap")));
settings = new Collection<Settings>();
settings.Add(softwareSettings);
return true;
}
示例3: LoadDefaultSettings
protected override void LoadDefaultSettings(Settings settings)
{
//RegistryKey swKey = Registry.CurrentUser.CreateSubKey("Software");
//RegistryKey mvKey = swKey.CreateSubKey("MapView");
//RegistryKey riKey = mvKey.CreateSubKey("TopView");
//foreach (MenuItem mi in visibleHash.Keys)
// mi.Checked = bool.Parse((string)riKey.GetValue("vis" + visibleHash[mi].ToString(), "true"));
//riKey.Close();
//mvKey.Close();
//swKey.Close();
brushes = new Dictionary<string, SolidBrush>();
pens = new Dictionary<string, Pen>();
brushes.Add("GroundColor", new SolidBrush(Color.Orange));
brushes.Add("ContentColor", new SolidBrush(Color.Green));
brushes.Add("SelectTileColor", bottom.SelectColor);
Pen northPen = new Pen(new SolidBrush(Color.Red), 4);
pens.Add("NorthColor", northPen);
pens.Add("NorthWidth", northPen);
Pen westPen = new Pen(new SolidBrush(Color.Red), 4);
pens.Add("WestColor", westPen);
pens.Add("WestWidth", westPen);
Pen selPen = new Pen(new SolidBrush(Color.Black), 2);
pens.Add("SelectColor", selPen);
pens.Add("SelectWidth", selPen);
Pen gridPen = new Pen(new SolidBrush(Color.Black), 1);
pens.Add("GridColor", gridPen);
pens.Add("GridWidth", gridPen);
Pen mousePen = new Pen(new SolidBrush(Color.Blue), 2);
pens.Add("MouseColor", mousePen);
pens.Add("MouseWidth", mousePen);
ValueChangedDelegate bc = new ValueChangedDelegate(brushChanged);
ValueChangedDelegate pc = new ValueChangedDelegate(penColorChanged);
ValueChangedDelegate pw = new ValueChangedDelegate(penWidthChanged);
ValueChangedDelegate dh = new ValueChangedDelegate(diamondHeight);
settings.AddSetting("GroundColor", Color.Orange, "Color of the ground tile indicator", "Tile", bc, false, null);
settings.AddSetting("NorthColor", Color.Red, "Color of the north tile indicator", "Tile", pc, false, null);
settings.AddSetting("WestColor", Color.Red, "Color of the west tile indicator", "Tile", pc, false, null);
settings.AddSetting("ContentColor", Color.Green, "Color of the content tile indicator", "Tile", bc, false, null);
settings.AddSetting("NorthWidth", 4, "Width of the north tile indicator in pixels", "Tile", pw, false, null);
settings.AddSetting("WestWidth", 4, "Width of the west tile indicator in pixels", "Tile", pw, false, null);
settings.AddSetting("SelectColor", Color.Black, "Color of the selection line", "Select", pc, false, null);
settings.AddSetting("SelectWidth", 2, "Width of the selection line in pixels", "Select", pw, false, null);
settings.AddSetting("GridColor", Color.Black, "Color of the grid lines", "Grid", pc, false, null);
settings.AddSetting("GridWidth", 1, "Width of the grid lines", "Grid", pw, false, null);
settings.AddSetting("MouseWidth", 2, "Width of the mouse-over indicatior", "Grid", pw, false, null);
settings.AddSetting("MouseColor", Color.Blue, "Color of the mouse-over indicator", "Grid", pc, false, null);
settings.AddSetting("SelectTileColor", Color.Lavender, "Background color of the selected tile piece", "Other", bc, false, null);
settings.AddSetting("DiamondMinHeight", topViewPanel.MinHeight, "Minimum height of the grid tiles", "Tile", dh, false, null);
topViewPanel.Brushes = brushes;
topViewPanel.Pens = pens;
bottom.Brushes = brushes;
bottom.Pens = pens;
}
示例4: LoadDefaultSettings
//private void loadDefaults()
protected override void LoadDefaultSettings(Settings settings)
{
Dictionary<string, SolidBrush> brushes = rmpPanel.Brushes;
Dictionary<string, Pen> pens = rmpPanel.Pens;
ValueChangedDelegate bc = new ValueChangedDelegate(brushChanged);
ValueChangedDelegate pc = new ValueChangedDelegate(penColorChanged);
ValueChangedDelegate pw = new ValueChangedDelegate(penWidthChanged);
Pen redPen = new Pen(new SolidBrush(Color.Red), 2);
pens["UnselectedLinkColor"] = redPen;
pens["UnselectedLinkWidth"] = redPen;
settings.AddSetting("UnselectedLinkColor", redPen.Color, "Color of unselected link lines", "Links", pc,
false, null);
settings.AddSetting("UnselectedLinkWidth", 2, "Width of unselected link lines", "Links", pw, false, null);
Pen bluePen = new Pen(new SolidBrush(Color.Blue), 2);
pens["SelectedLinkColor"] = bluePen;
pens["SelectedLinkWidth"] = bluePen;
settings.AddSetting("SelectedLinkColor", bluePen.Color, "Color of selected link lines", "Links", pc, false,
null);
settings.AddSetting("SelectedLinkWidth", 2, "Width of selected link lines", "Links", pw, false, null);
Pen wallPen = new Pen(new SolidBrush(Color.Black), 4);
pens["WallColor"] = wallPen;
pens["WallWidth"] = wallPen;
settings.AddSetting("WallColor", wallPen.Color, "Color of wall indicators", "View", pc, false, null);
settings.AddSetting("WallWidth", 4, "Width of wall indicators", "View", pw, false, null);
Pen gridPen = new Pen(new SolidBrush(Color.Black), 1);
pens["GridLineColor"] = gridPen;
pens["GridLineWidth"] = gridPen;
settings.AddSetting("GridLineColor", gridPen.Color, "Color of grid lines", "View", pc, false, null);
settings.AddSetting("GridLineWidth", 1, "Width of grid lines", "View", pw, false, null);
SolidBrush selBrush = new SolidBrush(Color.Blue);
brushes["SelectedNodeColor"] = selBrush;
settings.AddSetting("SelectedNodeColor", selBrush.Color, "Color of selected nodes", "Nodes", bc, false, null);
SolidBrush spawnBrush = new SolidBrush(Color.GreenYellow);
brushes["SpawnNodeColor"] = spawnBrush;
settings.AddSetting("SpawnNodeColor", spawnBrush.Color, "Color of spawn nodes", "Nodes", bc, false, null);
SolidBrush nodeBrush = new SolidBrush(Color.Green);
brushes["UnselectedNodeColor"] = nodeBrush;
settings.AddSetting("UnselectedNodeColor", nodeBrush.Color, "Color of unselected nodes", "Nodes", bc, false,
null);
SolidBrush contentBrush = new SolidBrush(Color.DarkGray);
brushes["ContentTiles"] = contentBrush;
settings.AddSetting("ContentTiles", contentBrush.Color, "Color of map tiles with a content tile", "Other",
bc, false, null);
}