void CGeneralPage::UpdateUnitDeviceData(ndas::UnitDevice* pUnitDevice) { pUnitDevice->UpdateStatus(); pUnitDevice->UpdateInfo(); pUnitDevice->UpdateHostStats(); const NDAS_UNITDEVICE_HW_INFORMATION* pHWI = pUnitDevice->GetHWInfo(); CString str; str.Format(_T("%d"), pUnitDevice->GetROHostCount()); // hwi.nROHosts); m_edtUnitDevROHosts.SetWindowText(str); str.Format(_T("%d"), pUnitDevice->GetRWHostCount()); // hwi.nRWHosts); m_edtUnitDevRWHosts.SetWindowText(str); if (NULL != pHWI) { pCapacityString(str, pHWI->SectorCountLowPart, pHWI->SectorCountHighPart); m_edtUnitDevCapacity.SetWindowText(str); } NDAS_UNITDEVICE_TYPE type = pUnitDevice->GetType(); NDAS_UNITDEVICE_SUBTYPE subType = pUnitDevice->GetSubType(); CString strType; pUnitDeviceTypeString(strType, type, subType); m_edtUnitDevType.SetWindowText(strType); if (NDAS_UNITDEVICE_TYPE_CDROM == type) { m_hUnitDevIcon = LoadIcon( _Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_CD_DRIVE)); m_wndUnitDevIcon.SetIcon(m_hUnitDevIcon); } else if (NDAS_UNITDEVICE_TYPE_DISK == type) { m_hUnitDevIcon = LoadIcon( _Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_DISK_DRIVE)); m_wndUnitDevIcon.SetIcon(m_hUnitDevIcon); } else { // no icon will show } NDAS_UNITDEVICE_STATUS status = pUnitDevice->GetStatus(); CString strStatus; pUnitDeviceStatusString(strStatus, status); m_edtUnitDevStatus.SetWindowText(strStatus); }
void CNdasDevicePropGeneralPage::_SetCurUnitDevice(int n) { ATLASSERT(static_cast<size_t>(n) < m_pUnitDevices.size()); if (static_cast<size_t>(n) < m_pUnitDevices.size()) { ndas::UnitDevicePtr pUnitDevice = m_pUnitDevices.at(n); m_pUnitDevices[n] = pUnitDevice; m_curUnitDevice = n; // Type if (1 == m_pUnitDevices.size()) { NDAS_UNITDEVICE_TYPE type = pUnitDevice->GetType(); NDAS_UNITDEVICE_SUBTYPE subType = pUnitDevice->GetSubType(); CString strType; pUnitDeviceTypeString(strType, type, subType); m_wndUnitDeviceType.SetWindowText(strType); } else { // m_wndUnitDeviceList will show this m_wndUnitDeviceType.SetWindowText(_T("")); } // Status NDAS_UNITDEVICE_STATUS status = pUnitDevice->GetStatus(); NDAS_UNITDEVICE_ERROR error = pUnitDevice->GetNdasUnitError(); CString strStatus; pUnitDeviceStatusString(strStatus, status, error); m_wndUnitDeviceStatus.SetWindowText(strStatus); // Capacity const NDAS_UNITDEVICE_HARDWARE_INFO* pudinfo = pUnitDevice->GetHWInfo(); if (NULL != pudinfo) { CString str = pBlockCapacityString( pudinfo->SectorCount.LowPart, pudinfo->SectorCount.HighPart); m_wndUnitDeviceCapacity.SetWindowText(str); } // // Image List contains the following images // // 0: Disk // 1: DVD // 2: CD-ROM // NDAS_UNITDEVICE_TYPE type = pUnitDevice->GetType(); if (NDAS_UNITDEVICE_TYPE_DISK == type) { m_wndUnitDeviceIcon.SetIcon(m_imageList.GetIcon(0)); } else if (NDAS_UNITDEVICE_TYPE_CDROM == type) { m_wndUnitDeviceIcon.SetIcon(m_imageList.GetIcon(2)); } else { // no icon will show } if (m_unitDeviceUpdated[n]) { CString str; str.Format(_T("%d"), pUnitDevice->GetROHostCount()); if (m_wndUnitDeviceROHosts.IsWindow()) { m_wndUnitDeviceROHosts.SetWindowText(str); } str.Format(_T("%d"), pUnitDevice->GetRWHostCount()); if (m_wndUnitDeviceRWHosts.IsWindow()) { m_wndUnitDeviceRWHosts.SetWindowText(str); } } _UpdateLogDeviceData(pUnitDevice); } }