コード例 #1
0
        /// <summary>
        /// Send an event within the current state
        /// </summary>
        /// <param name="raised">The event to raise</param>
        public virtual void RaiseEvent(Event raised)
        {
            BasicEvent <T> eevent = BasicEvent <T> .GetEvent(raised);

            _currentState.RaiseEvent(this as T, eevent, null);
            _anyState.RaiseEvent(this as T, eevent, null);
        }
コード例 #2
0
        private void BindEventAction(int all, int i, FastProperty <T, int> property)
        {
            var e      = _sources[i];
            var eevent = BasicEvent <T> .GetEvent(e);

            var eventAction = new BasicEventAction <T>(eevent);

            int flag = 1 << i;

            eventAction.Then(x =>
            {
                int value = property.Get(x) | flag;
                property.Set(x, value);

                if (value == all)
                {
                    x.RaiseEvent(_target);
                }
            });

            _bindEventAction(eventAction);
        }
コード例 #3
0
        /// <summary>
        /// Defines an actions to take when an event is raised within a state
        /// </summary>
        /// <param name="raised"></param>
        /// <returns></returns>
        protected static BasicEventAction <T> When(Event raised)
        {
            BasicEvent <T> eevent = BasicEvent <T> .GetEvent(raised);

            return(new BasicEventAction <T>(eevent));
        }