コード例 #1
0
void CreateDiscussionGrpDialog::_updateSearchResultList(IN const std::vector<std::string>& nameList)
{
	if (nameList.empty())
	{
		return;
	}
	for (std::string sid : nameList)
	{
		module::UserInfoEntity userInfo;
		if (!module::getUserListModule()->getUserInfoBySId(sid, userInfo))
		{
			LOG__(ERR, _T("can't find the userInfo:%s"), util::stringToCString(sid));
			return;
		}
		CDialogBuilder dlgBuilder;
		CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("CreateDiscussionGrpDialog\\ListGroupMembersItem.xml"), (UINT)0, NULL, &m_PaintManager);
		if (!pListElement)
		{
			LOG__(ERR, _T("群item创建失败"));
			return;
		}
		pListElement->SetName(_T("SearchResultItem"));
		CControlUI* pLogo = static_cast<CControlUI*>(pListElement->FindSubControl(_T("AvatarInfo")));
		if (!pLogo)
		{
			return;
		}
		pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath()));

		CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname")));
		if (!pNameLable)
		{
			return;
		}
		pNameLable->SetText(userInfo.getRealName());

		CButtonUI* pRemoveBtn = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("removebtn")));
		if (pRemoveBtn)
		{
			pRemoveBtn->SetVisible(false);
		}

		pListElement->SetUserData(util::stringToCString(userInfo.sId));

		m_pListSearchResult->Add(pListElement);
	}
}