CA-122424: When configuring "Allowed vGPU types", only disable the checkbox if the type is checked (allowed) and there are running VMs using it (in use).

# HG changeset patch
# User Mihaela Stoica <Mihaela.Stoica@citrix.com>
# Date 1385386172 0
#      Mon Nov 25 13:29:32 2013 +0000
# Node ID 5a4abff0407e1d2265ab34163c4f4a68d521649d
# Parent  6bbdd9b672dad33c9a4406c8d1acdb27b6d8f333

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2013-12-11 10:27:45 +00:00
parent c73dc6cbb8
commit 4d4701d394

View File

@ -112,7 +112,7 @@ namespace XenAdmin.Controls.GPU
private void SetCheckedValues()
{
dataGridViewEx1.Rows.Cast<VGpuDetailWithCheckBoxRow>().ToList().ForEach(r => r.Enabled = !r.IsInUse);
dataGridViewEx1.Rows.Cast<VGpuDetailWithCheckBoxRow>().ToList().ForEach(r => r.Enabled = !r.IsReadOnly);
}
private void okButton_Click(object sender, System.EventArgs e)
@ -172,11 +172,11 @@ namespace XenAdmin.Controls.GPU
public VGPU_type VGpuType { get; private set; }
public XenRef<VGPU_type> VGpuTypeRef { get; private set; }
public bool IsInUse { get; private set; }
public bool IsReadOnly { get; private set; }
public bool NeedsSave
{
get { return !IsInUse && (allowed != CheckBoxChecked); }
get { return (allowed != CheckBoxChecked); }
}
public bool CheckBoxChecked
@ -189,7 +189,7 @@ namespace XenAdmin.Controls.GPU
VGpuTypeRef = vGpuTypeRef;
VGpuType = vGpuType;
this.allowed = allowed;
IsInUse = isInUse;
IsReadOnly = isInUse && allowed;
SetCells();
Cells.AddRange(checkBoxCell, nameColumn, vGpusPerGpuColumn, maxResolutionColumn, maxDisplaysColumn, videoRamColumn);
@ -224,7 +224,7 @@ namespace XenAdmin.Controls.GPU
checkBoxCell.FalseValue = false;
checkBoxCell.ValueType = typeof(bool);
checkBoxCell.Value = allowed;
checkBoxCell.ReadOnly = IsInUse;
checkBoxCell.ReadOnly = IsReadOnly;
}
}
}