// 重新加载现场测道数据
void CSensorListCtrl::OnReloadSiteDataCMD()
{
    // 现场数据对象初始化
    OnSiteDataInit();

    matrix_data::data_base_helper::device_info_map& map = data_base_helper_->get_devices_info();
    matrix_data::data_base_helper::device_info_map::const_iterator itr;
    matrix_data::data_base_helper::device_info di;
    CBCGPGridRow* pRow = NULL;

    data_base_helper_->devices_info_lock();
    for(itr = map.begin(); itr != map.end(); ++itr) {

        pRow = FindRowByData(itr->second.ip_, FALSE);
        // 填充本次数据
        if(pRow != NULL) {
            SetRowData(pRow, itr->second);	// 设置一行的数据
        }
        else {
            pRow = CreateRow(GetColumnCount());
            SetRowData(pRow, itr->second);
            AddRow(pRow, FALSE);
        }
    }
    // 删除没有用到的行
    for(int i = (GetRowCount() - 1); i >= 0; i--) {
        pRow = GetRow(i);
        if(pRow != NULL) {	// 找到行
            di.ip_ = pRow->GetData();
            if(data_base_helper_->find_device(di.ip_, di))	RemoveRow(i, FALSE);
        }
    }
    data_base_helper_->devices_info_unlock();
    AdjustLayout ();
}
//Private
BOOL COXMultiComboBox::ChangeMasterColumn(int /* nCol */)
{
	int nNumItems = GetCount();
	CArray<COXRowData*,COXRowData*> aPtrsRowData; 

	aPtrsRowData.SetSize(nNumItems);
	int nIndex=0;
	for(nIndex=0; nIndex < nNumItems; nIndex++)
	{
		COXRowData* pRowData = GetRowData(nIndex);
		aPtrsRowData[nIndex] = pRowData;
		if (pRowData == NULL)
			TRACE0("In COXMultiComboBox::ChangeMasterColumn : GetRowData() returned NULL.\n");
	}

	// ... To avoid deleting the Rowdata in DeleteItem
	m_fMasterColumnChanging = TRUE; 
	// ... Delete all the Items
	ResetContent();		
	// ... Resets the flag
	m_fMasterColumnChanging = FALSE; 

	int nRetVal;
	//	Again add all the items. This deletion and addition is to effect 
	//	the sorting order based on current master column
	for(nIndex=0; nIndex < nNumItems; nIndex++)
	{
		if((nRetVal = CComboBox::AddString((aPtrsRowData[nIndex])->GetColumnString(m_nMasterColumn))) != CB_ERR)
			SetRowData(nRetVal,aPtrsRowData[nIndex]);
		else 
			return FALSE;
	}

	return TRUE;
}
int COXMultiComboBox::InsertString(int nIndex, LPCTSTR lpszString)
{
	int nRetVal;

	if((nRetVal = CComboBox::InsertString(nIndex,lpszString)) != CB_ERR)
	{
		COXRowData* pRowData = new COXRowData(m_nColumnCount);
		pRowData->SetColumnString(m_nMasterColumn,lpszString);
		SetRowData(nRetVal,pRowData);
		AdjustToFitSize();
	}
	return nRetVal;
}
// 加载现场测道数据队列
void CSensorListCtrl::OnLoadSiteDataAndFillToChannelList()
{
    // 现场数据对象初始化
    OnSiteDataInit();
    // 生成表格头
    CreateColumTitle();

    matrix_data::data_base_helper::device_info_map& map = data_base_helper_->get_devices_info();
    matrix_data::data_base_helper::device_info_map::const_iterator itr;
    CBCGPGridRow* pRow = NULL;

    data_base_helper_->devices_info_lock();
    for(itr = map.begin(); itr != map.end(); ++itr) {
        pRow = CreateRow(GetColumnCount());
        SetRowData(pRow, itr->second);
        AddRow(pRow, FALSE);
    }
    data_base_helper_->devices_info_unlock();
    AdjustLayout ();
}
int COXMultiComboBox::AddString(LPCTSTR* lpszString, int nNumStrings) 
{
	int nRetVal;

	// return CB_ERR if invalid number of strings
	if(nNumStrings > m_nColumnCount || nNumStrings < 1)
		return CB_ERR;

	// Adds the item with master column text
	if((nRetVal = CComboBox::AddString(lpszString[m_nMasterColumn])) != CB_ERR)
	{
		COXRowData* pRowData = new COXRowData(m_nColumnCount);
		// Initialize the column strings
		for(int nColIndex=0; nColIndex < nNumStrings; nColIndex++)
			pRowData->SetColumnString(nColIndex,lpszString[nColIndex]);
		SetRowData(nRetVal,pRowData);
		AdjustToFitSize();
	}

	return nRetVal;
}