예제 #1
0
 private void cmdEdit_Click(object sender, EventArgs e)
 {
     if (lvwDrives.SelectedItems.Count > 0)
     {
         EditDiskSpace editDiskSpace = new EditDiskSpace();
         editDiskSpace.DriveSpace = (DriveSpaceEntry)lvwDrives.SelectedItems[0].Tag;
         if (editDiskSpace.ShowDriveSpace() == DialogResult.OK)
         {
             lvwDrives.SelectedItems[0].Text             = editDiskSpace.DriveSpace.DriveLetter;
             lvwDrives.SelectedItems[0].SubItems[1].Text = editDiskSpace.DriveSpace.WarningSizeLeftMB.ToString();
             lvwDrives.SelectedItems[0].SubItems[2].Text = editDiskSpace.DriveSpace.ErrorSizeLeftMB.ToString();
             lvwDrives.SelectedItems[0].SubItems[3].Text = editDiskSpace.DriveSpace.WarnOnNotReady.ToString();
             lvwDrives.SelectedItems[0].Tag = editDiskSpace.DriveSpace;
         }
     }
 }
예제 #2
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            EditDiskSpace editDiskSpace = new EditDiskSpace();

            editDiskSpace.DriveSpace = new DriveSpaceEntry();

            if (editDiskSpace.ShowDriveSpace() == DialogResult.OK)
            {
                ListViewItem lvi = new ListViewItem(editDiskSpace.DriveSpace.DriveLetter);
                lvi.SubItems.Add(editDiskSpace.DriveSpace.WarningSizeLeftMB.ToString());
                lvi.SubItems.Add(editDiskSpace.DriveSpace.ErrorSizeLeftMB.ToString());
                lvi.SubItems.Add(editDiskSpace.DriveSpace.WarnOnNotReady.ToString());
                lvi.Tag = editDiskSpace.DriveSpace;
                lvwDrives.Items.Add(lvi);
            }
        }