本文整理汇总了C#中ISettingsService.GetSetting方法的典型用法代码示例。如果您正苦于以下问题:C# ISettingsService.GetSetting方法的具体用法?C# ISettingsService.GetSetting怎么用?C# ISettingsService.GetSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISettingsService
的用法示例。
在下文中一共展示了ISettingsService.GetSetting方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildSectionsTree
private void BuildSectionsTree(ISettingsService settings)
{
Dictionary<string, SectionViewModel> sectionsTemp = new Dictionary<string, SectionViewModel>();
Dictionary<string, string> sectionParents = new Dictionary<string, string>();
foreach (IdentifierInfo identifier in _displayConfiguration.Identifiers)
{
SectionViewModel svm = null;
if (!sectionsTemp.TryGetValue(identifier.Name, out svm))
{
sectionParents[identifier.Name] = identifier.Parent;
svm = new SectionViewModel(identifier);
sectionsTemp.Add(svm.Identifier, svm);
}
foreach (SettingInfo info in identifier.Settings)
{
SettingItem setting = settings.GetSetting(info.CreateSettingKey());
svm.Add(info, setting);
}
}
_sections = new List<GroupedSectionViewModel>();
// Create hierarchy, starting with the sections that don't have parents
foreach (var kvp in sectionParents.OrderBy(k => k.Value))
{
SectionViewModel section = sectionsTemp.FirstOrDefault(s => s.Key == kvp.Key).Value;
string parentName = kvp.Value;
bool hasParent = (parentName != null);
// Create group for this item
GroupedSectionViewModel group = new GroupedSectionViewModel(section);
if (hasParent)
{
// Find parent group
// TODO: If there is no parent group, create a dummy group
GroupedSectionViewModel parentGroup = GetAllSections().FirstOrDefault(s => s.Identifier == parentName);
if (parentGroup == null)
{
// Create a dummy group
parentGroup = new GroupedSectionViewModel(null);
parentGroup.Identifier = parentName;
parentGroup.Header = parentName;
_sections.Add(parentGroup);
}
parentGroup.Children.Add(group);
}
else
{
_sections.Add(group);
}
}
// Always select the "Shared" section
_sections.First(s => s.Identifier == SectionNameShared).IsSelected = true;
ICollectionView view = CollectionViewSource.GetDefaultView(_sections);
view.SortDescriptions.Add(new SortDescription("Header", ListSortDirection.Ascending));
view.SortDescriptions.Add(new SortDescription("Order", ListSortDirection.Ascending));
}