当前位置: 首页>>代码示例>>C#>>正文


C# IElement.GetStateCategory方法代码示例

本文整理汇总了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;
        }
开发者ID:GorillaOne,项目名称:FlatRedBall,代码行数:19,代码来源:ExposedVariableManager.cs

示例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;

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:59,代码来源:CustomVariableExtensionMethods.cs


注:本文中的IElement.GetStateCategory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。