void CNdasDevicePropGeneralPage::_InitData() { // // Device Properties // _UpdateDeviceData(); // // Unit Device Properties // m_pUnitDevices = m_pDevice->GetUnitDevices(); DWORD nUnitDevices = m_pUnitDevices.size(); if (0 == nUnitDevices) { m_wndUnitDeviceType.SetWindowText(_T("")); _ShowUnitDeviceControls(SW_HIDE); m_wndNA.ShowWindow(SW_SHOW); m_wndUnitDeviceList.ShowWindow(SW_HIDE); } else { m_wndNA.ShowWindow(SW_HIDE); _ShowUnitDeviceControls(SW_SHOW); m_wndUnitDeviceList.ShowWindow((nUnitDevices == 1) ? SW_HIDE : SW_SHOW); m_wndUnitDeviceType.ShowWindow((nUnitDevices == 1) ? SW_SHOW : SW_HIDE); // Initiate Unit Device Information Update (async) m_unitDeviceUpdated.resize(m_pUnitDevices.size(), false); ATLASSERT(0 == m_ThreadCount); ATLASSERT(WAIT_OBJECT_0 == WaitForSingleObject(m_ThreadCompleted, 0)); ATLVERIFY(ResetEvent(m_ThreadCompleted)); std::for_each( m_pUnitDevices.begin(), m_pUnitDevices.end(), UpdateUnitDeviceData(this)); std::for_each( m_pUnitDevices.begin(), m_pUnitDevices.end(), AddToComboBox(m_wndUnitDeviceList)); m_wndUnitDeviceList.SetCurSel(0); _SetCurUnitDevice(0); } }
void CDeviceGeneralPage::_InitData() { // // Device Properties // _UpdateDeviceData(); // // Unit Device Properties // m_pUnitDevices = m_pDevice->GetUnitDevices(); DWORD nUnitDevices = m_pUnitDevices.size(); if (0 == nUnitDevices) { m_wndUnitDeviceType.SetWindowText(_T("")); _ShowUnitDeviceControls(SW_HIDE); m_wndNA.ShowWindow(SW_SHOW); m_wndUnitDeviceList.ShowWindow(SW_HIDE); } else { m_wndNA.ShowWindow(SW_HIDE); _ShowUnitDeviceControls(SW_SHOW); m_wndUnitDeviceList.ShowWindow((nUnitDevices == 1) ? SW_HIDE : SW_SHOW); m_wndUnitDeviceType.ShowWindow((nUnitDevices == 1) ? SW_SHOW : SW_HIDE); // Initiate Unit Device Information Update (async) m_unitDeviceUpdated.resize(m_pUnitDevices.size(), false); std::for_each( m_pUnitDevices.begin(), m_pUnitDevices.end(), UpdateUnitDeviceData(this)); std::for_each( m_pUnitDevices.begin(), m_pUnitDevices.end(), AddToComboBox(m_wndUnitDeviceList)); m_wndUnitDeviceList.SetCurSel(0); _SetCurUnitDevice(0); } }
void CNdasDevicePropGeneralPage::OnCmdRefresh(UINT, int, HWND) { DWORD waitResult = WaitForSingleObject(m_ThreadCompleted, 0); if (WAIT_OBJECT_0 != waitResult) { return; } ATLASSERT(0 == m_ThreadCount); ATLVERIFY(ResetEvent(m_ThreadCompleted)); m_wndUnitDeviceROHosts.SetWindowText(_T("")); m_wndUnitDeviceRWHosts.SetWindowText(_T("")); std::for_each( m_pUnitDevices.begin(), m_pUnitDevices.end(), UpdateUnitDeviceData(this)); }
VOID CGeneralPage::UpdateData() { m_pDevice->UpdateStatus(); m_pDevice->UpdateInfo(); HCURSOR hWaitCursor = AtlLoadSysCursor(IDC_WAIT); HCURSOR hSavedCursor = SetCursor(hWaitCursor); m_edtDevName.SetWindowText(m_pDevice->GetName()); CString strDevId = m_pDevice->GetStringId(); CString strFmtDevId; m_edtDevId.SetWindowText( pCreateDelimitedDeviceId( strFmtDevId, strDevId, m_chConcealed)); if (GENERIC_WRITE & m_pDevice->GetGrantedAccess()) { CString str; str.LoadString(IDS_WRITE_KEY_PRESENT); m_edtDevWriteKey.SetWindowText(str); CString strButton; strButton.LoadString(IDS_REMOVE_WRITE_KEY); m_butAddRemoveDevWriteKey.SetWindowText(strButton); } else { CString str; str.LoadString(IDS_WRITE_KEY_NONE); m_edtDevWriteKey.SetWindowText(str); CString strButton; strButton.LoadString(IDS_ADD_WRITE_KEY); m_butAddRemoveDevWriteKey.SetWindowText(strButton); } CString strStatus; pDeviceStatusString(strStatus, m_pDevice->GetStatus(), m_pDevice->GetLastError()); m_edtDevStatus.SetWindowText(strStatus); DWORD nUnitDevs = m_pDevice->GetUnitDeviceCount(); if (0 == nUnitDevs) { CEdit wndEdit(GetDlgItem(IDC_UNITDEVICE_TYPE)); CString str; str.LoadString(IDS_UNITDEVICE_NONE); wndEdit.SetWindowText(str); } else if (1 == nUnitDevs) { ndas::UnitDevice* pUnitDev = m_pDevice->GetUnitDevice(0); UpdateUnitDeviceData(pUnitDev); GenerateLogDevTree(pUnitDev); pUnitDev->Release(); } else { // // TODO: Handle multiple unit devices // ndas::UnitDevice* pUnitDev = m_pDevice->GetUnitDevice(0); if (NULL != pUnitDev) { UpdateUnitDeviceData(pUnitDev); GenerateLogDevTree(pUnitDev); pUnitDev->Release(); } for (DWORD i = 1; i < nUnitDevs; ++i) { ndas::UnitDevice* pUnitDev = m_pDevice->GetUnitDevice(i); if (NULL != pUnitDev) { pUnitDev->UpdateStatus(); pUnitDev->UpdateInfo(); pUnitDev->UpdateHostStats(); pUnitDev->Release(); } } } SetCursor(hSavedCursor); }