本文整理汇总了C#中Settings.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# Settings.GetString方法的具体用法?C# Settings.GetString怎么用?C# Settings.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings.GetString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowChooseDialog
public void ShowChooseDialog(bool closeOnEscape)
{
var dialog = new OpenFileDialog
{
Filter = string.Format("{0} (*.{1})|*.{1}", Res.BackupFiles, NpgExImHelper.BackupFileExt),
CheckFileExists = true,
Multiselect = false
};
var stringKeeper = new Settings("ProjectImEx");
var lastFile = stringKeeper.GetString("LastFile");
if (!string.IsNullOrEmpty(lastFile) && File.Exists(lastFile))
{
dialog.InitialDirectory = Path.GetDirectoryName(lastFile);
dialog.FileName = lastFile;
}
if (dialog.ShowDialog(View as Window) == true)
{
stringKeeper.SetString("LastFile", dialog.FileName);
stringKeeper.Save();
FileName = dialog.FileName;
if (string.IsNullOrEmpty(ConnectionParameters.Database))
{
ConnectionParameters.Database = Path.GetFileNameWithoutExtension(FileName);
}
}
else if (closeOnEscape)
{
View.DialogResult = false;
}
}
示例2: SetTheme
public void SetTheme(Settings settings)
{
var w = Stopwatch.StartNew();
if (settings.Exists("editor.ForeColor"))
{
editor1.ForeColor = editor2.ForeColor = settings.GetColor("editor.ForeColor");
SplitFCTB.ColorStyle1 = new ColorStyle(settings.GetSolidBrush("editor.ForeColor"));
}
if (settings.Exists("editor.BackColor"))
{
editor1.EditorBackColor = editor2.EditorBackColor = settings.GetColor("editor.BackColor");
}
if (settings.Exists("editor.IndentBackColor"))
{
editor1.editor1.IndentBackColor = editor1.editor2.IndentBackColor =
editor2.editor1.IndentBackColor = editor2.editor2.IndentBackColor = settings.GetColor("editor.IndentBackColor");
}
if (settings.Exists("editor.LineNumberColor"))
{
editor1.LineNumberColor = editor2.LineNumberColor = settings.GetColor("editor.LineNumberColor");
}
if (settings.Exists("editor.SelectionColor"))
{
editor1.SelectionColor = editor2.SelectionColor = settings.GetColor("editor.SelectionColor");
}
if (settings.Exists("editor.CaretColor"))
{
editor1.CaretColor = editor2.CaretColor = settings.GetColor("editor.CaretColor");
}
if (settings.Exists("editor.Font"))
{
try
{
editor1.editor1.Font = editor1.editor2.Font = editor2.editor1.Font = editor2.editor2.Font = new Font(settings.GetString("editor.Font"), editor1.editor1.Font.Size);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, "Error in \"4Hud Theme.txt\"");
}
}
if (settings.Exists("treeview.ForeColor"))
{
treeView.ForeColor = treeViewSearch.ForeColor = settings.GetColor("treeview.ForeColor");
}
if (settings.Exists("treeview.BackColor"))
{
treeView.BackColor = treeViewSearch.BackColor = settings.GetColor("treeview.BackColor");
}
if (settings.Exists("split.Bg"))
{
splitContainer.BackColor = editor1.btnClose.FlatAppearance.BorderColor = editor1.btnClose.FlatAppearance.CheckedBackColor = editor1.btnClose.BackColor = editor1.btnClose.FlatAppearance.MouseDownBackColor = editor1.btnClose.FlatAppearance.MouseOverBackColor = editor1.CloseButtonBorder =
split.BackColor = editor2.btnClose.FlatAppearance.BorderColor = editor2.btnClose.FlatAppearance.CheckedBackColor = editor2.btnClose.BackColor = editor2.btnClose.FlatAppearance.MouseDownBackColor = editor2.btnClose.FlatAppearance.MouseOverBackColor = editor2.CloseButtonBorder =
editor1.BackColor = editor2.BackColor = splitContainer.Panel1.BackColor =
settings.GetColor("split.Bg");
}
if (settings.Exists("color.ColorName"))
SplitFCTB.ColorNameStyle = new TextStyle(settings.GetSolidBrush("color.ColorName"), null, FontStyle.Regular);
if (settings.Exists("color.Comment"))
SplitFCTB.CommentStyle = new TextStyle(settings.GetSolidBrush("color.Comment"), null, FontStyle.Regular);
if (settings.Exists("color.Enabled"))
SplitFCTB.EnabledStyle = new MarkerStyle(settings.GetSolidBrush("color.Enabled"));
if (settings.Exists("color.Disabled"))
SplitFCTB.DisabledStyle = new MarkerStyle(settings.GetSolidBrush("color.Disabled"));
if (settings.Exists("color.Minmode"))
SplitFCTB.MinModeStyle = new TextStyle(settings.GetSolidBrush("color.Minmode"), null, FontStyle.Regular);
if (settings.Exists("color.Keywords"))
SplitFCTB.NameStyle = new TextStyle(settings.GetSolidBrush("color.Keywords"), null, FontStyle.Regular);
if (settings.Exists("color.Pos1"))
SplitFCTB.PosStyle1 = new TextStyle(settings.GetSolidBrush("color.Pos1"), null, FontStyle.Regular);
if (settings.Exists("color.Pos2"))
SplitFCTB.PosStyle2 = new TextStyle(settings.GetSolidBrush("color.Pos2"), null, FontStyle.Regular);
//if (settings.Exists("color.Pos2"))
// SplitFCTB.UnderlinedStyle = new TextStyle(settings.GetSolidBrush("color.Pos2"), null, FontStyle.Regular);
w.Stop();
Console.WriteLine(w.Elapsed.TotalMilliseconds);
}