Пример #1
0
        private void AddStateName(DocumentNode stateNode, string stateName)
        {
            DocumentNode parentNode = StateNameBuilder.GetParentNode(stateNode);

            if (parentNode == null)
            {
                return;
            }
            IType         nodeType = StateNameBuilder.GetNodeType(parentNode);
            List <string> list;

            if (nodeType.XamlSourcePath != null)
            {
                if (!this.stateNamesByType.TryGetValue(nodeType, out list))
                {
                    list = new List <string>();
                    this.stateNamesByType[nodeType] = list;
                }
            }
            else if (!this.stateNamesByNode.TryGetValue(parentNode, out list))
            {
                list = new List <string>();
                this.stateNamesByNode[parentNode] = list;
            }
            list.Add(stateName);
        }
Пример #2
0
        public IEnumerable <string> GetStateNamesForNode(DocumentNode node)
        {
            IType         nodeType = StateNameBuilder.GetNodeType(node);
            List <string> list;

            if (!this.stateNamesByNode.TryGetValue(node, out list) && !this.stateNamesByType.TryGetValue(nodeType, out list))
            {
                list = new List <string>();
            }
            return((IEnumerable <string>)list);
        }
Пример #3
0
        public override bool Verify(DocumentNode node)
        {
            DocumentCompositeNode compositeNode = node as DocumentCompositeNode;

            if (this.builder == null)
            {
                this.builder = new StateNameBuilder(this.designerContext);
                this.builder.Begin();
            }
            if (compositeNode != null)
            {
                string        referentialPropertyValue = this.GetReferentialPropertyValue(compositeNode);
                DocumentNode  targetElement            = GoToStateActionNode.FindTargetElement(node, true);
                List <string> results;
                if (targetElement != null && (DocumentNodeUtilities.IsBinding(targetElement) && !GoToStateActionNode.CanResolveTargetFromBinding(targetElement) || Enumerable.Contains <string>(this.builder.GetStateNamesForNode(targetElement), referentialPropertyValue) || PlatformNeutralAttributeHelper.TryGetAttributeValues <string>((IEnumerable)TypeUtilities.GetAttributes(targetElement.TargetType), ProjectNeutralTypes.TemplateVisualStateAttribute, "Name", out results) && results.Contains(referentialPropertyValue)))
                {
                    return(true);
                }
            }
            return(false);
        }