Exemplo n.º 1
0
		internal static IDsDocument[] OpenDocuments(IDocumentTreeView documentTreeView, Window ownerWindow, IEnumerable<string> filenames, bool selectDocument = true) {
			var documentLoader = new DsDocumentLoader(documentTreeView.DocumentService, ownerWindow);
			var loadedDocuments = documentLoader.Load(filenames.Select(a => new DocumentToLoad(DsDocumentInfo.CreateDocument(a))));
			var document = loadedDocuments.Length == 0 ? null : loadedDocuments[loadedDocuments.Length - 1];
			if (selectDocument && document != null) {
				Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => {
					var node = documentTreeView.FindNode(document);
					if (node != null)
						documentTreeView.TreeView.SelectItems(new[] { node });
				}));
			}
			return loadedDocuments;
		}
Exemplo n.º 2
0
        internal static IDsDocument[] OpenDocuments(IDocumentTreeView documentTreeView, Window ownerWindow, AssemblyExplorerMostRecentlyUsedList mruList, IEnumerable <string> filenames, bool selectDocument = true)
        {
            var documentLoader  = new DsDocumentLoader(documentTreeView.DocumentService, ownerWindow, mruList);
            var loadedDocuments = documentLoader.Load(filenames.Select(a => new DocumentToLoad(DsDocumentInfo.CreateDocument(a))));
            var document        = loadedDocuments.Length == 0 ? null : loadedDocuments[loadedDocuments.Length - 1];

            if (selectDocument && document is not null)
            {
                Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => {
                    var node = documentTreeView.FindNode(document);
                    if (node is not null)
                    {
                        documentTreeView.TreeView.SelectItems(new[] { node });
                    }
                }));
            }
            return(loadedDocuments);
        }