Esempio n. 1
0
 public void Refresh(bool viewSwitched, bool rootNodeChanged)
 {
     this.sceneSwitched   |= viewSwitched;
     this.rootNodeChanged |= rootNodeChanged;
     if (viewSwitched || rootNodeChanged)
     {
         this.dirtyViewState         |= SceneViewModel.ViewStateBits.EntireScene;
         this.dirtyPipelineCalcState |= SceneViewModel.PipelineCalcBits.EntireScene;
     }
     if (this.viewModel == null || this.viewModel.Document == null || this.viewModel.XamlDocument == null)
     {
         return;
     }
     if ((int)this.viewModel.ChangeStamp != (int)this.viewStateChangeStamp)
     {
         this.viewStateChangeStamp = this.viewModel.ChangeStamp;
         this.dirtyViewState      |= this.viewModel.DirtyState;
     }
     if ((int)this.viewModel.XamlDocument.ChangeStamp != (int)this.documentChangeStamp)
     {
         this.documentChangeStamp = this.viewModel.XamlDocument.ChangeStamp;
         this.documentChanges.Merge((DocumentNodeMarkerSortedListOf <DocumentNodeChange>) this.viewModel.Damage, true);
         this.viewModel.AnnotateDamage(this.documentChanges);
     }
     if ((int)this.viewModel.PipelineCalcChangeStamp == (int)this.pipelineCalcChangeStamp)
     {
         return;
     }
     this.pipelineCalcChangeStamp = this.viewModel.PipelineCalcChangeStamp;
     this.dirtyPipelineCalcState |= this.viewModel.DirtyPipelineCalcState;
 }
Esempio n. 2
0
 public MultiplePropertyReferencesChangedEventArgs(IList <PropertyReference> propertyReferenceList, SceneViewModel.ViewStateBits dirtyViewState, bool forceUpdate)
 {
     this.dirtyViewState = dirtyViewState;
     if (propertyReferenceList != null)
     {
         this.propertyReferences = new PropertyReference[propertyReferenceList.Count];
         propertyReferenceList.CopyTo(this.propertyReferences, 0);
     }
     this.forceUpdate = forceUpdate;
 }
Esempio n. 3
0
 public SceneUpdatePhaseEventArgs(SceneViewModel viewModel, bool sceneSwitched, bool rootNodeChanged)
 {
     this.viewModel       = viewModel;
     this.documentChanges = new DocumentNodeChangeList();
     if (this.viewModel != null)
     {
         this.dirtyViewState       = viewModel.DirtyState;
         this.viewStateChangeStamp = viewModel.ChangeStamp;
         this.documentChanges.Merge((DocumentNodeMarkerSortedListOf <DocumentNodeChange>)viewModel.Damage, false);
         this.documentChangeStamp = viewModel.XamlDocument.ChangeStamp;
         this.viewModel.AnnotateDamage(this.documentChanges);
         this.dirtyPipelineCalcState  = viewModel.DirtyPipelineCalcState;
         this.pipelineCalcChangeStamp = viewModel.PipelineCalcChangeStamp;
     }
     this.sceneSwitched   = sceneSwitched;
     this.rootNodeChanged = rootNodeChanged;
     if (!this.sceneSwitched && !this.rootNodeChanged)
     {
         return;
     }
     this.dirtyViewState         = SceneViewModel.ViewStateBits.EntireScene;
     this.dirtyPipelineCalcState = SceneViewModel.PipelineCalcBits.EntireScene;
 }
Esempio n. 4
0
 public bool IsDirtyViewState(SceneViewModel.ViewStateBits bits)
 {
     return((this.dirtyViewState & bits) != SceneViewModel.ViewStateBits.None);
 }
 public PropertyReferenceChangedEventArgs(SceneViewModel.ViewStateBits dirtyViewState, PropertyReference propertyReference)
 {
     this.ChangeStamp       = PropertyReferenceChangedEventArgs.changeStampSeed++;
     this.dirtyViewState    = dirtyViewState;
     this.propertyReference = propertyReference;
 }
Esempio n. 6
0
        private void FireSelectivePropertyChangedEventsWorker(SceneViewModel.ViewStateBits dirtyViewState)
        {
            this.DeferUpdateHandlerList(true);
            int index1 = 0;
            int index2 = 0;
            PropertyReferenceChangedEventArgs e = new PropertyReferenceChangedEventArgs(dirtyViewState, (PropertyReference)null);

            for (; index1 < this.propertyReferenceChangedHandlerList.Count; ++index1)
            {
                while (index2 < this.changedPropertyReferences.Count && index1 < this.propertyReferenceChangedHandlerList.Count && this.changedPropertyReferences[index2].CompareTo(this.propertyReferenceChangedHandlerList.Keys[index1]) < 0)
                {
                    if (this.changedPropertyReferences[index2].IsPrefixOf(this.propertyReferenceChangedHandlerList.Keys[index1]))
                    {
                        foreach (PropertyManager.HandlerInfo handlerInfo in this.propertyReferenceChangedHandlerList.Values[index1])
                        {
                            e.PropertyReference = this.propertyReferenceChangedHandlerList.Keys[index1];
                            handlerInfo.CallHandler(this, e);
                        }
                        ++index1;
                    }
                    else
                    {
                        ++index2;
                    }
                }
                if (index2 < this.changedPropertyReferences.Count && index1 < this.propertyReferenceChangedHandlerList.Count)
                {
                    if (this.changedPropertyReferences[index2].CompareTo(this.propertyReferenceChangedHandlerList.Keys[index1]) == 0)
                    {
                        foreach (PropertyManager.HandlerInfo handlerInfo in this.propertyReferenceChangedHandlerList.Values[index1])
                        {
                            e.PropertyReference = this.propertyReferenceChangedHandlerList.Keys[index1];
                            handlerInfo.CallHandler(this, e);
                        }
                    }
                    else if (this.propertyReferenceChangedHandlerList.Keys[index1].IsPrefixOf(this.changedPropertyReferences[index2]))
                    {
                        int index3 = index2;
                        do
                        {
                            foreach (PropertyManager.HandlerInfo handlerInfo in this.propertyReferenceChangedHandlerList.Values[index1])
                            {
                                if (handlerInfo.IncludeSubpropertyChanges)
                                {
                                    e.PropertyReference = this.changedPropertyReferences[index3];
                                    handlerInfo.CallHandler(this, e);
                                }
                            }
                        }while (++index3 < this.changedPropertyReferences.Count && this.propertyReferenceChangedHandlerList.Keys[index1].IsPrefixOf(this.changedPropertyReferences[index3]));
                    }
                }
                else
                {
                    break;
                }
            }
            this.DeferUpdateHandlerList(false);
            if (this.MultiplePropertyReferencesChanged == null)
            {
                return;
            }
            this.MultiplePropertyReferencesChanged(this, new MultiplePropertyReferencesChangedEventArgs((IList <PropertyReference>) this.changedPropertyReferences, dirtyViewState, false));
        }
Esempio n. 7
0
        public void Update(SceneViewModel targetViewModel, SceneViewModel.ViewStateBits viewStateBits)
        {
            bool flag1 = (viewStateBits & SceneViewModel.ViewStateBits.ElementSelection) != SceneViewModel.ViewStateBits.None;

            if (targetViewModel != null && !targetViewModel.Document.IsEditable)
            {
                targetViewModel = (SceneViewModel)null;
            }
            if (targetViewModel != this.lastViewModel)
            {
                if (this.subscription == null || targetViewModel == null || this.subscription.ProjectContext != targetViewModel.ProjectContext)
                {
                    if (this.subscription != null)
                    {
                        this.subscription.PathNodeInserted   -= new XamlProjectSubscription.DocumentNodeInsertedHandler(this.Subscription_PathNodeInserted);
                        this.subscription.PathNodeRemoved    -= new XamlProjectSubscription.DocumentNodeRemovedHandler(this.Subscription_PathNodeRemoved);
                        this.subscription.CatastrophicUpdate -= new EventHandler(this.Subscription_Refresh);
                        this.subscription.Dispose();
                        this.subscription = (XamlProjectSubscription)null;
                    }
                    if (targetViewModel != null)
                    {
                        this.subscription = new XamlProjectSubscription(this.ResourceManager.DesignerContext, targetViewModel.ProjectContext, new SearchPath(new SearchStep[2]
                        {
                            new SearchStep((SearchAxis) new DelegateAxis(new DelegateAxis.EnumerationHandler(this.FilterScopeEnumerator), SearchScope.NodeTreeSelf)),
                            new SearchStep((SearchAxis) new DelegateAxis(new DelegateAxis.EnumerationHandler(this.FilteredResourceEnumerator), SearchScope.NodeTreeDescendant))
                        }), new XamlProjectSubscription.DocumentNodeFilter(this.FilteredDocumentNodeEnumerator));
                        this.subscription.PathNodeInserted   += new XamlProjectSubscription.DocumentNodeInsertedHandler(this.Subscription_PathNodeInserted);
                        this.subscription.PathNodeRemoved    += new XamlProjectSubscription.DocumentNodeRemovedHandler(this.Subscription_PathNodeRemoved);
                        this.subscription.CatastrophicUpdate += new EventHandler(this.Subscription_Refresh);
                    }
                }
                else
                {
                    this.subscription.Clear();
                }
                this.ClearItems();
                this.lastViewModel = targetViewModel;
                this.lastSelection.Clear();
                flag1 = true;
            }
            if (this.lastViewModel == null || !flag1)
            {
                return;
            }
            DocumentNodeMarkerSortedListOf <DocumentNodePath> newBasisNodes = new DocumentNodeMarkerSortedListOf <DocumentNodePath>(this.Selection.Count);

            foreach (SceneNode sceneNode in this.Selection.Selection)
            {
                DocumentNodeMarker marker           = sceneNode.DocumentNode.Marker;
                DocumentNodePath   documentNodePath = this.lastSelection.Find(marker) ?? sceneNode.DocumentNodePath;
                newBasisNodes.Add(marker, documentNodePath);
            }
            bool flag2 = true;

            foreach (DocumentNodeMarker marker in this.lastSelection.Markers)
            {
                if (newBasisNodes.Find(marker) == null)
                {
                    flag2 = false;
                    break;
                }
            }
            if (!flag2)
            {
                this.subscription.Clear();
                this.ClearItems();
            }
            this.subscription.SetBasisNodes(newBasisNodes);
            this.lastSelection = newBasisNodes;
            this.subscription.Update();
            this.ResourceManager.SelectedItems.RemoveSelection((ResourceEntryBase)this);
            this.OnPropertyChanged("Name");
            this.OnPropertyChanged("Type");
            this.OnPropertyChanged("UniqueId");
            this.OnPropertyChanged("ToolTip");
        }