示例#1
0
 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;
             }
         }
     }
 }
示例#2
0
        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)));
        }
示例#3
0
        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);
        }