共用方式為


VsTaskLibraryHelper.Run Method

Definition

Overloads

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, 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.

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, 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(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.

public static void Run (this Microsoft.VisualStudio.Threading.JoinableTaskFactory joinableTaskFactory, string waitCaption, Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>,System.Threading.CancellationToken,System.Threading.Tasks.Task> asyncMethod, TimeSpan? delayToShowDialog = default);
static member Run : Microsoft.VisualStudio.Threading.JoinableTaskFactory * string * Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>, System.Threading.CancellationToken, System.Threading.Tasks.Task> * Nullable<TimeSpan> -> unit
<Extension()>
Public Sub Run (joinableTaskFactory As JoinableTaskFactory, waitCaption As String, asyncMethod As Func(Of IProgress(Of ThreadedWaitDialogProgressData), CancellationToken, Task), Optional delayToShowDialog As Nullable(Of TimeSpan) = Nothing)

Parameters

joinableTaskFactory
JoinableTaskFactory

The factory to use for creating the task.

waitCaption
String

The title of the wait dialog, when and if it appears.

asyncMethod
Func<IProgress<ThreadedWaitDialogProgressData>,CancellationToken,Task>

The operation which would otherwise be async but is blocking the UI thread in this scenario. A means of updating the wait dialog's progress display, and a CancellationToken signaling user cancellation are provided.

delayToShowDialog
Nullable<TimeSpan>

The time to wait for asyncMethod to complete before displaying the wait dialog. The default (null) is 2 seconds.

Exceptions

Thrown if not called on the UI thread.

Applies to

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.

public static void Run (this Microsoft.VisualStudio.Threading.JoinableTaskFactory joinableTaskFactory, string waitCaption, Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>,System.Threading.Tasks.Task> asyncMethod, TimeSpan? delayToShowDialog = default);
static member Run : Microsoft.VisualStudio.Threading.JoinableTaskFactory * string * Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>, System.Threading.Tasks.Task> * Nullable<TimeSpan> -> unit
<Extension()>
Public Sub Run (joinableTaskFactory As JoinableTaskFactory, waitCaption As String, asyncMethod As Func(Of IProgress(Of ThreadedWaitDialogProgressData), Task), Optional delayToShowDialog As Nullable(Of TimeSpan) = Nothing)

Parameters

joinableTaskFactory
JoinableTaskFactory

The factory to use for creating the task.

waitCaption
String

The title of the wait dialog, when and if it appears.

asyncMethod
Func<IProgress<ThreadedWaitDialogProgressData>,Task>

The operation which would otherwise be async but is blocking the UI thread in this scenario. A means of updating the wait dialog's progress display is provided.

delayToShowDialog
Nullable<TimeSpan>

The time to wait for asyncMethod to complete before displaying the wait dialog. The default (null) is 2 seconds.

Exceptions

Thrown if not called on the UI thread.

Applies to

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.

public static void Run (this Microsoft.VisualStudio.Threading.JoinableTaskFactory joinableTaskFactory, string waitCaption, string waitMessage, Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>,System.Threading.CancellationToken,System.Threading.Tasks.Task> asyncMethod, TimeSpan? delayToShowDialog = default);
static member Run : Microsoft.VisualStudio.Threading.JoinableTaskFactory * string * string * Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>, System.Threading.CancellationToken, System.Threading.Tasks.Task> * Nullable<TimeSpan> -> unit
<Extension()>
Public Sub Run (joinableTaskFactory As JoinableTaskFactory, waitCaption As String, waitMessage As String, asyncMethod As Func(Of IProgress(Of ThreadedWaitDialogProgressData), CancellationToken, Task), Optional delayToShowDialog As Nullable(Of TimeSpan) = Nothing)

Parameters

joinableTaskFactory
JoinableTaskFactory

The factory to use for creating the task.

waitCaption
String

The title of the wait dialog, when and if it appears.

waitMessage
String

The message inside the wait dialog, when and if it appears.

asyncMethod
Func<IProgress<ThreadedWaitDialogProgressData>,CancellationToken,Task>

The operation which would otherwise be async but is blocking the UI thread in this scenario.

delayToShowDialog
Nullable<TimeSpan>

The time to wait for asyncMethod to complete before displaying the wait dialog. The default (null) is 2 seconds.

Exceptions

Thrown if not called on the UI thread.

Applies to

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.

public static void Run (this Microsoft.VisualStudio.Threading.JoinableTaskFactory joinableTaskFactory, string waitCaption, string waitMessage, Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>,System.Threading.Tasks.Task> asyncMethod, TimeSpan? delayToShowDialog = default);
static member Run : Microsoft.VisualStudio.Threading.JoinableTaskFactory * string * string * Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>, System.Threading.Tasks.Task> * Nullable<TimeSpan> -> unit
<Extension()>
Public Sub Run (joinableTaskFactory As JoinableTaskFactory, waitCaption As String, waitMessage As String, asyncMethod As Func(Of IProgress(Of ThreadedWaitDialogProgressData), Task), Optional delayToShowDialog As Nullable(Of TimeSpan) = Nothing)

Parameters

joinableTaskFactory
JoinableTaskFactory

The factory to use for creating the task.

waitCaption
String

The title of the wait dialog, when and if it appears.

waitMessage
String

The message inside the wait dialog, when and if it appears.

asyncMethod
Func<IProgress<ThreadedWaitDialogProgressData>,Task>

The operation which would otherwise be async but is blocking the UI thread in this scenario.

delayToShowDialog
Nullable<TimeSpan>

The time to wait for asyncMethod to complete before displaying the wait dialog. The default (null) is 2 seconds.

Exceptions

Thrown if not called on the UI thread.

Applies to

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.

public static T Run<T> (this Microsoft.VisualStudio.Threading.JoinableTaskFactory joinableTaskFactory, string waitCaption, string waitMessage, Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>,System.Threading.CancellationToken,System.Threading.Tasks.Task<T>> asyncMethod, TimeSpan? delayToShowDialog = default);
static member Run : Microsoft.VisualStudio.Threading.JoinableTaskFactory * string * string * Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>, System.Threading.CancellationToken, System.Threading.Tasks.Task<'T>> * Nullable<TimeSpan> -> 'T
<Extension()>
Public Function Run(Of T) (joinableTaskFactory As JoinableTaskFactory, waitCaption As String, waitMessage As String, asyncMethod As Func(Of IProgress(Of ThreadedWaitDialogProgressData), CancellationToken, Task(Of T)), Optional delayToShowDialog As Nullable(Of TimeSpan) = Nothing) As T

Type Parameters

T

The return type of the async operation.

Parameters

joinableTaskFactory
JoinableTaskFactory

The factory to use for creating the task.

waitCaption
String

The title of the wait dialog, when and if it appears.

waitMessage
String

The message inside the wait dialog, when and if it appears.

asyncMethod
Func<IProgress<ThreadedWaitDialogProgressData>,CancellationToken,Task<T>>

The operation which would otherwise be async but is blocking the UI thread in this scenario.

delayToShowDialog
Nullable<TimeSpan>

The time to wait for asyncMethod to complete before displaying the wait dialog. The default (null) is 2 seconds.

Returns

T

The result of asyncMethod.

Applies to

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.

public static T Run<T> (this Microsoft.VisualStudio.Threading.JoinableTaskFactory joinableTaskFactory, string waitCaption, string waitMessage, Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>,System.Threading.Tasks.Task<T>> asyncMethod, TimeSpan? delayToShowDialog = default);
static member Run : Microsoft.VisualStudio.Threading.JoinableTaskFactory * string * string * Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>, System.Threading.Tasks.Task<'T>> * Nullable<TimeSpan> -> 'T
<Extension()>
Public Function Run(Of T) (joinableTaskFactory As JoinableTaskFactory, waitCaption As String, waitMessage As String, asyncMethod As Func(Of IProgress(Of ThreadedWaitDialogProgressData), Task(Of T)), Optional delayToShowDialog As Nullable(Of TimeSpan) = Nothing) As T

Type Parameters

T

The return type of the async operation.

Parameters

joinableTaskFactory
JoinableTaskFactory

The factory to use for creating the task.

waitCaption
String

The title of the wait dialog, when and if it appears.

waitMessage
String

The message inside the wait dialog, when and if it appears.

asyncMethod
Func<IProgress<ThreadedWaitDialogProgressData>,Task<T>>

The operation which would otherwise be async but is blocking the UI thread in this scenario.

delayToShowDialog
Nullable<TimeSpan>

The time to wait for asyncMethod to complete before displaying the wait dialog. The default (null) is 2 seconds.

Returns

T

The result of asyncMethod.

Applies to

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.

public static T Run<T> (this Microsoft.VisualStudio.Threading.JoinableTaskFactory joinableTaskFactory, string waitCaption, Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>,System.Threading.Tasks.Task<T>> asyncMethod, TimeSpan? delayToShowDialog = default);
static member Run : Microsoft.VisualStudio.Threading.JoinableTaskFactory * string * Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>, System.Threading.Tasks.Task<'T>> * Nullable<TimeSpan> -> 'T
<Extension()>
Public Function Run(Of T) (joinableTaskFactory As JoinableTaskFactory, waitCaption As String, asyncMethod As Func(Of IProgress(Of ThreadedWaitDialogProgressData), Task(Of T)), Optional delayToShowDialog As Nullable(Of TimeSpan) = Nothing) As T

Type Parameters

T

The return type of the async operation.

Parameters

joinableTaskFactory
JoinableTaskFactory

The factory to use for creating the task.

waitCaption
String

The title of the wait dialog, when and if it appears.

asyncMethod
Func<IProgress<ThreadedWaitDialogProgressData>,Task<T>>

The operation which would otherwise be async but is blocking the UI thread in this scenario. A means of updating the wait dialog's progress display is provided.

delayToShowDialog
Nullable<TimeSpan>

The time to wait for asyncMethod to complete before displaying the wait dialog. The default (null) is 2 seconds.

Returns

T

The result of asyncMethod.

Applies to

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.

public static T Run<T> (this Microsoft.VisualStudio.Threading.JoinableTaskFactory joinableTaskFactory, string waitCaption, Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>,System.Threading.CancellationToken,System.Threading.Tasks.Task<T>> asyncMethod, TimeSpan? delayToShowDialog = default);
static member Run : Microsoft.VisualStudio.Threading.JoinableTaskFactory * string * Func<IProgress<Microsoft.VisualStudio.Shell.ThreadedWaitDialogProgressData>, System.Threading.CancellationToken, System.Threading.Tasks.Task<'T>> * Nullable<TimeSpan> -> 'T
<Extension()>
Public Function Run(Of T) (joinableTaskFactory As JoinableTaskFactory, waitCaption As String, asyncMethod As Func(Of IProgress(Of ThreadedWaitDialogProgressData), CancellationToken, Task(Of T)), Optional delayToShowDialog As Nullable(Of TimeSpan) = Nothing) As T

Type Parameters

T

The return type of the async operation.

Parameters

joinableTaskFactory
JoinableTaskFactory

The factory to use for creating the task.

waitCaption
String

The title of the wait dialog, when and if it appears.

asyncMethod
Func<IProgress<ThreadedWaitDialogProgressData>,CancellationToken,Task<T>>

The operation which would otherwise be async but is blocking the UI thread in this scenario. A means of updating the wait dialog's progress display, and a CancellationToken signaling user cancellation are provided.

delayToShowDialog
Nullable<TimeSpan>

The time to wait for asyncMethod to complete before displaying the wait dialog. The default (null) is 2 seconds.

Returns

T

The result of asyncMethod.

Applies to