Exemplo n.º 1
0
        /// <summary>
        /// Get <see cref="Document"/> from <see cref="Text.Extensions.GetOpenDocumentInCurrentContextWithChanges(ITextSnapshot)"/>
        /// once <see cref="IWorkspaceStatusService.WaitUntilFullyLoadedAsync(CancellationToken)"/> returns
        /// </summary>
        public static Document?GetFullyLoadedOpenDocumentInCurrentContextWithChanges(
            this ITextSnapshot snapshot, IUIThreadOperationContext operationContext, IThreadingContext threadingContext)
        {
            // make sure this is only called from UI thread
            threadingContext.ThrowIfNotOnUIThread();

            return(threadingContext.JoinableTaskFactory.Run(() =>
                                                            snapshot.GetFullyLoadedOpenDocumentInCurrentContextWithChangesAsync(operationContext)));
        }