Skip to content

Commit

Permalink
Compacted logic that toggles control visibility.
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantina Chremmou <[email protected]>
  • Loading branch information
kc284 committed Nov 1, 2023
1 parent df69ec3 commit b9c5678
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions XenAdmin/Controls/MultipleDvdIsoList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,33 +169,14 @@ private void RefreshDrives()
}
}

if (comboBoxDrive.Items.Count == 0)
{
comboBoxDrive.Visible = false;
cdChanger1.Visible = false;
labelSingleDvd.Visible = false;
linkLabelEject.Visible = false;
newCDLabel.Visible = VM != null && !VM.is_control_domain;

}
else if (comboBoxDrive.Items.Count == 1)
{
comboBoxDrive.Visible = false;
cdChanger1.Visible = true;
labelSingleDvd.Visible = comboBoxDrive.Items.Count == 1;
if (labelSingleDvd.Visible)
labelSingleDvd.Text = comboBoxDrive.Items[0].ToString();
labelSingleDvd.Visible = true;
tableLayoutPanel1.ColumnStyles[0].Width = labelSingleDvd.Width;
newCDLabel.Visible = false;
linkLabelEject.Visible = true;
}
else
{
comboBoxDrive.Visible = true;
cdChanger1.Visible = true;
labelSingleDvd.Visible = false;
newCDLabel.Visible = false;
linkLabelEject.Visible = true;
}

comboBoxDrive.Visible = comboBoxDrive.Items.Count > 1;
cdChanger1.Visible = comboBoxDrive.Items.Count > 0;
linkLabelEject.Visible = comboBoxDrive.Items.Count > 0;
newCDLabel.Visible = comboBoxDrive.Items.Count == 0 && VM != null && !VM.is_control_domain;

_inRefresh = false;

Expand Down

0 comments on commit b9c5678

Please sign in to comment.