private static void StartViewImportsCopy(Uri[] fileUris, List <Task> copyTasks, CollaborationSession sessionContext, CancellationToken cancellationToken) { foreach (var fileUri in fileUris) { if (fileUri.GetAbsoluteOrUNCPath().EndsWith(ViewImportsFileName, StringComparison.Ordinal)) { var copyTask = sessionContext.DownloadFileAsync(fileUri, cancellationToken); copyTasks.Add(copyTask); } } }
/// <inheritdoc /> public override void OpenDocument(DocumentId documentId, bool activate = true) { var doc = CurrentSolution.GetDocument(documentId); if (doc != null) { var svc = _serviceProvider.GetService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument; Report.IfNotPresent(svc); if (svc == null) { return; } _threadingContext.JoinableTaskFactory.Run(async() => { await _session.DownloadFileAsync(_session.ConvertLocalPathToSharedUri(doc.FilePath), CancellationToken.None).ConfigureAwait(true); }); Guid logicalView = Guid.Empty; if (ErrorHandler.Succeeded(svc.OpenDocumentViaProject(doc.FilePath, ref logicalView, out var sp, out IVsUIHierarchy hier, out uint itemid, out IVsWindowFrame frame)) && frame != null) { if (activate) { frame.Show(); } else { frame.ShowNoActivate(); } if (_runningDocumentTableEventTracker.IsFileOpen(doc.FilePath) && _runningDocumentTableEventTracker.TryGetBufferFromMoniker(doc.FilePath, out var buffer)) { var hierarchy = _runningDocumentTableEventTracker.GetDocumentHierarchy(doc.FilePath); NotifyOnDocumentOpened(doc.FilePath, buffer, hierarchy); } } } }