本文整理汇总了C#中ITask.AddCancelledCallback方法的典型用法代码示例。如果您正苦于以下问题:C# ITask.AddCancelledCallback方法的具体用法?C# ITask.AddCancelledCallback怎么用?C# ITask.AddCancelledCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITask
的用法示例。
在下文中一共展示了ITask.AddCancelledCallback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TaskViewModel
protected TaskViewModel(ILogger logger, ITask task, string name, string description, object icon)
{
if (logger == null)
throw new ArgumentNullException("logger");
if (task == null)
throw new ArgumentNullException("task");
if (name == null)
throw new ArgumentNullException("name");
if (description == null)
throw new ArgumentNullException("description");
if (icon == null)
throw new ArgumentNullException("icon");
this.logger = logger;
this.task = task;
this.name = name;
this.description = description;
this.icon = icon;
task.AddStoppedCallback(() => OnStopped());
task.AddCancelledCallback(() => OnCancelled());
task.AddCompletedCallback(() => OnCompleted());
task.AddErrorCallback(error => OnError(error));
task.AddFailedCallback(() => OnFailed());
task.AddPausedCallback(() => OnPaused());
task.AddProgressCallback(progress => OnProgressChanged(progress));
task.AddItemChangedCallback(item => OnItemChanged(item));
task.AddResumedCallback(() => OnResumed());
task.AddStartedCallback(() => OnStarted());
}