Exemple #1
0
        internal BuilderTransitionDefinition <TInternalState> AddTransitionDefinitionToState <T1, TAsEvent>(Func <TInternalState, TAsEvent, bool> guard)
            where T1 : class
        {
            if (Handlers.Keys.Contains(typeof(T1)) == false)
            {
                Handlers.Add(typeof(T1), new ListOfHandlers());
            }

            var h = Handlers[typeof(T1)];

            var transDefinition = new BuilderTransitionDefinition <TInternalState>(TypedGuard <TAsEvent>, (s, o) => guard(s, (TAsEvent)o), null, null);

            h.TransistionDefinitions.Add(transDefinition);

            return(transDefinition);
        }
 public TransitionBuilder(BuilderTransitionDefinition <TInternalState> td, Func <State, BuilderState <TInternalState> > lookup)
 {
     _td     = td;
     _lookup = lookup;
 }