//************************************ // 函数名称: OnFolderChanged // 返回类型: bool // 参数信息: void * param // 函数说明: //************************************ bool CTreeViewUI::OnFolderChanged( void* param ) { TNotifyUI* pMsg = (TNotifyUI*)param; if(pMsg->sType == DUI_MSGTYPE_SELECTCHANGED) { CCheckBoxUI* pFolder = (CCheckBoxUI*)pMsg->pSender; CTreeNodeUI* pItem = (CTreeNodeUI*)pFolder->GetParent()->GetParent(); pItem->SetVisibleTag(!pFolder->GetCheck()); SetItemExpand(!pFolder->GetCheck(),pItem); return TRUE; } return TRUE; }
//************************************ // 函数名称: OnFolderChanged // 返回类型: bool // 参数信息: void * param // 函数说明: //************************************ bool CTreeViewUI::OnFolderChanged( void* param ) { TNotifyUI* pMsg = (TNotifyUI*)param; if(pMsg->sType == _T("selectchanged")) { CCheckBoxUI* pFolder = (CCheckBoxUI*)pMsg->pSender; CTreeNodeUI* pItem = (CTreeNodeUI*)pFolder->GetParent()->GetParent(); pItem->SetVisibleTag(!pFolder->GetCheck()); SetItemExpand(!pFolder->GetCheck(),pItem); return true; } return true; }
//************************************ // 函数名称: OnDBClickItem // 返回类型: bool // 参数信息: void * param // 函数说明: //************************************ bool CTreeViewUI::OnDBClickItem( void* param ) { TNotifyUI* pMsg = (TNotifyUI*)param; if(_tcsicmp(pMsg->sType, DUI_MSGTYPE_TREEITEMDBCLICK) == 0) { CTreeNodeUI* pItem = static_cast<CTreeNodeUI*>(pMsg->pSender); CCheckBoxUI* pFolder = pItem->GetFolderButton(); pFolder->Selected(!pFolder->IsSelected()); pItem->SetVisibleTag(!pFolder->GetCheck()); SetItemExpand(!pFolder->GetCheck(),pItem); return TRUE; } return FALSE; }
//************************************ // 函数名称: OnDBClickItem // 返回类型: bool // 参数信息: void * param // 函数说明: //************************************ bool CTreeViewUI::OnDBClickItem( void* param ) { TNotifyUI* pMsg = (TNotifyUI*)param; if(pMsg->sType == _T("itemdbclick")) { CTreeNodeUI* pItem = static_cast<CTreeNodeUI*>(pMsg->pSender); CCheckBoxUI* pFolder = pItem->GetFolderButton(); pFolder->Selected(!pFolder->IsSelected()); pItem->SetVisibleTag(!pFolder->GetCheck()); SetItemExpand(!pFolder->GetCheck(),pItem); return true; } return false; }
//************************************ // 函数名称: OnCheckBoxChanged // 返回类型: bool // 参数信息: void * param // 函数说明: //************************************ bool CTreeViewUI::OnCheckBoxChanged( void* param ) { TNotifyUI* pMsg = (TNotifyUI*)param; if(pMsg->sType == _T("selectchanged")) { CCheckBoxUI* pCheckBox = (CCheckBoxUI*)pMsg->pSender; CTreeNodeUI* pItem = (CTreeNodeUI*)pCheckBox->GetParent()->GetParent(); SetItemCheckBox(pCheckBox->GetCheck(),pItem); return true; } return true; }
//************************************ // 函数名称: OnCheckBoxChanged // 返回类型: bool // 参数信息: void * param // 函数说明: //************************************ bool CTreeViewUI::OnCheckBoxChanged( void* param ) { TNotifyUI* pMsg = (TNotifyUI*)param; if(pMsg->sType == DUI_MSGTYPE_SELECTCHANGED) { CCheckBoxUI* pCheckBox = (CCheckBoxUI*)pMsg->pSender; CTreeNodeUI* pItem = (CTreeNodeUI*)pCheckBox->GetParent()->GetParent(); SetItemCheckBox(pCheckBox->GetCheck(),pItem); return TRUE; } return TRUE; }
/* void CLoginWindow::OnWebService(void *pRequest ,void *pProto) { url::CRequest *theRequest = (url::CRequest *)pRequest; LogonUserInfoT * theUser = static_cast<LogonUserInfoT*>(pProto); if(url::WSRT_LOGIN != theRequest->GetRequestType() && url::WSRT_WEBLOGIN != theRequest->GetRequestType()) return; CControlUI *pCtl = GetPaintMgr()->FindControl(_T("login")); CButtonUI *pLoginBtn = static_cast<CButtonUI*>(pCtl); if(theRequest->IsTimeOut()) { if(pLoginBtn) CInfoWindow::ShowInfoWindow(this->m_hWnd,pLoginBtn->GetPos(),_T("µÇ¼³¬Ê±£¬ÇëÖØÊÔ¡£")); EnableWindow(TRUE); return; } spLogonUserInfoT spLogonUserInfo(new LogonUserInfoT(*theUser)); if (!spLogonUserInfo) { if(pLoginBtn) CInfoWindow::ShowInfoWindow(this->m_hWnd,pLoginBtn->GetPos(),_T(" µÇ¼ʧ°Ü£¬Óû§Ãû»òÃÜÂë´íÎó! ")); EnableWindow(TRUE); return ; } { if(url::WSRT_WEBLOGIN != theRequest->GetRequestType()) { spLogonUserInfo->sLogonEmail = m_sUserName; spLogonUserInfo->sPasswordMD5 = m_sPasswordMd5; //spLogonUserInfo->bKeepLogged = !!m_isKeepLogin; }else { assert(!spLogonUserInfo->sLogonEmail.IsEmpty()); assert(!spLogonUserInfo->sPasswordMD5.IsEmpty()); //spLogonUserInfo->bKeepLogged = true; } CControlUI *pCheckBox = GetPaintMgr()->FindControl(_T("KeepLogin")); CCheckBoxUI *pKeepLogin = static_cast<CCheckBoxUI*>(pCheckBox); bool autoLogin = pKeepLogin->GetCheck(); // if (url::WSRT_WEBLOGIN == pRequest->GetRequestType()) // autoLogin = true; theConfigMgr->GetNormalConfig()->EnableAutoLogin(autoLogin); theConfigMgr->GetNormalConfig()->Save(); if(theDbMgr->GetGlobalDBase()->GetUserInfo(mci::unicode_2_utf8(spLogonUserInfo->sUserID).c_str())) theDbMgr->GetGlobalDBase()->UpdateUserInfo(spLogonUserInfo); else theDbMgr->GetGlobalDBase()->AddUserInfo(spLogonUserInfo); theRuntimeState->SetUserInfo(spLogonUserInfo); RECT rtWin; ::GetWindowRect(theMainWin->GetHWND(),&rtWin); POINT rtPos = {rtWin.left+25,rtWin.top+35}; ::ScreenToClient(theMainWin->GetHWND(),&rtPos); CInfoWindow::ShowInfoWindow(theMainWin->GetHWND(),rtPos,_T(" µÇ¼³É¹¦ ")); Close(IDOK); } // CurlData* pdata = (CurlData*)pRequest; // int* nRet = (int*)pProto; } */ void CLoginWindow::OnWebService(void *pRequest ,void *pProto) { CControlUI *pCtl = GetPaintMgr()->FindControl(_T("login")); CButtonUI *pLoginBtn = static_cast<CButtonUI*>(pCtl); CurlData* pdata = (CurlData*)pRequest; int* nRet = (int*)pProto; if (!pdata) { CInfoWindow::ShowInfoWindow(this->m_hWnd,pLoginBtn->GetPos(),_T(" µÇ¼ʧ°Ü£¬´íÎóÀàÐÍ[δ֪]! ")); EnableWindow(TRUE); return; } if(url::WSRT_LOGIN != pdata->n_type && url::WSRT_WEBLOGIN != pdata->n_type) { CInfoWindow::ShowInfoWindow(this->m_hWnd,pLoginBtn->GetPos(),_T(" µÇ¼ʧ°Ü£¬´íÎóÀàÐÍ[·ÇWSRT_LOGIN]! ")); EnableWindow(TRUE); return; } static CResponseParser2 Parser; std::string xmlbuf; xmlbuf.assign(pdata->buffer); // assert(!xmlbuf.empty()); std::string bufLog = mci::utf8_2_ansi(xmlbuf.c_str()); sLogWarn(bufLog.c_str()); //modify by dfn.li 2014-01-17 if(bufLog[0] == '?') { bufLog = bufLog.substr(1); } xmlbuf = mci::ansi_2_utf8(bufLog.c_str()); int t_begin = clock(); void *pResponse = NULL; pResponse = Parser.Parse(pdata->n_type,xmlbuf); int t_time = clock() - t_begin; LogonUserInfoT * theUser = static_cast<LogonUserInfoT*>(pResponse); if (!theUser) { if(pLoginBtn) CInfoWindow::ShowInfoWindow(this->m_hWnd,pLoginBtn->GetPos(),_T(" µÇ¼ʧ°Ü£¬Óû§Ãû»òÃÜÂë´íÎó! ")); EnableWindow(TRUE); return ; } // if(theRequest->IsTimeOut()) // { // if(pLoginBtn) // CInfoWindow::ShowInfoWindow(this->m_hWnd,pLoginBtn->GetPos(),_T("µÇ¼³¬Ê±£¬ÇëÖØÊÔ¡£")); // EnableWindow(TRUE); // return; // } spLogonUserInfoT spLogonUserInfo(new LogonUserInfoT(*theUser)); if (!spLogonUserInfo) { if(pLoginBtn) CInfoWindow::ShowInfoWindow(this->m_hWnd,pLoginBtn->GetPos(),_T(" µÇ¼ʧ°Ü£¬Óû§Ãû»òÃÜÂë´íÎó! ")); EnableWindow(TRUE); return ; } { if(url::WSRT_WEBLOGIN != pdata->n_type) { spLogonUserInfo->sLogonEmail = m_sUserName; spLogonUserInfo->sPasswordMD5 = m_sPasswordMd5; //spLogonUserInfo->bKeepLogged = !!m_isKeepLogin; }else { assert(!spLogonUserInfo->sLogonEmail.IsEmpty()); assert(!spLogonUserInfo->sPasswordMD5.IsEmpty()); //spLogonUserInfo->bKeepLogged = true; } CControlUI *pCheckBox = GetPaintMgr()->FindControl(_T("KeepLogin")); CCheckBoxUI *pKeepLogin = static_cast<CCheckBoxUI*>(pCheckBox); bool autoLogin = pKeepLogin->GetCheck(); // if (url::WSRT_WEBLOGIN == pRequest->GetRequestType()) // autoLogin = true; theConfigMgr->GetNormalConfig()->EnableAutoLogin(autoLogin); theConfigMgr->GetNormalConfig()->Save(); if(theDbMgr->GetGlobalDBase()->GetUserInfo(mci::unicode_2_utf8(spLogonUserInfo->sUserID).c_str())) theDbMgr->GetGlobalDBase()->UpdateUserInfo(spLogonUserInfo); else theDbMgr->GetGlobalDBase()->AddUserInfo(spLogonUserInfo); theRuntimeState->SetUserInfo(spLogonUserInfo); RECT rtWin; ::GetWindowRect(theMainWin->GetHWND(),&rtWin); POINT rtPos = {rtWin.left+25,rtWin.top+35}; ::ScreenToClient(theMainWin->GetHWND(),&rtPos); CInfoWindow::ShowInfoWindow(theMainWin->GetHWND(),rtPos,_T(" µÇ¼³É¹¦ ")); EnableWindow(TRUE); Close(IDOK); } }