private void UnregisterRelatedDocuments(SceneView sceneView)
 {
     ViewUpdateManager.RelatedDocumentTable relatedDocumentTable = (ViewUpdateManager.RelatedDocumentTable)null;
     if (!this.relatedDocumentsForView.TryGetValue(sceneView, out relatedDocumentTable))
     {
         return;
     }
     foreach (SceneDocument sceneDocument in new List <SceneDocument>((IEnumerable <SceneDocument>)relatedDocumentTable.Documents))
     {
         this.UnregisterRelatedDocumentInternal(sceneView, sceneDocument);
         relatedDocumentTable.Remove(sceneDocument);
     }
     this.relatedDocumentsForView.Remove(sceneView);
 }
        private void OnProjectContextDocumentClosedEarly(object sender, ProjectDocumentEventArgs e)
        {
            IProjectDocument document      = e.Document;
            SceneDocument    sceneDocument = e.Document.Document as SceneDocument;

            if (sceneDocument == null)
            {
                return;
            }
            List <SceneView> list1 = (List <SceneView>)null;

            if (this.primaryViewsForDocument.TryGetValue(sceneDocument, out list1))
            {
                foreach (SceneView sceneView in new List <SceneView>((IEnumerable <SceneView>)list1))
                {
                    sceneView.SuspendUpdatesForViewShutdown();
                    this.Unregister(sceneView);
                }
            }
            List <SceneView> list2 = (List <SceneView>)null;

            if (!this.relatedViewsForDocument.TryGetValue(sceneDocument, out list2))
            {
                return;
            }
            List <SceneView> list3 = new List <SceneView>((IEnumerable <SceneView>)list2);

            foreach (SceneView sceneView in list3)
            {
                ViewUpdateManager.RelatedDocumentTable relatedDocumentTable = this.relatedDocumentsForView[sceneView];
                this.UnregisterRelatedDocumentInternal(sceneView, sceneDocument);
                relatedDocumentTable.Remove(sceneDocument);
            }
            List <SceneView> list4;

            if (!this.pendingViewsForClosedDocuments.TryGetValue(e.Document, out list4))
            {
                this.pendingViewsForClosedDocuments.Add(e.Document, list3);
            }
            else
            {
                list4.AddRange(Enumerable.Except <SceneView>((IEnumerable <SceneView>)list3, (IEnumerable <SceneView>)list4));
            }
        }