Skip to content

Commit

Permalink
Minor code fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Feb 4, 2022
1 parent f749e85 commit 6fc4529
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions FXBEditorUtils/ControlUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ public static string ControlsChecksum(Control.ControlCollection controls)
public static string GetValueFromControl(Control control)
{
var result = "";
if (control is CheckBox)
if (control is CheckBox cb)
{
result = ((CheckBox)control).Checked ? "true" : "false";
result = cb.Checked ? "true" : "false";
}
else if (control is TextBox)
else if (control is TextBox tx)
{
result = ((TextBox)control).Text;
result = tx.Text;
}
else if (control is ComboBox)
else if (control is ComboBox cb2)
{
var item = ((ComboBox)control).SelectedItem;
if (item is IComboBoxItem)
var item = cb2.SelectedItem;
if (item is IComboBoxItem ci)
{
result = ((IComboBoxItem)item).GetValue();
result = ci.GetValue();
}
else
{
result = ((ComboBox)control).Text;
result = cb2.Text;
}
}
return result;
Expand Down

0 comments on commit 6fc4529

Please sign in to comment.