Udostępnij za pośrednictwem


WorkspacesExtensionMethods.GetActiveProjectAsync Method

Definition

Overloads

GetActiveProjectAsync(IClientContext, CancellationToken)

Gets the active project snapshot with Path information by default. This snapshot can be used to update the project starting with AsUpdatable extension method.

GetActiveProjectAsync(IClientContext, Func<IAsyncQueryable<IProjectSnapshot>,IAsyncQueryable<IProjectSnapshot>>, CancellationToken)

Gets the active project snapshot with Path and Files information and additional properties added in withModifier callback. This snapshot can be used to update the project starting with AsUpdatable extension method.

GetActiveProjectAsync(IClientContext, CancellationToken)

Gets the active project snapshot with Path information by default. This snapshot can be used to update the project starting with AsUpdatable extension method.

public static System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.Query.IProjectSnapshot?> GetActiveProjectAsync (this Microsoft.VisualStudio.Extensibility.IClientContext clientContext, System.Threading.CancellationToken cancellationToken);
static member GetActiveProjectAsync : Microsoft.VisualStudio.Extensibility.IClientContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.Query.IProjectSnapshot>
<Extension()>
Public Function GetActiveProjectAsync (clientContext As IClientContext, cancellationToken As CancellationToken) As Task(Of IProjectSnapshot)

Parameters

clientContext
IClientContext

Client context to utilize.

cancellationToken
CancellationToken

A cancellation token.

Returns

An instance of IProjectSnapshot or null if there is no active project or active project no longer exists.

Applies to

GetActiveProjectAsync(IClientContext, Func<IAsyncQueryable<IProjectSnapshot>,IAsyncQueryable<IProjectSnapshot>>, CancellationToken)

Gets the active project snapshot with Path and Files information and additional properties added in withModifier callback. This snapshot can be used to update the project starting with AsUpdatable extension method.

public static System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.Query.IProjectSnapshot?> GetActiveProjectAsync (this Microsoft.VisualStudio.Extensibility.IClientContext clientContext, Func<Microsoft.VisualStudio.ProjectSystem.Query.IAsyncQueryable<Microsoft.VisualStudio.ProjectSystem.Query.IProjectSnapshot>,Microsoft.VisualStudio.ProjectSystem.Query.IAsyncQueryable<Microsoft.VisualStudio.ProjectSystem.Query.IProjectSnapshot>> withModifier, System.Threading.CancellationToken cancellationToken);
static member GetActiveProjectAsync : Microsoft.VisualStudio.Extensibility.IClientContext * Func<Microsoft.VisualStudio.ProjectSystem.Query.IAsyncQueryable<Microsoft.VisualStudio.ProjectSystem.Query.IProjectSnapshot>, Microsoft.VisualStudio.ProjectSystem.Query.IAsyncQueryable<Microsoft.VisualStudio.ProjectSystem.Query.IProjectSnapshot>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.Query.IProjectSnapshot>
<Extension()>
Public Function GetActiveProjectAsync (clientContext As IClientContext, withModifier As Func(Of IAsyncQueryable(Of IProjectSnapshot), IAsyncQueryable(Of IProjectSnapshot)), cancellationToken As CancellationToken) As Task(Of IProjectSnapshot)

Parameters

clientContext
IClientContext

Client context to utilize.

withModifier
Func<IAsyncQueryable<IProjectSnapshot>,IAsyncQueryable<IProjectSnapshot>>

An additional callback to add more properties to returned project snapshot.

cancellationToken
CancellationToken

A cancellation token.

Returns

An instance of IProjectSnapshot or null if there is no active project or active project no longer exists.

Applies to