本文整理汇总了C#中IElement.GetStateCategory方法的典型用法代码示例。如果您正苦于以下问题:C# IElement.GetStateCategory方法的具体用法?C# IElement.GetStateCategory怎么用?C# IElement.GetStateCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IElement
的用法示例。
在下文中一共展示了IElement.GetStateCategory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryGetStateInCategory
private static bool TryGetStateInCategory(string memberName, IElement entitySave, out string foundType)
{
foundType = "";
if (entitySave.StateCategoryList.Count != 0 && memberName.StartsWith("Current") && memberName.EndsWith("State"))
{
string possibleCategory = StateSaveExtensionMethods.GetStateTypeFromCurrentVariableName(memberName);
// See if there is a matching category
StateSaveCategory category = entitySave.GetStateCategory(possibleCategory);
if (category != null)
{
foundType = category.Name;
return true;
}
}
return false;
}
示例2: GetIsVariableState
public static bool GetIsVariableState(this CustomVariable customVariable, IElement containingElement = null)
{
bool returnValue = false;
if (customVariable != null && customVariable.DefinedByBase)
{
// If this is DefinedByBase, it may represent a variable that is tunneling, but it
// doesn't know it - we have to get the variable from the base to know for sure.
if (containingElement == null)
{
containingElement = ObjectFinder.Self.GetElementContaining(customVariable);
}
if (containingElement != null && !string.IsNullOrEmpty(containingElement.BaseElement))
{
IElement baseElement = ObjectFinder.Self.GetIElement( containingElement.BaseElement);
if (baseElement != null)
{
CustomVariable customVariableInBase = baseElement.GetCustomVariableRecursively(customVariable.Name);
if (customVariableInBase != null)
{
returnValue = customVariableInBase.GetIsVariableState();
}
}
}
}
else
{
bool isTunneled = !string.IsNullOrEmpty(customVariable.SourceObject) &&
!string.IsNullOrEmpty(customVariable.SourceObjectProperty);
bool isOnThis = string.IsNullOrEmpty(customVariable.SourceObject) &&
string.IsNullOrEmpty(customVariable.SourceObjectProperty);
if (isTunneled)
{
string property = customVariable.SourceObjectProperty;
return !string.IsNullOrEmpty(property) && property.StartsWith("Current") &&
property.EndsWith("State");
}
else
{
if (containingElement == null)
{
containingElement = ObjectFinder.Self.GetElementContaining(customVariable);
}
if (containingElement != null)
{
returnValue = customVariable.Type == "VariableState" ||
containingElement.GetStateCategory(customVariable.Type) != null;
}
}
}
return returnValue;
}