// Eksempel på event handler for eventet "RFID Detected" fra tilstandsdiagrammet for klassen public void RfidDetected(object sender, RFIDEventArgs e) { switch (_state) { case ChargingCabinetState.Available: // Check for ladeforbindelse if (_chargeControl.IsConnected()) { _door.LockDoor(); _oldId = e.RFID; _logfile.WriteToLogLocked(_oldId); _display.ChargingCabinetTaken(); _state = ChargingCabinetState.Locked; _chargeControl.StartCharge(); } else { _display.ConnectionFail(); } break; case ChargingCabinetState.DoorOpen: { _display.CloseDoor(); } break; case ChargingCabinetState.Locked: // Check for correct ID if (e.RFID == _oldId) { _chargeControl.StopCharge(); _door.UnlockDoor(); _logfile.WriteToLogUnlocked(_oldId); _display.RemovePhone(); _state = ChargingCabinetState.Available; } else { _display.RFIDFail(); } break; } }