Example #1
0
 public ViewNode(Microsoft.Expression.DesignModel.InstanceBuilders.ViewNodeManager manager, Microsoft.Expression.DesignModel.DocumentModel.DocumentNode documentNode, Microsoft.Expression.DesignModel.InstanceBuilders.InstanceState instanceState, object instance)
 {
     this.documentNode  = documentNode;
     this.instanceState = instanceState;
     this.instance      = instance;
     this.manager       = manager;
 }
Example #2
0
        public void MergeState(Microsoft.Expression.DesignModel.InstanceBuilders.InstanceState newState)
        {
            switch (newState.StateType)
            {
            case InstanceStateType.Invalid:
            {
                this.instanceState = Microsoft.Expression.DesignModel.InstanceBuilders.InstanceState.Invalid;
                return;
            }

            case InstanceStateType.Uninitialized:
            {
                return;
            }

            case InstanceStateType.PropertyOrChildInvalid:
            case InstanceStateType.ChildAndDescendantInvalid:
            {
                switch (this.instanceState.StateType)
                {
                case InstanceStateType.Valid:
                {
                    this.instanceState = newState;
                    return;
                }

                case InstanceStateType.Invalid:
                case InstanceStateType.Uninitialized:
                {
                    return;
                }

                case InstanceStateType.PropertyOrChildInvalid:
                case InstanceStateType.ChildAndDescendantInvalid:
                {
                    if (this.instanceState.IsPropertyInvalid != newState.IsPropertyInvalid)
                    {
                        this.instanceState = Microsoft.Expression.DesignModel.InstanceBuilders.InstanceState.Invalid;
                        return;
                    }
                    if (this.instanceState.IsPropertyInvalid && newState.IsPropertyInvalid)
                    {
                        if (this.instanceState.InvalidProperties.Contains(newState.InvalidProperties[0]))
                        {
                            return;
                        }
                        this.instanceState.InvalidProperties.Add(newState.InvalidProperties[0]);
                        return;
                    }
                    else if (!this.instanceState.IsChildInvalid || !newState.IsChildInvalid)
                    {
                        if (this.instanceState.IsDescendantInvalid || !newState.IsDescendantInvalid)
                        {
                            return;
                        }
                        this.instanceState = new Microsoft.Expression.DesignModel.InstanceBuilders.InstanceState(newState, InstanceStateType.ChildAndDescendantInvalid);
                        return;
                    }
                    else
                    {
                        DocumentCompositeNode documentNode = (DocumentCompositeNode)this.DocumentNode;
                        if (this.instanceState.ChildAction != DocumentNodeChangeAction.Replace || newState.ChildAction != DocumentNodeChangeAction.Replace)
                        {
                            if (this.instanceState.InvalidChildIndices == null && this.instanceState.ChildIndex == newState.ChildIndex && this.instanceState.ChildAction == newState.ChildAction && (this.instanceState.ChildAction != DocumentNodeChangeAction.Add || this.Children.Count == documentNode.Children.Count - 1) && (this.instanceState.ChildAction != DocumentNodeChangeAction.Remove || this.Children.Count == documentNode.Children.Count + 1))
                            {
                                return;
                            }
                            this.instanceState = Microsoft.Expression.DesignModel.InstanceBuilders.InstanceState.Invalid;
                            return;
                        }
                        else
                        {
                            if (this.instanceState.InvalidChildIndices == null && (newState.InvalidChildIndices != null || this.instanceState.ChildIndex != newState.ChildIndex))
                            {
                                int childIndex = this.instanceState.ChildIndex;
                                this.instanceState = new Microsoft.Expression.DesignModel.InstanceBuilders.InstanceState(new List <int>(), this.instanceState.StateType);
                                this.instanceState.InvalidChildIndices.Add(childIndex);
                            }
                            if (this.instanceState.InvalidChildIndices == null)
                            {
                                return;
                            }
                            if (newState.InvalidChildIndices == null)
                            {
                                this.instanceState.InvalidChildIndices.Add(newState.ChildIndex);
                                return;
                            }
                            using (IEnumerator <int> enumerator = newState.InvalidChildIndices.GetEnumerator())
                            {
                                while (enumerator.MoveNext())
                                {
                                    int current = enumerator.Current;
                                    this.instanceState.InvalidChildIndices.Add(current);
                                }
                                return;
                            }
                        }
                    }
                    break;
                }

                case InstanceStateType.DescendantInvalid:
                {
                    this.instanceState = new Microsoft.Expression.DesignModel.InstanceBuilders.InstanceState(newState, InstanceStateType.ChildAndDescendantInvalid);
                    return;
                }

                default:
                {
                    return;
                }
                }
                break;
            }

            case InstanceStateType.DescendantInvalid:
            {
                switch (this.instanceState.StateType)
                {
                case InstanceStateType.Valid:
                {
                    this.instanceState = newState;
                    return;
                }

                case InstanceStateType.Invalid:
                case InstanceStateType.Uninitialized:
                case InstanceStateType.DescendantInvalid:
                {
                    return;
                }

                case InstanceStateType.PropertyOrChildInvalid:
                case InstanceStateType.ChildAndDescendantInvalid:
                {
                    this.instanceState = new Microsoft.Expression.DesignModel.InstanceBuilders.InstanceState(this.instanceState, InstanceStateType.ChildAndDescendantInvalid);
                    return;
                }

                default:
                {
                    return;
                }
                }
                break;
            }

            default:
            {
                return;
            }
            }
        }
 public InstantiatedUserControlViewNode(Microsoft.Expression.DesignModel.InstanceBuilders.ViewNodeManager manager, Microsoft.Expression.DesignModel.DocumentModel.DocumentNode documentNode, Microsoft.Expression.DesignModel.InstanceBuilders.InstanceState instanceState, object instance) : base(manager, documentNode, instanceState, instance)
 {
 }
 public InstantiatedElementViewNode(Microsoft.Expression.DesignModel.InstanceBuilders.ViewNodeManager manager, Microsoft.Expression.DesignModel.DocumentModel.DocumentNode documentNode, Microsoft.Expression.DesignModel.InstanceBuilders.InstanceState instanceState, object instance) : base(manager, documentNode, instanceState, instance)
 {
     this.instantiatedElements = new InstantiatedElementList();
 }