public void Clear(HashSet <IDsDocument> modules) { lock (lockObj) { foreach (var kv in cachedItems.ToArray()) { if (InModifiedModuleHelper.IsInModifiedModule(modules, kv.Key.Nodes) || IsInModifiedModule(documentService, modules, kv.Value)) { cachedItems.Remove(kv.Key); continue; } } } }
static bool IsInModifiedModule(IDsDocumentService documentService, HashSet <IDsDocument> modules, Item item) { var result = item.Content; if (result == null && item.WeakContent != null) { result = (DocumentViewerContent)item.WeakContent.Target; } var refs = result?.ReferenceCollection; if (refs == null) { return(false); } return(InModifiedModuleHelper.IsInModifiedModule(documentService, modules, refs.Select(a => a.Data.Reference))); }
bool MustRefresh(IDocumentTab tab, IEnumerable <IDsDocument> documents) { var modules = new HashSet <IDsDocument>(documents); if (InModifiedModuleHelper.IsInModifiedModule(modules, tab.Content.Nodes)) { return(true); } var documentViewer = tab.TryGetDocumentViewer(); if (documentViewer != null && InModifiedModuleHelper.IsInModifiedModule(DocumentTreeView.DocumentService, modules, documentViewer.Content.ReferenceCollection.Select(a => a.Data.Reference))) { return(true); } return(false); }