AdministrationWindow: Use GetHashCode() to compare default/original values

This commit is contained in:
2024-03-18 16:10:31 +01:00
parent 729d2fd76c
commit 51e345f1fd
3 changed files with 45 additions and 29 deletions

View File

@ -217,19 +217,19 @@ namespace Elwig.Helpers {
SelectCheckComboBoxItems(ccb, getId, items?.Select(i => getId(i)));
}
public static object? GetInputValue(Control input) {
public static int GetInputHashCode(Control input) {
if (input is TextBox tb) {
return tb.Text;
return Utils.GetEntityIdentifier(tb.Text);
} else if (input is ComboBox sb) {
return sb.SelectedItem;
return Utils.GetEntityIdentifier(sb.SelectedItem);
} else if (input is Xceed.Wpf.Toolkit.CheckComboBox ccb) {
return ccb.SelectedItems.Cast<object>().ToArray();
return Utils.GetEntityIdentifier(ccb.SelectedItems);
} else if (input is CheckBox cb) {
return cb.IsChecked?.ToString();
return Utils.GetEntityIdentifier(cb.IsChecked);
} else if (input is RadioButton rb) {
return rb.IsChecked?.ToString();
return Utils.GetEntityIdentifier(rb.IsChecked);
} else {
return null;
return 0;
}
}
}