Exemple #1
0
        public void OnAction(object sender, ActionEventArgs e)
        {
            bool state = (bool)e.Info;

            if (state && !_State)
            {
                _State.OnChange(sender, true);
            }
            else if (!state && _State)
            {
                _State.OnChange(sender, false);
            }
            if (Action != null)
            {
                Action(sender, e);
            }
        }
Exemple #2
0
        public void OnAction(object sender, ActionEventArgs e)
        {
            e.Self = this;
            SwitchState state = (SwitchState)e.Info;

            if (state == SwitchState.Closed)
            {
                if (_State != SwitchState.Closed)
                {
                    _State.OnChange(sender, (SwitchState)e.Info);
                }
            }
            else if (_State == SwitchState.Closed)
            {
                //_LastSender = sender;
                _State.OnChange(sender, SwitchState.Latched);
                _LatchExpiration.OnChange(this, Math.Max(_LatchExpiration, _LatchTimer.Elapsed.TotalSeconds + _LatchTime));
                _LatchTimer.Start();
            }
            if (Action != null)
            {
                Action(sender, e);
            }
        }