/// <summary> /// Change state of the workflow. /// </summary> /// <param name="trigger"></param> public virtual void ChangeState(WorkflowTrigger <string> trigger) { workflowEngine.ChangeState(trigger); }
/// <summary> /// Can change the workflow state /// </summary> /// <param name="trigger"></param> /// <returns></returns> public virtual bool CanChangeState(WorkflowTrigger <string> trigger) { return(workflowEngine.CanChangeState(trigger)); }
/// <summary> /// Provides entry point to the transitions, can be used for logging /// </summary> /// <param name="source"></param> /// <param name="destination"></param> /// <param name="trigger"></param> /// <param name="reentery"></param> public virtual void WorkflowEngine_OnStateTransition(WorkflowState <string, T> source, WorkflowState <string, T> destination, WorkflowTrigger <string> trigger, bool reentery) { }
/// <summary> /// Adds a new trigger the collection. /// </summary> /// <param name="trigger">Trigger.</param> /// <remarks> /// To be added. /// </remarks> /// <exception cref="System.NotSupportedException">The current collection is read-only.</exception> public void Add(WorkflowTrigger <T> trigger) { Add(trigger.Id, trigger); }
/// <summary> /// Determines whether this workflow can change its state based on the trigger. /// /// </summary> /// <param name="trigger"></param> /// <returns></returns> public virtual bool CanChangeState(WorkflowTrigger <T> trigger) { Guard.ArgumentIsNotNull(trigger, nameof(trigger)); return(_stateMachine.CanFire(trigger)); }
/// <summary> /// Changes the current state to a new state. /// </summary> /// <param name="trigger"></param> public virtual void ChangeState(WorkflowTrigger <T> trigger) { Guard.ArgumentIsNotNull(trigger, nameof(trigger)); _stateMachine.Fire(trigger); }
/// <summary> /// Allows for the un-handled triggers to be tracked /// </summary> /// <param name="state"></param> /// <param name="trigger"></param> protected virtual void OnUnhandledTrigger(WorkflowState <T, TContext> state, WorkflowTrigger <T> trigger) { OnTriggerUnhandled?.Invoke(state, trigger); }