本文整理汇总了C#中Section.TryGetSection方法的典型用法代码示例。如果您正苦于以下问题:C# Section.TryGetSection方法的具体用法?C# Section.TryGetSection怎么用?C# Section.TryGetSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section.TryGetSection方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFrom
public void LoadFrom(Section section)
{
Verify.Argument.IsNotNull(section, "section");
var localRepositories = section.TryGetSection("LocalRepositories");
if(localRepositories != null)
{
LoadGroupContent(_local, localRepositories);
}
var recentRepositories = section.TryGetSection("RecentRepositories");
if(recentRepositories != null)
{
_recent.Clear();
foreach(var repositorySection in recentRepositories.Sections)
{
var repository = TryLoadRepositoryFrom(repositorySection);
if(repository != null)
{
_recent.Add(repository);
}
}
}
}
示例2: LoadMoreViewFrom
protected override void LoadMoreViewFrom(Section section)
{
base.LoadMoreViewFrom(section);
var listNode = section.TryGetSection("ReferenceList");
if(listNode != null)
{
_lstReferences.LoadViewFrom(listNode);
}
}
示例3: LoadRepositoryConfig
protected override void LoadRepositoryConfig(Section section)
{
if(Guid == Guids.ContextualDiffViewGuid)
{
var node = section.TryGetSection("ContextualDiffOptions");
if(node != null)
{
_options.Context = node.GetValue<int>("Context", _options.Context);
_options.IgnoreWhitespace = node.GetValue<bool>("IgnoreWhitespace", _options.IgnoreWhitespace);
_options.UsePatienceAlgorithm = node.GetValue<bool>("UsePatienceAlgorithm", _options.UsePatienceAlgorithm);
switch(node.GetValue<string>("ViewMode", string.Empty))
{
case "Split":
ViewMode = DiffViewMode.Split;
break;
case "Single":
default:
ViewMode = DiffViewMode.Single;
break;
}
}
}
base.LoadRepositoryConfig(section);
}
示例4: LoadFrom
public static void LoadFrom(Section section)
{
Verify.Argument.IsNotNull(section, "section");
var appearanceNode = section.TryGetSection("Appearance");
if(appearanceNode != null)
{
var textRenderer = appearanceNode.TryGetParameter("TextRenderer");
if(textRenderer != null)
{
switch(textRenderer.Value as string)
{
case "GDI":
GitterApplication.TextRenderer = GitterApplication.GdiTextRenderer;
break;
case "GDI+":
GitterApplication.TextRenderer = GitterApplication.GdiPlusTextRenderer;
break;
}
}
}
var servicesNode = section.TryGetSection("Services");
if(servicesNode != null)
{
var spellingSection = servicesNode.TryGetSection("Spelling");
if(spellingSection != null)
{
SpellingService.LoadFrom(spellingSection);
}
}
var featuresSection = section.TryGetSection("IntegrationFeatures");
if(featuresSection != null)
{
GitterApplication.IntegrationFeatures.LoadFrom(featuresSection);
}
}
示例5: LoadMoreViewFrom
protected override void LoadMoreViewFrom(Section section)
{
base.LoadMoreViewFrom(section);
var layoutNode = section.TryGetSection("Layout");
if(layoutNode != null)
{
//_toolbar.ShowDiffButton.Checked = ShowDetails = layoutNode.GetValue("ShowDetails", ShowDetails);
}
var listNode = section.TryGetSection("RevisionList");
if(listNode != null)
{
RevisionListBox.LoadViewFrom(listNode);
}
}
示例6: LoadGroupContent
private static void LoadGroupContent(RepositoryGroup group, Section section)
{
Assert.IsNotNull(group);
Assert.IsNotNull(section);
group.Groups.Clear();
group.Respositories.Clear();
var groups = section.TryGetSection("Groups");
if(groups != null)
{
foreach(var subGroupSection in groups.Sections)
{
var subGroup = TryLoadGroupFrom(subGroupSection);
if(subGroup != null)
{
group.Groups.Add(subGroup);
}
}
}
var repositories = section.TryGetSection("Repositories");
if(repositories != null)
{
foreach(var repositorySection in repositories.Sections)
{
var repository = TryLoadRepositoryFrom(repositorySection);
if(repository != null)
{
group.Respositories.Add(repository);
}
}
}
}
示例7: LoadRepositoryConfig
protected override void LoadRepositoryConfig(Section section)
{
base.LoadRepositoryConfig(section);
var logOptionsNode = section.TryGetSection("LogOptions");
if(logOptionsNode != null)
{
LogOptions.LoadFrom(logOptionsNode);
}
}
示例8: LoadMoreViewFrom
protected override void LoadMoreViewFrom(Section section)
{
base.LoadMoreViewFrom(section);
var listNode = section.TryGetSection("RepositoryList");
if(listNode != null)
{
_lstLocalRepositories.LoadViewFrom(listNode);
_lstLocalRepositories.BeginUpdate();
_lstLocalRepositories.Items.Clear();
_lstLocalRepositories.LoadViewFrom(listNode);
var itemsNode = listNode.TryGetSection("Items");
if(itemsNode != null)
{
foreach(var s in itemsNode.Sections)
{
var link = new RepositoryLink(s);
var item = new RepositoryListItem(link);
_lstLocalRepositories.Items.Add(item);
}
}
_lstLocalRepositories.EndUpdate();
}
}
示例9: ViewLayout
/// <summary>
/// Initializes a new instance of the <see cref="ViewLayout"/> class.
/// </summary>
/// <param name="section">The section.</param>
public ViewLayout(Section section)
{
Verify.Argument.IsNotNull(section, "section");
_root = ToLayout(section.GetSection("Root"));
var sides = section.TryGetSection("Sides");
if(sides != null)
{
var left = sides.TryGetSection("Left");
if(left != null)
{
_left = new SideEntry(AnchorStyles.Left, left);
}
var top = sides.TryGetSection("Top");
if(top != null)
{
_top = new SideEntry(AnchorStyles.Top, top);
}
var right = sides.TryGetSection("Right");
if(right != null)
{
_right = new SideEntry(AnchorStyles.Right, right);
}
var bottom = sides.TryGetSection("Bottom");
if(bottom != null)
{
_bottom = new SideEntry(AnchorStyles.Bottom, bottom);
}
}
var floats = section.TryGetSection("Floats");
if(floats != null)
{
foreach(var f in floats.Sections)
{
_floats.Add(new FloatEntry(f));
}
}
}
示例10: LoadMoreViewFrom
protected override void LoadMoreViewFrom(Section section)
{
base.LoadMoreViewFrom(section);
var listSection = section.TryGetSection("ConfigParameterList");
if(listSection != null)
{
_lstConfig.LoadViewFrom(listSection);
}
}
示例11: LoadViewFrom
public void LoadViewFrom(Section section)
{
Verify.Argument.IsNotNull(section, "section");
BeginUpdate();
var columnsSection = section.TryGetSection("Columns");
if(columnsSection != null)
{
var dict = new Dictionary<string, CustomListBoxColumn>(_columns.Count);
foreach(var c in _columns)
{
dict.Add(c.IdentificationString, c);
}
_columns.Clear();
foreach(var child in columnsSection.Sections)
{
var name = child.Name;
CustomListBoxColumn column;
if(dict.TryGetValue(name, out column))
{
column.LoadFrom(child);
_columns.Add(column);
dict.Remove(name);
}
}
foreach(var column in dict.Values)
{
_columns.Add(column);
}
}
LoadMoreViewFrom(section);
EndUpdate();
}
示例12: LoadMoreViewFrom
protected override void LoadMoreViewFrom(Section section)
{
base.LoadMoreViewFrom(section);
_toolbar.TreeModeButton.Checked = _treeMode = section.GetValue<bool>("TreeMode", true);
var stagedListSection = section.TryGetSection("StagedList");
if(stagedListSection != null)
{
_lstStaged.LoadViewFrom(stagedListSection);
}
var unstagedListSection = section.TryGetSection("UnstagedList");
if(unstagedListSection != null)
{
_lstUnstaged.LoadViewFrom(unstagedListSection);
}
}
示例13: LoadFor
public bool LoadFor(IWorkingEnvironment environment, Section section)
{
Verify.Argument.IsNotNull(environment, "environment");
if(section != null)
{
var providerName = section.GetValue<string>("AccessorProvider", string.Empty);
if(!string.IsNullOrWhiteSpace(providerName))
{
ActiveGitAccessorProvider = GitAccessorProviders.FirstOrDefault(
prov => prov.Name == providerName);
}
if(ActiveGitAccessorProvider == null)
{
ActiveGitAccessorProvider = GitAccessorProviders.First();
}
var gitAccessorSection = section.TryGetSection(ActiveGitAccessorProvider.Name);
if(gitAccessorSection != null)
{
GitAccessor.LoadFrom(gitAccessorSection);
}
}
else
{
ActiveGitAccessorProvider = GitAccessorProviders.First();
}
Version gitVersion;
try
{
gitVersion = _gitAccessor.GitVersion;
}
catch(Exception exc)
{
if(exc.IsCritical())
{
throw;
}
gitVersion = null;
}
if(gitVersion == null || gitVersion < MinimumRequiredGitVersion)
{
using(var dlg = new VersionCheckDialog(environment, this, MinimumRequiredGitVersion, gitVersion))
{
dlg.Run(environment.MainForm);
gitVersion = dlg.InstalledVersion;
if(gitVersion == null || gitVersion < _minVersion)
{
return false;
}
}
}
GlobalOptions.RegisterPropertyPageFactory(
new PropertyPageFactory(
GitOptionsPage.Guid,
Resources.StrGit,
null,
PropertyPageFactory.RootGroupGuid,
env => new GitOptionsPage(env)));
GlobalOptions.RegisterPropertyPageFactory(
new PropertyPageFactory(
ConfigurationPage.Guid,
Resources.StrConfig,
null,
GitOptionsPage.Guid,
env => new ConfigurationPage(env)));
_environment = environment;
_configSection = section;
return true;
}