void CAppWindow::ClientConnected(CONNECT_REASON nReason) { CHECK_ENUM(nReason, CR_MAX); switch (nReason) { case CR_SUSPEND: if (m_fClientSuspended) { m_lpSession->ForceReconnect(); m_fClientSuspended = FALSE; } break; case CR_LOCK: m_fClientLocked = FALSE; break; } if (!m_fClientSuspended && !m_fClientLocked) { if (!CNotifierApp::Instance()->GetConnected()) { CNotifierApp::Instance()->SetConnected(TRUE); } } }
LRESULT CAppWindow::OnVersionState(VERSION_STATE nState) { CHECK_ENUM(nState, VS_MAX); switch (nState) { case VS_DOWNLOADING: if (m_fManualUpdateCheck) { (new CMessagePopup(L"Downloading the latest version of Google Wave Notifier."))->Show(); m_fManualUpdateCheck = FALSE; } break; case VS_NONE: if (m_fManualUpdateCheck) { (new CMessagePopup(L"Your version of Google Wave Notifier is up to date."))->Show(); m_fManualUpdateCheck = FALSE; } m_lpVersionTimer->SetInterval(TIMER_VERSION_INTERVAL); m_lpVersionTimer->SetRunning(TRUE); break; case VS_AVAILABLE: SendMessage(WM_SYSCOMMAND, SC_CLOSE); break; } return 0; }
LRESULT CAppWindow::OnLoginStateChanged(WAVE_CONNECTION_STATE nStatus, WAVE_LOGIN_ERROR nError) { CHECK_ENUM(nStatus, WCS_MAX); CHECK_ENUM(nError, WLE_MAX); if (!AllowContextMenu()) { EndMenu(); } switch (nStatus) { case WCS_BEGIN_LOGON: case WCS_BEGIN_SIGNOUT: StartWorking(); break; case WCS_LOGGED_ON: StopWorking(); ProcessLoggedOn(); break; case WCS_RECONNECTING: StartWorking(); ProcessReconnecting(); break; case WCS_CONNECTED: StopWorking(); ProcessConnected(); break; case WCS_FAILED: StopWorking(); break; case WCS_SIGNED_OUT: StopWorking(); ProcessSignedOut(); break; } return 0; }
void CWaveSession::SignalProgress(WAVE_CONNECTION_STATE nStatus) { CHECK_ENUM(nStatus, WCS_MAX); for (TWindowHandleVectorIter iter = m_vSignalWindows.begin(); iter != m_vSignalWindows.end(); iter++) { ASSERT(*iter != NULL); (*iter)->PostMessage(WM_WAVE_CONNECTION_STATE, nStatus, m_nLoginError); } }
const char* OpenGLErrorString() { switch (glGetError()) { CHECK_ENUM(GL_INVALID_VALUE); CHECK_ENUM(GL_INVALID_ENUM); CHECK_ENUM(GL_INVALID_OPERATION); CHECK_ENUM(GL_STACK_OVERFLOW); CHECK_ENUM(GL_STACK_UNDERFLOW); CHECK_ENUM(GL_TABLE_TOO_LARGE); CHECK_ENUM(GL_INVALID_FRAMEBUFFER_OPERATION); CHECK_ENUM(GL_OUT_OF_MEMORY); CHECK_ENUM(GL_NO_ERROR); default: return "none"; } }
LRESULT CAppWindow::OnWaveConnectionState(WAVE_CONNECTION_STATE nState, LPARAM lParam) { CHECK_ENUM(nState, WCS_MAX); switch (nState) { case WCS_RECEIVED: ProcessResponse((CWaveResponse *)lParam); return 0; default: return OnLoginStateChanged(nState, (WAVE_LOGIN_ERROR)lParam); } }
LRESULT CAppWindow::OnCurlResponse(CURL_RESPONSE nState, LPARAM lParam) { CHECK_ENUM(nState, CR_MAX); switch (nState) { case CR_DATA_RECEIVED: return ProcessCurlDataReceived((LPCURL_DATA_RECEIVED)lParam); case CR_COMPLETED: return ProcessCurlCompleted((CCurl *)lParam); default: LOG1("Unknown CURL_RESPONSE state %d", nState); return 0; } }
void CAppWindow::ClientDisconnected(CONNECT_REASON nReason) { CHECK_ENUM(nReason, CR_MAX); switch (nReason) { case CR_SUSPEND: m_fClientSuspended = TRUE; break; case CR_LOCK: m_fClientLocked = TRUE; break; } if (CNotifierApp::Instance()->GetConnected()) { CNotifierApp::Instance()->SetConnected(FALSE); } }