bool DeviceManager::InvokeUserInteraction() { // Top level interaction is repeating loop while(true) { // Show the device menu for selected device and get user command int commandId = deviceUI->ManageDevice(deviceModel->GetName(),deviceModel->GetDeviceId()); // Select the appropriate option from user command switch(commandId){ case(0): PowerManagement(); break; case(1): CheckStatus(); break; case(2): ExecuteCommand(); break; case(3): // Exits the program return false; default: return true; } } }
void CWin32PowerStateWorker::Process(void) { while (!m_bStop) { if (AbortableWait(m_queryEvent, -1) == WAIT_SIGNALED) { PowerManagement(m_state.load()); m_state.exchange(POWERSTATE_NONE); m_queryEvent.Reset(); } } }