public void Cancel() { if (State == TaskState.Running) { GotoState(RunningState.CancellationRequested); } }