本文整理汇总了C#中IElement.GetStateCategoryRecursively方法的典型用法代码示例。如果您正苦于以下问题:C# IElement.GetStateCategoryRecursively方法的具体用法?C# IElement.GetStateCategoryRecursively怎么用?C# IElement.GetStateCategoryRecursively使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IElement
的用法示例。
在下文中一共展示了IElement.GetStateCategoryRecursively方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsVariableState
private bool IsVariableState(string containerName, IElement element)
{
return containerName == "VariableState" ||
element.GetStateCategoryRecursively(containerName) != null;
}
示例2: FullyQualifiedDefaultStateValue
public static string FullyQualifiedDefaultStateValue(IElement referencedElement, string variableType)
{
string stateName = null;
if (variableType == "VariableState")
{
if (referencedElement.States.Count != 0)
{
stateName = referencedElement.States[0].Name;
}
else
{
foreach (StateSaveCategory category in referencedElement.StateCategoryList.Where((category) => category.SharesVariablesWithOtherCategories == true && category.States.Count != 0))
{
stateName = category.States[0].Name;
break;
}
}
}
else
{
StateSaveCategory category = referencedElement.GetStateCategoryRecursively(variableType);
if (category != null && category.States.Count != 0)
{
stateName = category.States[0].Name;
}
}
if (stateName != null)
{
return ProjectManager.ProjectNamespace + "." + referencedElement.Name.Replace("\\", ".") + "." + variableType + "." + stateName;
}
else
{
return null;
}
}
示例3: TryToGetStateCategoryFromElement
private static object TryToGetStateCategoryFromElement(string memberName, IElement element)
{
object foundObject = null;
StateSaveCategory existingCategory = element.GetStateCategoryRecursively(memberName);
bool isUncategorizedCategory = memberName == "VariableState";
if (!isUncategorizedCategory)
{
if (existingCategory != null)
{
if (existingCategory.SharesVariablesWithOtherCategories == false)
{
foundObject = existingCategory;
}
else
{
isUncategorizedCategory = true;
}
}
}
if (isUncategorizedCategory)
{
StateSaveCategory stateSaveCategory = new StateSaveCategory();
foreach (StateSave stateSave in element.States)
{
stateSaveCategory.States.Add(stateSave);
}
foundObject = stateSaveCategory;
}
return foundObject;
}