public static RunOnFinished ( this controller, Action |
||
controller | this | Required. |
onFinishedAction | Action |
Required. The action that will be invoked with the finished |
Результат | void |
public static void RunOnFinished(this IProgressEvents controller, Action<ProgressControllerResult> onFinishedAction)
{
if (controller == null)
{
throw new ArgumentNullException(nameof(controller));
}
if (onFinishedAction == null)
{
throw new ArgumentNullException(nameof(onFinishedAction));
}
EventHandler<ProgressControllerFinishedEventArgs> onFinished = null;
onFinished = (o, e) =>
{
controller.Finished -= onFinished;
onFinishedAction.Invoke(e.Result);
};
controller.Finished += onFinished;
}
}