Exemple #1
0
        private void OnControllerStateChanged(object sender, IOBoardStateChangedEventArgs e)
        {
            bool oldState = e.OldState.GetBit(Number);
            bool newState = e.NewState.GetBit(Number);

            if (oldState == newState)
            {
                return;
            }

            BinaryState state = Read();

            StateChanged?.Invoke(this, new BinaryStateChangedEventArgs(state));
        }
        private void OnControllerStateChanged(object sender, IOBoardStateChangedEventArgs e)
        {
            bool oldState = e.OldState.GetBit(Number);
            bool newState = e.NewState.GetBit(Number);

            if (oldState == newState)
            {
                return;
            }

            BinaryState newBinaryState = Read();
            BinaryState oldBinaryState = BinaryState.High;
            if (newBinaryState == BinaryState.High)
            {
                oldBinaryState = BinaryState.Low;
            }

            StateChanged?.Invoke(this, new BinaryStateChangedEventArgs(oldBinaryState, newBinaryState));
        }