System.ComponentModel.Async.Cancel C# (CSharp) Method

Cancel() public method

Cancels the completion of the associated task.
public Cancel ( ) : void
return void
        public void Cancel()
        {
            if (CanCancel == false) {
                throw new InvalidOperationException();
            }

            CancelCore();
            _canceled = true;
            _completed = true;

            if (_completedHandler != null) {
                _completedHandler(this, EventArgs.Empty);
            }

            RaisePropertyChanged("IsCanceled", "CanCancel", "IsCompleted");
        }