public bool Load(DocumentList documentList, IDsDocumentLoader documentLoader) { const bool isReload = false; if (documentLoader == null) { documentLoader = new DefaultDsDocumentLoader(documentTabService.DocumentTreeView.DocumentService); } if (!CanLoad) { return(false); } if (!CheckCanLoad(isReload)) { return(false); } if (documentList != documentListService.SelectedDocumentList) { SaveCurrentDocumentsToList(); } NotifyBeforeLoad(isReload); using (DisableSaveToList()) { documentTabService.CloseAll(); documentTabService.DocumentTreeView.DocumentService.Clear(); documentLoader.Load(documentList.Documents.Select(a => new DocumentToLoad(a))); } NotifyAfterLoad(isReload); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { GC.Collect(); GC.WaitForPendingFinalizers(); })); return(true); }
public bool Load(DocumentList documentList, IDsDocumentLoader?documentLoader) { const bool isReload = false; if (documentLoader is null) { documentLoader = new DefaultDsDocumentLoader(documentTabService.DocumentTreeView.DocumentService); } if (!CanLoad) { return(false); } if (!CheckCanLoad(isReload)) { return(false); } if (documentList != documentListService.SelectedDocumentList) { SaveCurrentDocumentsToList(); } NotifyBeforeLoad(isReload); using (DisableSaveToList()) { documentTabService.CloseAll(); documentTabService.DocumentTreeView.DocumentService.Clear(); documentLoader.Load(documentList.Documents.Select(a => new DocumentToLoad(a))); } NotifyAfterLoad(isReload); return(true); }