本文整理汇总了C#中ISettingsService.Get方法的典型用法代码示例。如果您正苦于以下问题:C# ISettingsService.Get方法的具体用法?C# ISettingsService.Get怎么用?C# ISettingsService.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISettingsService
的用法示例。
在下文中一共展示了ISettingsService.Get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainVM
public MainVM(IApplicationManager appManager, ISettingsService settingsSvc)
{
_appManager = appManager;
_settingsService = settingsSvc;
int portNum = 1;
if (Int32.TryParse(settingsSvc.Get("LastExternalPort"), out portNum))
_selectedExternalPort = portNum;
else
_selectedExternalPort = 1;
string lastSite = settingsSvc.Get("LastSiteName");
if (!String.IsNullOrEmpty(lastSite) && AvailableSites.Contains(lastSite))
_selectedSite = lastSite;
else
_selectedSite = AvailableSites.Count > 0 ? AvailableSites[0] : null;
string lastPool = settingsSvc.Get("LastPoolName");
if (!String.IsNullOrEmpty(lastPool) && AvailableSites.Contains(lastPool))
_selectedPool = lastPool;
else
_selectedPool = AvailablePools.Count > 0 ? AvailablePools[0] : null;
bool autoBrowse = true;
if (Boolean.TryParse(_settingsService.Get("LastAutoBrowse"), out autoBrowse))
_autoBrowse = autoBrowse;
else
_autoBrowse = true;
AppConfigPath = _settingsService.Get("ConfigPath");
}
示例2: SettingsViewModel
public SettingsViewModel(ISettingsService settingsService, IWindowManager windowManager, Func<BlogSettingsViewModel> blogSettingsCreator)
{
this.settingsService = settingsService;
this.windowManager = windowManager;
this.blogSettingsCreator = blogSettingsCreator;
using (RegistryKey key = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Classes"))
{
FileMDBinding = key.GetSubKeyNames().Contains(Constants.DefaultExtensions[0]) &&
!string.IsNullOrEmpty(key.OpenSubKey(Constants.DefaultExtensions[0]).GetValue("").ToString());
FileMarkdownBinding = key.GetSubKeyNames().Contains(Constants.DefaultExtensions[1]) &&
!string.IsNullOrEmpty(key.OpenSubKey(Constants.DefaultExtensions[1]).GetValue("").ToString());
FileMDownBinding = key.GetSubKeyNames().Contains(Constants.DefaultExtensions[2]) &&
!string.IsNullOrEmpty(key.OpenSubKey(Constants.DefaultExtensions[2]).GetValue("").ToString());
FileMKDBinding = key.GetSubKeyNames().Contains(Constants.DefaultExtensions[3]) &&
!string.IsNullOrEmpty(key.OpenSubKey(Constants.DefaultExtensions[3]).GetValue("").ToString());
}
var blogs = settingsService.Get<List<BlogSetting>>("Blogs") ?? new List<BlogSetting>();
Blogs = new ObservableCollection<BlogSetting>(blogs);
}
示例3: MainWindow
public MainWindow()
{
_settingsService = new SettingsService();
InitializeComponent();
var settings = _settingsService.Get();
lblDirectory.Content = settings.LastUsedDirectory;
}
示例4: SettingsViewModel
public SettingsViewModel(ISettingsService settingsService, IWindowManager windowManager, Func<BlogSettingsViewModel> blogSettingsCreator)
{
this.settingsService = settingsService;
this.windowManager = windowManager;
this.blogSettingsCreator = blogSettingsCreator;
using (RegistryKey key = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Classes"))
{
this.Extensions = Constants.DefaultExtensions
.Select(s => new ExtensionViewModel(s,
key.GetSubKeyNames().Contains(s) && !string.IsNullOrEmpty(key.OpenSubKey(s).GetValue("").ToString())))
.ToArray();
}
var blogs = settingsService.Get<List<BlogSetting>>(BlogsSettingsKey) ?? new List<BlogSetting>();
Blogs = new ObservableCollection<BlogSetting>(blogs);
Languages = Enum.GetValues(typeof(SpellingLanguages)).OfType<SpellingLanguages>().ToArray();
SelectedLanguage = settingsService.Get<SpellingLanguages>(DictionariesSettingsKey);
}
示例5: dlg_Load
void dlg_Load(object sender, EventArgs e)
{
this.settingsSvc = dlg.Services.RequireService<ISettingsService>();
dlg.Patterns.DataSource = settingsSvc.GetList("SearchDialog/Patterns");
if (dlg.InitialPattern != null)
dlg.Patterns.Text = dlg.InitialPattern;
dlg.RegexCheckbox.Checked = (int)(settingsSvc.Get("SearchDialog/Regexp", 0) ?? 0)!= 0;
dlg.Encodings.SelectedIndex = (int)(settingsSvc.Get("SearchDialog/Encoding", 0) ?? 0);
dlg.Scopes.SelectedIndex = (int)(settingsSvc.Get("SearchDialog/Scope", 0) ?? 0);
dlg.ScannedMemory.Checked = (int)(settingsSvc.Get("SearchDialog/Scanned", 1) ?? 1) != 0;
dlg.UnscannedMemory.Checked = (int)(settingsSvc.Get("SearchDialog/Unscanned", 1) ?? 1) != 0;
EnableControls();
}