Example #1
0
        private void ShowInformation()
        {
            this.lblDriveName.Text = DriveInformation.Name;
            this.lblType.Text      = DriveInformation.DriveType.ToString();

            if (DriveInformation.DriveType != DriveType.CDRom &&
                DriveInformation.DriveType != DriveType.Unknown)
            {
                this.lblDriveLabel.Text     = DriveInformation.VolumeLabel;
                this.lblFormat.Text         = DriveInformation.DriveFormat;
                this.lblTotalSize.Text      = UnitConverter.BytesToGigaBytes(DriveInformation.TotalSize).ToString() + " GB";
                this.lblTotalFreeSpace.Text = UnitConverter.BytesToGigaBytes(DriveInformation.TotalFreeSpace).ToString() + " GB";
                this.lblAvailableSpace.Text = UnitConverter.BytesToGigaBytes(DriveInformation.AvailableFreeSpace).ToString() + " GB";
                int panelWidth = (int)((1 - ((double)this.DriveInformation.TotalFreeSpace / (double)this.DriveInformation.TotalSize)) * pnlTotalSize.Width);
                this.pnlUsedSpace.Width = panelWidth;
            }
            else
            {
                this.lblDriveLabel.Text     = "-";
                this.lblFormat.Text         = "-";
                this.lblTotalSize.Text      = "0";
                this.lblTotalFreeSpace.Text = "0";
                this.lblAvailableSpace.Text = "0";
                this.pnlUsedSpace.Width     = 0;
            }
        }