Ejemplo n.º 1
0
 private void AddTargetForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (this.DialogResult != DialogResult.OK)
     {
         LockUtils.ReleaseDisks(m_disks);
     }
 }
Ejemplo n.º 2
0
 private void btnRemove_Click(object sender, EventArgs e)
 {
     if (listDisks.SelectedIndices.Count > 0)
     {
         int selectedIndex = listDisks.SelectedIndices[0];
         LockUtils.ReleaseDisk(m_disks[selectedIndex]);
         m_disks.RemoveAt(selectedIndex);
         listDisks.Items.RemoveAt(selectedIndex);
     }
 }
Ejemplo n.º 3
0
 private void btnRemoveTarget_Click(object sender, EventArgs e)
 {
     if (listTargets.SelectedIndices.Count > 0)
     {
         int         targetIndex     = listTargets.SelectedIndices[0];
         ISCSITarget target          = m_targets[targetIndex];
         bool        isTargetRemoved = m_server.RemoveTarget(target.TargetName);
         if (!isTargetRemoved)
         {
             MessageBox.Show("Could not remove iSCSI target", "Error");
             return;
         }
         List <Disk> disks = ((SCSI.VirtualSCSITarget)target.SCSITarget).Disks;
         LockUtils.ReleaseDisks(disks);
         m_targets.RemoveAt(targetIndex);
         listTargets.Items.RemoveAt(targetIndex);
     }
 }