Exemple #1
0
        public RegulatorEventHandler OnData(Type dataType)
        {
            if (_OnDataHandlers.ContainsKey(dataType))
            {
                return(_OnDataHandlers[dataType]);
            }

            var result = new RegulatorEventHandler(this.Regulator, this);

            _OnDataHandlers.Add(dataType, result);
            return(result);
        }
Exemple #2
0
        public RegulatorEventHandler OnTransitionTo(string state)
        {
            var evt = new RegulatorEventHandler(this, null);

            this.OnTransition += (string newState, object data) =>
            {
                if (newState == state)
                {
                    evt.Invoke(data);
                }
            };

            return(evt);
        }