//Fill Volume Information private void driveListCombo_SelectedIndexChanged(object sender, EventArgs e) { int selInd = driveListCombo.SelectedIndex; dNameLbl.Text = allDrives[selInd].Name.ToString(); dTypeLbl.Text = allDrives[selInd].DriveType.ToString(); try { volLbl.Text = allDrives[selInd].VolumeLabel.ToString(); dFormatLbl.Text = allDrives[selInd].DriveFormat.ToString(); totSizeLbl.Text = ExtraDiskMeth.SizeSuffix(allDrives[selInd].TotalSize); totFreeLbl.Text = ExtraDiskMeth.SizeSuffix(allDrives[selInd].TotalFreeSpace); totAvaLbl.Text = ExtraDiskMeth.SizeSuffix(allDrives[selInd].AvailableFreeSpace); } catch (IOException ex) { volLbl.Text = "Volume Not Ready"; dFormatLbl.Text = "Volume Not Ready"; totAvaLbl.Text = "Volume Not Ready"; totFreeLbl.Text = "Volume Not Ready"; totSizeLbl.Text = "Volume Not Ready"; } if (allDrives[selInd].IsReady == true) { dStatLbl.Text = "On-Line"; dStatLbl.BackColor = Color.Green; } else { dStatLbl.Text = "Off-Line"; dStatLbl.BackColor = Color.Red; } }
// Retrieve Disk Detail through WMI private void phyDiskComBox_SelectedIndexChanged(object sender, EventArgs e) { ManagementObjectSearcher mos1 = wd.phyDiskInf(phyDiskComBox.SelectedItem.ToString()); ManagementObjectCollection moc = mos1.Get(); foreach (ManagementObject mo in moc) { lblSerial.Text = mo["SerialNumber"].ToString().Trim(); lblModel.Text = mo["Model"].ToString().Trim(); lblInterface.Text = mo["InterfaceType"].ToString(); lblCapacity.Text = ExtraDiskMeth.SizeSuffix(mo["Size"].ToString()); lblPartitions.Text = mo["Partitions"].ToString(); //lblSig.Text = mo["Signature"].ToString(); if (mo["FirmwareRevision"] == null) { lblFirmware.Text = "-"; } else { lblFirmware.Text = mo["FirmwareRevision"].ToString(); } lblCylinder.Text = mo["TotalCylinders"].ToString(); lblSectors.Text = mo["TotalSectors"].ToString(); lblHeads.Text = mo["TotalHeads"].ToString(); lblTracks.Text = mo["TotalTracks"].ToString(); lblBperSec.Text = mo["BytesPerSector"].ToString(); lblSecPerTrack.Text = mo["SectorsPerTrack"].ToString(); lblTrackPerCyl.Text = mo["TracksPerCylinder"].ToString(); } }
private void volumeListCombo_SelectedIndexChanged(object sender, EventArgs e) { int selInd = volumeListCombo.SelectedIndex; lblVolName.Text = allDrives[selInd].Name.ToString(); lblVolType.Text = allDrives[selInd].DriveType.ToString(); try { lblVolLbl.Text = allDrives[selInd].VolumeLabel.ToString(); lblVolFormat.Text = allDrives[selInd].DriveFormat.ToString(); lblVolSize.Text = ExtraDiskMeth.SizeSuffix(allDrives[selInd].TotalSize); lblVolFreeSpc.Text = ExtraDiskMeth.SizeSuffix(allDrives[selInd].TotalFreeSpace); lblVolAvaFreeSpc.Text = ExtraDiskMeth.SizeSuffix(allDrives[selInd].AvailableFreeSpace); } catch (IOException ex) { lblVolLbl.Text = "Volume Not Ready"; lblVolFormat.Text = "Volume Not Ready"; lblVolAvaFreeSpc.Text = "Volume Not Ready"; lblVolFreeSpc.Text = "Volume Not Ready"; lblVolSize.Text = "Volume Not Ready"; } if (allDrives[selInd].IsReady == true) { lblVolStatus.Text = "On-Line"; lblVolStatus.ForeColor = Color.LimeGreen; } else { lblVolStatus.Text = "Off-Line"; lblVolStatus.ForeColor = Color.Red; } }
private void phyDiskComBox_SelectedIndexChanged(object sender, EventArgs e) { DiskProperties diskProperties = wd.GetDiskProperties(phyDiskComBox.SelectedItem.ToString()); lblModel.Text = diskProperties.Model.Trim(); //lblCapacity.Text = diskProperties.Size.Trim(); lblCylinder.Text = diskProperties.TotalCylinders.Trim(); lblBperSec.Text = ExtraDiskMeth.SizeSuffix(diskProperties.BytesPerSector); lblSerial.Text = diskProperties.SerialNumber.Trim(); }
private void UpdateLables() { lblDiskReads.Text = Math.Round(diskDataValues.DiskReads, 2, MidpointRounding.AwayFromZero).ToString(); lblDiskWrites.Text = Math.Round(diskDataValues.DiskWrites, 2, MidpointRounding.AwayFromZero).ToString(); lblDiskTrans.Text = Math.Round(diskDataValues.DiskTransfers, 2, MidpointRounding.AwayFromZero).ToString(); lblDiskReadsBytes.Text = ExtraDiskMeth.SizeSuffix( Math.Round(diskDataValues.DiskReadsB, 2, MidpointRounding.AwayFromZero).ToString()); lblDiskWriteBytes.Text = ExtraDiskMeth.SizeSuffix( Math.Round(diskDataValues.DiskWritesB, 2, MidpointRounding.AwayFromZero).ToString()); lblDiskTransByte.Text = ExtraDiskMeth.SizeSuffix( Math.Round(diskDataValues.DiskTransB, 2, MidpointRounding.AwayFromZero).ToString()); lblAvgRead.Text = Math.Round(diskDataValues.AvgDiskRead, 2, MidpointRounding.AwayFromZero).ToString(); lblAvgWrite.Text = Math.Round(diskDataValues.AvgDiskWrite, 2, MidpointRounding.AwayFromZero).ToString(); lblAvgTrans.Text = Math.Round(diskDataValues.AvgDiskTrans, 2, MidpointRounding.AwayFromZero).ToString(); lblAvgReadB.Text = ExtraDiskMeth.SizeSuffix( Math.Round(diskDataValues.AvgDiskReadB, 2, MidpointRounding.AwayFromZero).ToString()); lblAvgWriteB.Text = ExtraDiskMeth.SizeSuffix( Math.Round(diskDataValues.AvgDiskWriteB, 2, MidpointRounding.AwayFromZero).ToString()); lblAvgTransB.Text = ExtraDiskMeth.SizeSuffix( Math.Round(diskDataValues.AvgDiskTransB, 2, MidpointRounding.AwayFromZero).ToString()); lblCurrQLen.Text = Math.Round(diskDataValues.CurrQueueLen, 2, MidpointRounding.AwayFromZero).ToString(); lblAvgReadQ.Text = Math.Round(diskDataValues.AvgDiskReadQueue, 2, MidpointRounding.AwayFromZero).ToString(); lblAvgWriteQ.Text = Math.Round(diskDataValues.AvgDiskWriteQueue, 2, MidpointRounding.AwayFromZero).ToString(); lblAvgDiskQ.Text = Math.Round(diskDataValues.AvgDiskQueue, 2, MidpointRounding.AwayFromZero).ToString(); lblIOSplit.Text = Math.Round(diskDataValues.DiskIoSplit, 2, MidpointRounding.AwayFromZero).ToString(); lblDiskTime.Text = Math.Round(diskDataValues.DiskTime, 2, MidpointRounding.AwayFromZero).ToString(); lblIdleTime.Text = Math.Round(diskDataValues.DiskIdleTime, 2, MidpointRounding.AwayFromZero).ToString(); lblReadTime.Text = Math.Round(diskDataValues.DiskReadTime, 2, MidpointRounding.AwayFromZero).ToString(); lblWriteTime.Text = Math.Round(diskDataValues.DiskWriteTime, 2, MidpointRounding.AwayFromZero).ToString(); }