Skip to content

Commit 6f1daff

Browse files
Konstantina ChremmouKonstantina Chremmou
authored andcommitted
Compacted logic that toggles control visibility.
Signed-off-by: Konstantina Chremmou <[email protected]>
1 parent 85347aa commit 6f1daff

File tree

1 file changed

+7
-26
lines changed

1 file changed

+7
-26
lines changed

XenAdmin/Controls/MultipleDvdIsoList.cs

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -169,33 +169,14 @@ private void RefreshDrives()
169169
}
170170
}
171171

172-
if (comboBoxDrive.Items.Count == 0)
173-
{
174-
comboBoxDrive.Visible = false;
175-
cdChanger1.Visible = false;
176-
labelSingleDvd.Visible = false;
177-
linkLabelEject.Visible = false;
178-
newCDLabel.Visible = VM != null && !VM.is_control_domain;
179-
180-
}
181-
else if (comboBoxDrive.Items.Count == 1)
182-
{
183-
comboBoxDrive.Visible = false;
184-
cdChanger1.Visible = true;
172+
labelSingleDvd.Visible = comboBoxDrive.Items.Count == 1;
173+
if (labelSingleDvd.Visible)
185174
labelSingleDvd.Text = comboBoxDrive.Items[0].ToString();
186-
labelSingleDvd.Visible = true;
187-
tableLayoutPanel1.ColumnStyles[0].Width = labelSingleDvd.Width;
188-
newCDLabel.Visible = false;
189-
linkLabelEject.Visible = true;
190-
}
191-
else
192-
{
193-
comboBoxDrive.Visible = true;
194-
cdChanger1.Visible = true;
195-
labelSingleDvd.Visible = false;
196-
newCDLabel.Visible = false;
197-
linkLabelEject.Visible = true;
198-
}
175+
176+
comboBoxDrive.Visible = comboBoxDrive.Items.Count > 1;
177+
cdChanger1.Visible = comboBoxDrive.Items.Count > 0;
178+
linkLabelEject.Visible = comboBoxDrive.Items.Count > 0;
179+
newCDLabel.Visible = comboBoxDrive.Items.Count == 0 && VM != null && !VM.is_control_domain;
199180

200181
_inRefresh = false;
201182

0 commit comments

Comments
 (0)