/// <summary> /// Stop this activity immediately, and remove it from the activity scheduler. /// </summary> /// <remarks> /// The <see cref="TerminationBehavior">TerminationBehavior</see> determines when /// and if OnActivityStarted and OnActivityFinished get called. /// </remarks> /// <param name="terminationBehavior"></param> public virtual void Terminate(TerminationBehavior terminationBehavior) { if (scheduler != null) { scheduler.RemoveActivity(this); } switch (terminationBehavior) { case TerminationBehavior.TerminateWithoutFinishing: stepping = false; break; case TerminationBehavior.TerminateAndFinish: if (stepping) { stepping = false; OnActivityFinished(); } else { OnActivityStarted(); OnActivityFinished(); } break; case TerminationBehavior.TerminateAndFinishIfStepping: if (stepping) { stepping = false; OnActivityFinished(); } break; } }
/// <summary> /// Stop this activity immediately, and remove it from the activity scheduler. /// </summary> /// <remarks> /// The <see cref="TerminationBehavior">TerminationBehavior</see> determines when /// and if OnActivityStarted and OnActivityFinished get called. /// </remarks> /// <param name="terminationBehavior"></param> public virtual void Terminate(TerminationBehavior terminationBehavior) { if (scheduler != null) { scheduler.RemoveActivity(this); } switch (terminationBehavior) { case TerminationBehavior.TerminateWithoutFinishing: stepping = false; break; case TerminationBehavior.TerminateAndFinish: if (stepping) { stepping = false; OnActivityFinished(); } else { OnActivityStarted(); OnActivityFinished(); } break; case TerminationBehavior.TerminateAndFinishIfStepping: if (stepping) { stepping = false; OnActivityFinished(); } break; } }