Udostępnij za pośrednictwem


VsTaskLibraryHelper Class

Definition

Helper methods for using Visual Studio task library in managed code.

public ref class VsTaskLibraryHelper abstract sealed
public ref class VsTaskLibraryHelper abstract sealed
class VsTaskLibraryHelper abstract sealed
public static class VsTaskLibraryHelper
type VsTaskLibraryHelper = class
Public Module VsTaskLibraryHelper
Inheritance
VsTaskLibraryHelper

Properties

ServiceInstance

Gets the task scheduler service instance.

Methods

ApplyCancellationToken(IVsTask, CancellationToken)

Signals a VS Task to abort operations as soon as possible when the specified token is canceled.

AsVsTask<T>(JoinableTask<T>)

Wraps a JoinableTask<T> instance in an IVsTask that can be returned to COM clients.

CancelOnShutdown(IVsTask, AsyncPackage)

Ensures that task will be canceled when package is disposed. The package's Dispose method will not return until task completes.

CancelWhenCancellationRequested(IVsTask, JoinableTaskFactory, CancellationToken)

Ensures that task will be canceled when cancellation is requested for cancellationToken.

CompleteAfterTask<T>(IVsTaskCompletionSource, Task<T>)

Sets a continuation on the task passed in so that task completion source is set to correct state after the task is completed/faulted or canceled.

ContinueWhenAllCompleted(IVsTaskSchedulerService, VsTaskRunContext, IVsTask[], IVsTaskBody)

Override for IVsTaskSchedulerService.ContinueWhenAllCompleted to use proper enum types.

ContinueWhenAllCompleted(IVsTaskSchedulerService, VsTaskRunContext, IVsTask[], VsTaskContinuationOptions, IVsTaskBody, Object)

Override for IVsTaskSchedulerService.ContinueWhenAllCompletedEx to use proper enum types.

ContinueWith(IVsTask, VsTaskRunContext, IVsTaskBody)

Override for IVsTask.ContinueWith to use proper enum types.

ContinueWith(IVsTask, VsTaskRunContext, VsTaskContinuationOptions, IVsTaskBody, Object)

Override for IVsTask.ContinueWithEx to use proper enum types.

CreateAndStartTask(IVsTaskSchedulerService, VsTaskRunContext, Action)

Creates a Visual Studio task that will be executed with the specified context.

CreateAndStartTask(IVsTaskSchedulerService, VsTaskRunContext, IVsTaskBody)

Creates a Visual Studio task that will be executed with the specified context.

CreateAndStartTask(IVsTaskSchedulerService, VsTaskRunContext, VsTaskBodyCallback)

Creates a Visual Studio task that will be executed with the specified context.

CreateAndStartTaskEx(IVsTaskSchedulerService, VsTaskRunContext, VsTaskCreationOptions, IVsTaskBody, Object)

Creates a Visual Studio task that will be executed with the specified context.

CreateTask(IVsTaskSchedulerService, VsTaskRunContext, IVsTaskBody)

Override for IVsTaskSchedulerService.CreateTask to use proper enum types.

CreateTask(IVsTaskSchedulerService, VsTaskRunContext, VsTaskCreationOptions, IVsTaskBody, Object)

Override for IVsTaskSchedulerService.CreateTaskEx to use proper enum types.

CreateTaskBody(Action)

Creates a task body that can be consumed by task scheduler service.

CreateTaskBody(Func<Object>)

Creates a task body that can be consumed by task scheduler service.

CreateTaskBody(VsTaskBodyCallback)

Creates a task body that can be consumed by task scheduler service.

CreateTaskBody<T>(Action<T>)

Creates a task body that can be consumed by task scheduler service.

CreateTaskBody<T>(Func<T,Object>)

Creates a task body that can be consumed by task scheduler service.

CreateTaskCompletionSource(IVsTaskSchedulerService, VsTaskCreationOptions, Object)

Override for IVsTaskSchedulerService.CreateTaskCompletionSourceEx to use proper enum types.

Delay(IVsTaskSchedulerService, Double)

Returns a task that delays execution of the subsequent task by a given period of time.

Delay(IVsTaskSchedulerService, TimeSpan)

Returns a task that delays execution of the subsequent task by a given period of time.

FileAndForget(JoinableTask, String, String, Func<Exception,Boolean>)

Records error information when the given JoinableTask faults.

FileAndForget(Task, String, String, Func<Exception,Boolean>)

Records error information when the given Task faults.

GetAwaiter(IVsTask)

Extension method for IVsTask to support await syntax in managed code.

GetAwaiter(VsTaskAwaiter)

Extension method to add await support for VsTaskAwaiter instance which can be returned from ResumeWith call.

We simply return the same awaiter instance.

GetAwaiter(VsTaskRunContext)
Obsolete.

Allows awaiting on a VsTaskRunContext in order to execute code at a particular priority on or off the UI thread.

GetTaskScheduler(VsTaskRunContext)

Gets the TaskScheduler that executes tasks on the thread and with the priority specified by the specified VsTaskRunContext.

InvokeAsync<T>(IVsTaskSchedulerService, VsInvokableAsyncFunction<T>)

Helper function that transforms a TPL task from an async function into an IVsTask.

IsUIThreadContext(VsTaskRunContext)

Gets a value indicating whether the specified context represents UI thread work.

ResumeWith(IVsTask, VsTaskRunContext)

Extension method for task awatier to support awaits with a specific context.

Run(JoinableTaskFactory, String, Func<IProgress<ThreadedWaitDialogProgressData>,CancellationToken,Task>, Nullable<TimeSpan>)

Blocks the calling (UI) thread till a cancelable, async operation completes. An optionally cancelable wait dialog is displayed if the operation takes too long.

Run(JoinableTaskFactory, String, Func<IProgress<ThreadedWaitDialogProgressData>,Task>, Nullable<TimeSpan>)

Blocks the calling (UI) thread till an async operation completes. An optionally cancelable wait dialog is displayed if the operation takes too long.

Run(JoinableTaskFactory, String, String, Func<IProgress<ThreadedWaitDialogProgressData>,CancellationToken,Task>, Nullable<TimeSpan>)

Blocks the calling (UI) thread till an async operation completes. Cancellation is offered to the user.

Run(JoinableTaskFactory, String, String, Func<IProgress<ThreadedWaitDialogProgressData>,Task>, Nullable<TimeSpan>)

Blocks the calling (UI) thread till an async operation completes. No cancellation is offered to the user.

Run<T>(JoinableTaskFactory, String, Func<IProgress<ThreadedWaitDialogProgressData>,CancellationToken,Task<T>>, Nullable<TimeSpan>)

Blocks the calling (UI) thread till a cancelable, async operation completes. An optionally cancelable wait dialog is displayed if the operation takes too long.

Run<T>(JoinableTaskFactory, String, Func<IProgress<ThreadedWaitDialogProgressData>,Task<T>>, Nullable<TimeSpan>)

Blocks the calling (UI) thread till an async operation completes. An optionally cancelable wait dialog is displayed if the operation takes too long.

Run<T>(JoinableTaskFactory, String, String, Func<IProgress<ThreadedWaitDialogProgressData>,CancellationToken,Task<T>>, Nullable<TimeSpan>)

Blocks the calling (UI) thread till an async operation completes. Cancellation is offered to the user.

Run<T>(JoinableTaskFactory, String, String, Func<IProgress<ThreadedWaitDialogProgressData>,Task<T>>, Nullable<TimeSpan>)

Blocks the calling (UI) thread till an async operation completes. No cancellation is offered to the user.

RunAsync(JoinableTaskFactory, VsTaskRunContext, Func<Task>)

Wraps the invocation of an async method such that it may execute asynchronously, but may potentially be synchronously completed (waited on) in the future.

RunAsync<T>(JoinableTaskFactory, VsTaskRunContext, Func<Task<T>>)

Wraps the invocation of an async method such that it may execute asynchronously, but may potentially be synchronously completed (waited on) in the future.

RunAsyncAsVsTask<T>(JoinableTaskFactory, VsTaskRunContext, Func<CancellationToken,Task<T>>)

Creates an IVsTask to track a cancelable async operation.

StartOnIdle(JoinableTaskFactory, Action, VsTaskRunContext)

Schedules a delegate for background execution on the UI thread without inheriting any claim to the UI thread from its caller.

StartOnIdle(JoinableTaskFactory, Func<Task>, VsTaskRunContext)

Schedules a delegate for background execution on the UI thread without inheriting any claim to the UI thread from its caller.

Wait(IVsTask, Int32, VsTaskWaitOptions)

Override for IvsTask.WaitEx to use proper enum types.

Wait(IVsTask, Int32)

Override for IvsTask.WaitEx with default options.

WithPriority(JoinableTaskFactory, VsTaskRunContext)

Creates a JoinableTaskFactory that schedules work with the specified Visual Studio UI thread priority.

Yield(IVsTaskSchedulerService, VsTaskRunContext, IVsTaskCompletionSource)

Yields the current operation on the thread, the rest of the async method will be scheduled as a continuation.

Yield(VsTaskRunContext, IVsTaskCompletionSource)

Yields the current operation on the thread, the rest of the async method will be scheduled as a continuation.

Applies to