Delen via


VsShellUtilities.CreateAsyncDocView Method

Definition

Creates an instance of an IAsyncDocView object. When LoadDocViewAsync(IProgress<LoadDocViewProgress>, LoadDocumentViewContext, CancellationToken) is called, it will wait for intellisense before executing asyncDocViewFactory.

public static Microsoft.VisualStudio.Shell.IAsyncDocView CreateAsyncDocView (Func<IProgress<Microsoft.VisualStudio.Shell.LoadDocViewProgress>,Microsoft.VisualStudio.Shell.LoadDocumentViewContext,System.Threading.CancellationToken,System.Threading.Tasks.Task<Microsoft.VisualStudio.Shell.LoadDocViewResult>> asyncDocViewFactory, Microsoft.VisualStudio.Shell.IAsyncServiceProvider? serviceProvider = default);
static member CreateAsyncDocView : Func<IProgress<Microsoft.VisualStudio.Shell.LoadDocViewProgress>, Microsoft.VisualStudio.Shell.LoadDocumentViewContext, System.Threading.CancellationToken, System.Threading.Tasks.Task<Microsoft.VisualStudio.Shell.LoadDocViewResult>> * Microsoft.VisualStudio.Shell.IAsyncServiceProvider -> Microsoft.VisualStudio.Shell.IAsyncDocView
Public Function CreateAsyncDocView (asyncDocViewFactory As Func(Of IProgress(Of LoadDocViewProgress), LoadDocumentViewContext, CancellationToken, Task(Of LoadDocViewResult)), Optional serviceProvider As IAsyncServiceProvider = Nothing) As IAsyncDocView

Parameters

asyncDocViewFactory
Func<IProgress<LoadDocViewProgress>,LoadDocumentViewContext,CancellationToken,Task<LoadDocViewResult>>

A function that creates a document view.

serviceProvider
IAsyncServiceProvider

A reference to a service provider. If null, then the global service provider will be used.

Returns

An instance of a IAsyncDocView.

Examples

VsShellUtilities.CreateAsyncDocView( (progress, context, token) => { object docView; Guid commandUIContext;

    // ** Create document view ** //

    return Task.FromResult(new LoadDocViewResult(docView, commandUIContext));
});

Applies to