private void OnProjectContextDocumentClosedLate(object sender, ProjectDocumentEventArgs e)
        {
            List <SceneView> list1 = (List <SceneView>)null;

            if (this.pendingViewsForClosedDocuments.TryGetValue(e.Document, out list1))
            {
                this.pendingViewsForClosedDocuments.Remove(e.Document);
                List <SceneView> list2 = (List <SceneView>)null;
                foreach (SceneView sceneView in list1)
                {
                    if (ViewUpdateManager.GetDocumentRelation(sceneView, e.Document) == ViewUpdateManager.DocumentRelation.Related)
                    {
                        if (list2 == null)
                        {
                            list2 = new List <SceneView>();
                        }
                        list2.Add(sceneView);
                    }
                }
                if (list2 != null)
                {
                    this.InvalidateViewsInternal((ICollection <SceneView>)list2);
                }
            }
            SceneView activeView = this.DesignerContext.ActiveView;

            if (activeView == null)
            {
                return;
            }
            activeView.RebuildUserControls(e.Document);
        }
        internal void RefreshViewUpdatesForDesignTimeResources(bool updateViews)
        {
            List <SceneView> list1 = new List <SceneView>();

            foreach (List <SceneView> list2 in this.primaryViewsForDocument.Values)
            {
                foreach (SceneView view in list2)
                {
                    ViewUpdateManager.AddViewInOrder(view, (IList <SceneView>)list1);
                }
            }
            foreach (SceneView sceneView in list1)
            {
                this.EnsureViewUpdatesForDesignTimeResources(sceneView);
            }
            if (!updateViews)
            {
                return;
            }
            foreach (SceneView view in list1)
            {
                if (!view.IsClosing && view.InstanceBuilderContext.WarningDictionary.Count > 0)
                {
                    List <DocumentNode> list2 = new List <DocumentNode>(view.InstanceBuilderContext.WarningDictionary.Keys);
                    bool flag = false;
                    foreach (DocumentNode documentNode in list2)
                    {
                        if (documentNode.Type.IsResource)
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (flag)
                    {
                        if (this.UpdatesPostponed)
                        {
                            ViewUpdateManager.AddViewInOrder(view, (IList <SceneView>) this.postponedInstanceUpdates);
                        }
                        else
                        {
                            view.InvalidateAndUpdate();
                        }
                    }
                }
            }
        }
 private void InvalidateViewsInternal(ICollection <SceneView> affectedViews)
 {
     if (affectedViews == null || affectedViews.Count <= 0)
     {
         return;
     }
     if (this.UpdatesPostponed)
     {
         foreach (SceneView view in (IEnumerable <SceneView>)affectedViews)
         {
             ViewUpdateManager.AddViewInOrder(view, (IList <SceneView>) this.postponedInstanceUpdates);
         }
         this.RebuildPostponedViewsAsync();
     }
     else
     {
         this.InvalidateViews(affectedViews, true);
     }
 }
        public void EnsureViewUpdatesForRelatedDocument(SceneView sceneView, SceneDocument sceneDocument)
        {
            ViewUpdateManager.RelatedDocumentTable relatedDocumentTable;
            if (!this.relatedDocumentsForView.TryGetValue(sceneView, out relatedDocumentTable))
            {
                relatedDocumentTable = new ViewUpdateManager.RelatedDocumentTable();
                this.relatedDocumentsForView[sceneView] = relatedDocumentTable;
            }
            if (sceneDocument == sceneView.Document || relatedDocumentTable.Contains(sceneDocument))
            {
                return;
            }
            IProjectDocument document = sceneDocument.ProjectContext.GetDocument(sceneDocument.DocumentRoot);

            if (ViewUpdateManager.GetDocumentRelation(sceneView, document) != ViewUpdateManager.DocumentRelation.Related || ViewUpdateManager.IsDisposingOrDisposed(sceneDocument.ProjectContext))
            {
                return;
            }
            relatedDocumentTable.Add(sceneDocument);
            this.RegisterRelatedDocumentInternal(sceneView, sceneDocument);
        }
        private List <SceneView> GetOrderedRelatedViews(SceneView view)
        {
            List <SceneView> list1 = new List <SceneView>();

            ViewUpdateManager.RelatedDocumentTable relatedDocumentTable;
            if (this.relatedDocumentsForView.TryGetValue(view, out relatedDocumentTable))
            {
                foreach (SceneDocument key in Enumerable.ToArray <SceneDocument>((IEnumerable <SceneDocument>)relatedDocumentTable.Documents))
                {
                    List <SceneView> list2;
                    if (this.primaryViewsForDocument.TryGetValue(key, out list2))
                    {
                        foreach (SceneView view1 in list2.ToArray())
                        {
                            ViewUpdateManager.AddViewInOrder(view1, (IList <SceneView>)list1);
                        }
                    }
                }
            }
            return(list1);
        }
 private void UpdateReferences(ICollection <SceneView> affectedViews)
 {
     if (affectedViews == null || affectedViews.Count <= 0)
     {
         return;
     }
     foreach (SceneView view in (IEnumerable <SceneView>)affectedViews)
     {
         if (!this.postponedInstanceUpdates.Contains(view))
         {
             if (this.UpdatesPostponed)
             {
                 ViewUpdateManager.AddViewInOrder(view, (IList <SceneView>) this.postponedReferenceUpdates);
                 this.RebuildPostponedViewsAsync();
             }
             else if (!view.IsClosing)
             {
                 view.UpdateReferences();
             }
         }
     }
 }
        public bool ResolveRelatedMissingResources(SceneView view, DesignTimeResourceResolverContext resourceResolverContext)
        {
            if (view.IsClosing)
            {
                return(false);
            }
            List <SceneView> orderedRelatedViews = this.GetOrderedRelatedViews(view);

            foreach (SceneDocument key in new List <SceneDocument>(view.Document.DesignTimeResourceDocuments))
            {
                List <SceneView> list;
                if (this.primaryViewsForDocument.TryGetValue(key, out list))
                {
                    foreach (SceneView view1 in list)
                    {
                        if (!view1.IsClosing && !view1.IsEditingOutOfPlace)
                        {
                            ViewUpdateManager.AddViewInOrder(view1, (IList <SceneView>)orderedRelatedViews);
                        }
                    }
                }
            }
            bool flag = false;

            foreach (SceneView sceneView in orderedRelatedViews)
            {
                if (sceneView.ResolveMissingResourcesOnce(resourceResolverContext))
                {
                    flag = true;
                }
                if (resourceResolverContext.IsCanceled)
                {
                    break;
                }
            }
            return(flag);
        }
 public PostponeUpdateToken(ViewUpdateManager manager)
 {
     this.manager = manager;
     ++this.manager.postponeUpdateCount;
 }