/// <summary> /// called when the task is started. allows setup/cleanup to occur and delays to be used /// </summary> public virtual void taskStarted() { resetState(); // if we are delayed then set ourself as paused then unpause after the delay if( delay > 0 ) { state = P31TaskState.Paused; var delayInMilliseconds = (int)( delay * 1000 ); new System.Threading.Timer( obj => { lock( this ) { state = P31TaskState.Running; } }, null, delayInMilliseconds, System.Threading.Timeout.Infinite ); } else { // start immediately state = P31TaskState.Running; } }
/// <summary> /// called when the task is started. allows setup/cleanup to occur and delays to be used /// </summary> public virtual void taskStarted() { resetState(); // if we are delayed then set ourself as paused then unpause after the delay if (delay > 0) { state = P31TaskState.Paused; var delayInMilliseconds = (int)(delay * 1000); new System.Threading.Timer(obj => { lock (this) { state = P31TaskState.Running; } }, null, delayInMilliseconds, System.Threading.Timeout.Infinite); } else { // start immediately state = P31TaskState.Running; } }
public void unpause() { state = P31TaskState.Running; }
public void pause() { state = P31TaskState.Paused; }
/// <summary> /// cancelling a task stops it immediately and causes its nextTask to not be executed /// </summary> public void cancel() { state = P31TaskState.Canceled; }
/// <summary> /// reset all state before we start the task /// </summary> public virtual void resetState() { _elapsedTime = 0; state = P31TaskState.NotRunning; }
public void unpause() { state = P31TaskState.Running; }
/// <summary> /// reset all state before we start the task /// </summary> public virtual void resetState() { _elapsedTime = 0; state = P31TaskState.NotRunning; }
public void pause() { state = P31TaskState.Paused; }
/// <summary> /// cancelling a task stops it immediately and causes its nextTask to not be executed /// </summary> public void cancel() { state = P31TaskState.Canceled; }