void COrderManageDlg::OnNewCustomer(const CString& strCustomer)
{
	DuiLib::CDialogBuilder builder;
	DuiLib::CControlUI* pControl = builder.Create(_T("item_list_label_element.xml"));
	if (pControl == NULL)
	{
		return;
	}

	pControl->SetText(strCustomer);
	m_pCustomerCombo->Add(pControl);
	m_pCustomerCombo->SelectItem(m_pCustomerCombo->GetCount()-1);
	m_pNoCustomerContainer->SetVisible(false);	
}
void COrderManageDlg::AddGroup(DuiLib::CContainerUI* pContainer, int nGroupID)
{
	DuiLib::CDialogBuilder builder;
	DuiLib::CControlUI* pControl = builder.Create(_T("item_group.xml"), NULL, NULL, &m_pm);
	if (pControl == NULL)
	{
		return;
	}

	CCodeGroup group(nGroupID);
	pControl->SetText(group.Name());
	pControl->SetTag(nGroupID);  //group id保存在此
	pContainer->Add(pControl);	
}
DuiLib::CControlUI* COrderManageDlg::AddCode(int nCode)
{
	DuiLib::CDialogBuilder builder;
	DuiLib::CControlUI* pControl = builder.Create(_T("item_code.xml"), NULL, NULL, &m_pm);
	if (pControl == NULL)
	{
		return NULL;
	}

	if (nCode < 49)
	{
		m_pCodeContainer->Add(pControl);
	}
	else  //号码49放在最后一排
	{
		m_pLastCodeContainer->Add(pControl);
	}		

	//号码显示名称
	CCode code;
	code.SetCode(nCode);		
	CString strName;
	strName.Format(_T("%02d%s"), nCode, code.GetShengXiao());

	//设置号码名称、颜色及值
	DuiLib::CLabelUI* pCodeName = (DuiLib::CLabelUI*)m_pm.FindSubControlByName(pControl, _T("nameLabel"));
	DuiLib::CEditUI* pCodeMoney = (DuiLib::CEditUI*)m_pm.FindSubControlByName(pControl, _T("moneyEdit"));
	pCodeName->SetText(strName);		
	if (code.IsRed())
	{
		pCodeName->SetTextColor(0xffff0000);
	}
	else if (code.IsGreen())
	{
		pCodeName->SetTextColor(0xff6e9c08);
	}
	else if (code.IsBlue())
	{
		pCodeName->SetTextColor(0xff0000ff);
	}

	pCodeMoney->SetTag(nCode);  //号码储存在此
	
	return pCodeMoney;
}
示例#4
0
void ui::OnFreshenDNSInfo()
{
    m_p_last_selected_dns_item = nullptr;
    m_orgin_dns_item_color = 0xFFFFFFFF;
    m_p_dns_info_list->RemoveAll();
    m_map_dns_item_ip.clear();

    EnableUserOperation(false);
    std::thread(
        [this]()
    {
        std::shared_ptr<freshen_dns_info_result_data> sp_res_data = std::make_shared<freshen_dns_info_result_data>();
        result res = m_p_notifyer->on_freshen_dns_info(*sp_res_data.get());
        if (res != result_success)
        {
            showerror("Ë¢ÐÂDNSʧ°Ü-->[%s]", result_string(res));
            EnableUserOperation(true);
            return;
        }
        post_call(
            [this, sp_res_data]()
        {
            showlog("Ë¢ÐÂDNSÁбíºÄʱ[%ws]", sp_res_data->_str_freshen_take_time.c_str());
            for (auto it : sp_res_data->_vec_ip_dns_info)
            {
                ui_dns_info& info = it;

                DuiLib::CDialogBuilder builder;
                DuiLib::CListContainerElementUI* p_item = static_cast<DuiLib::CListContainerElementUI*>(builder.Create(_T("dns_info_item.xml"), (UINT)0, NULL, &m_PaintManager));
                Assert(p_item != nullptr);

                if (m_orgin_dns_item_color == 0xFFFFFFFF)
                {
                    m_orgin_dns_item_color = p_item->GetBkColor();
                }

                DuiLib::CLabelUI* p_dns_vip_label = static_cast<DuiLib::CLabelUI*>(p_item->FindSubControl(_T("dns_vip_label")));
                Assert(p_dns_vip_label != nullptr);
                DuiLib::CLabelUI* p_dns_uptime_label = static_cast<DuiLib::CLabelUI*>(p_item->FindSubControl(_T("dns_uptime_label")));
                Assert(p_dns_uptime_label != nullptr);
                DuiLib::CLabelUI* p_dns_ping_t_ms_label = static_cast<DuiLib::CLabelUI*>(p_item->FindSubControl(_T("dns_ping_t_ms_label")));
                Assert(p_dns_ping_t_ms_label != nullptr);

                p_dns_vip_label->SetText(info._str_vip.c_str());
                p_dns_uptime_label->SetText(info._str_uptime.c_str());
                p_dns_ping_t_ms_label->SetText(info._str_ping_t_ms.c_str());

                m_p_dns_info_list->Add(p_item);
                m_map_dns_item_ip.insert(std::make_pair(p_item, info._str_vip));
            }

            EnableUserOperation(true);
        }
        );
    }
    ).detach();
}
void COrderManageDlg::InitCustomer()
{
	m_pCustomerCombo->RemoveAll();
	vector<CUSTOMER> customerVec = CCustomerManager::Instance()->GetCustomerList();
	for (vector<CUSTOMER>::const_iterator it=customerVec.begin(); it!=customerVec.end(); it++)
	{
		DuiLib::CDialogBuilder builder;
		DuiLib::CControlUI* pControl = builder.Create(_T("item_list_label_element.xml"));
		if (pControl == NULL)
		{
			continue;
		}

		pControl->SetText(it->strName);
		m_pCustomerCombo->Add(pControl);
	}

	m_pCustomerCombo->SelectItem(0);
	m_pNoCustomerContainer->SetVisible(customerVec.size()<=0);
}