void CSearchBussinessPartnerPage::OnQueryPartner() { m_pBtnQuery->SetEnabled(false); if (!m_strFindPhoneNo.empty()) { CMsgBox* pMsgBox = new CMsgBox("查找", "正在查找......", MSGBOX_ICON_WARNING); pMsgBox->ShowModal(this->GetHWND()); return; } CEditUI* pUsername = static_cast<CEditUI*>(m_PaintManager.FindControl(edit_phone)); m_strFindPhoneNo = pUsername->GetText().GetData(); if (m_strFindPhoneNo.empty()) { CMsgBox* pMsgBox = new CMsgBox("查找", "请输入手机号", MSGBOX_ICON_WARNING); pMsgBox->ShowModal(this->GetHWND()); m_pBtnQuery->SetEnabled(true); return; } if (!CRegexHelper::IsValidMobileNo(m_strFindPhoneNo.c_str())) { CMsgBox* pMsgBox = new CMsgBox("查找", "输入的手机号码格式错误", MSGBOX_ICON_WARNING); pMsgBox->ShowModal(this->GetHWND()); m_strFindPhoneNo.clear(); m_pBtnQuery->SetEnabled(true); return; } if (CWebClient::IsValidUser(m_strFindPhoneNo)) { CController::Instance()->GetUserInfoMgr()->FetchVCardByAccount(m_strFindPhoneNo); } else { ClearSearchResult(); CMsgBox* pMsgBox = new CMsgBox("查找联系人", "该用户还不是平台用户,是否需要邀请其加入平台?", MSGBOX_ICON_ASK, MSGBOX_IDYES|MSGBOX_IDNO); if (MSGBOX_IDYES == pMsgBox->ShowModal(this->GetHWND())) { tstring strErrDes; if (CWebClient::InviteBussinessParter(m_strFindPhoneNo, strErrDes)) { CMsgBox* pMsgBox = new CMsgBox("添加商业伙伴", "添加商业伙伴成功"); pMsgBox->ShowModal(); } } m_strFindPhoneNo.clear(); m_pBtnQuery->SetEnabled(true); } }
virtual void Execute() { if (!WindowInfoStillValid(win)) return; if (win->findThread != thread) { // Race condition: FindTextOnThread/AbortFinding was // called after the previous find thread ended but // before this FindEndTask could be executed return; } if (!win->IsDocLoaded()) { // the UI has already been disabled and hidden } else if (textSel) { ShowSearchResult(*win, textSel, wasModifiedCanceled); ftd->HideUI(true, loopedAround); } else { // nothing found or search canceled ClearSearchResult(win); ftd->HideUI(false, !wasModifiedCanceled); } win->findThread = NULL; }