コード例 #1
0
 public EventOptionOutcomes(String outcomename, String outcomeaction, String nexttransition, String passiveEvent)
 {
     thisOptionOutcome             = (OptionOutcome)Enum.Parse(typeof(OptionOutcome), outcomename);
     thisOptionOutcomeAction       = (OptionOutcomeAction)Enum.Parse(typeof(OptionOutcomeAction), outcomeaction);
     thisNextTransition            = (NextTransition)Enum.Parse(typeof(NextTransition), nexttransition);
     thisOutcomePassiveEventString = passiveEvent;
 }
コード例 #2
0
 /// <summary>
 /// Initiate the state transition and it's associated logic
 /// </summary>
 public override void Perform()
 {
     if (Condition())
     {
         base.Perform();
     }
     else if (NextTransition != null)
     {
         NextTransition.Perform();
     }
     else
     {
         throw new ConditionFailedException();
     }
 }
コード例 #3
0
 public override bool Validate(out TState newState)
 {
     //Evaluate the condition -- if satisifed, return true
     if (Condition())
     {
         newState = ToState;
         return(true);
     }
     //otherwise, walk out to the end of the linked list -- first condition to be satisifed returns true
     else if (NextTransition != null)
     {
         return(NextTransition.Validate(out newState));
     }
     //we are at the end of the chain and no conditions were satisifed, return false
     else
     {
         newState = FromState;
         return(false);
     }
 }