public void Run() { while (true) { switch (state) { case State.PowerOff: // close everthing return; case State.UserSession: // if no active session cardReader.Read(); break; case State.PowerOn: cashManager.Recalculate(); break; } } }