示例#1
0
        public void DoorOpened()
        {
            switch (_state)
            {
            case (DoorState.DoorOpening):
                _door.Close();
                _state = DoorState.DoorOpen;
                break;

            case (DoorState.DoorClosed):
                _door.Close();
                _state = DoorState.DoorBreached;
                _alarm.SignalAlarm();
                break;
            }
        }
示例#2
0
        public void HandleDoorOpenedEvent(object source, DoorOpenedEventArgs args)
        {
            switch (_currentState)
            {
            case DoorStates.DoorOpening:
                _door.Close();
                _currentState = DoorStates.DoorOpen;
                break;

            case DoorStates.DoorClosed:
                _door.Close();
                _alarm.SignalAlarm();
                _currentState = DoorStates.DoorBreached;
                break;
            }
        }
示例#3
0
        public void Hej()
        {
            var id = "";

            switch (_state)
            {
            case DoorControlState.Closed:
                if (RequestEntry(id))
                {
                    _door.Open();
                    _entry.NotifyEntryGranted();
                    _state = DoorControlState.Opening;
                }
                if (RequestEntry(id) == false)
                {
                    _entry.NotifyEntryDenied();
                    _state = DoorControlState.Closed;
                }
                else if (RequestEntry(id) == false && DoorOpen)
                {
                    _door.Close();
                    _alarm.SignalAlarm();
                }
                break;

            case DoorControlState.Opening:
                DoorOpened();
                //_door.Close();
                _state = DoorControlState.Closing;
                break;

            case DoorControlState.Closing:
                _door.Close();
                DoorClosed();
                _state = DoorControlState.Closed;
                break;
            }
        }