Controls: Rewrite UnitTextBox as extension of TextBox instead of UserControl
This commit is contained in:
@ -94,7 +94,7 @@ namespace Elwig.Windows {
|
||||
WeightModifierInput.Text = "";
|
||||
DataInput.Text = v.Data;
|
||||
}
|
||||
WeightModifierInput.TextBox.IsReadOnly = false;
|
||||
WeightModifierInput.IsReadOnly = false;
|
||||
ConsiderModifiersInput.IsEnabled = !locked;
|
||||
ConsiderPenaltiesInput.IsEnabled = !locked;
|
||||
ConsiderPenaltyInput.IsEnabled = !locked;
|
||||
@ -126,7 +126,7 @@ namespace Elwig.Windows {
|
||||
TransferDateInput.Text = "";
|
||||
TransferDateInput.IsReadOnly = true;
|
||||
WeightModifierInput.Text = "";
|
||||
WeightModifierInput.TextBox.IsReadOnly = true;
|
||||
WeightModifierInput.IsReadOnly = true;
|
||||
ConsiderModifiersInput.IsChecked = false;
|
||||
ConsiderModifiersInput.IsEnabled = false;
|
||||
ConsiderPenaltiesInput.IsChecked = false;
|
||||
@ -554,18 +554,18 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private void WeightModifierInput_TextChanged(object? sender, TextChangedEventArgs? evt) {
|
||||
var res = Validator.CheckDecimal(WeightModifierInput.TextBox, false, 3, 2, true);
|
||||
var res = Validator.CheckDecimal(WeightModifierInput, false, 3, 2, true);
|
||||
if (BillingData == null) {
|
||||
ControlUtils.ClearInputState(WeightModifierInput.TextBox);
|
||||
ControlUtils.ClearInputState(WeightModifierInput);
|
||||
return;
|
||||
}
|
||||
var val = WeightModifierInput.Text.Length > 0 && res.IsValid ? double.Parse(WeightModifierInput.Text) : 0;
|
||||
WeightModifierChanged = (val != Math.Round(BillingData.NetWeightModifier * 100.0, 8) && val != Math.Round(BillingData.GrossWeightModifier * 100.0, 8)) ||
|
||||
(val == 0 && (BillingData.NetWeightModifier != 0 || BillingData.GrossWeightModifier != 0));
|
||||
if (WeightModifierChanged) {
|
||||
ControlUtils.SetInputChanged(WeightModifierInput.TextBox);
|
||||
ControlUtils.SetInputChanged(WeightModifierInput);
|
||||
} else {
|
||||
ControlUtils.ClearInputState(WeightModifierInput.TextBox);
|
||||
ControlUtils.ClearInputState(WeightModifierInput);
|
||||
}
|
||||
UpdateSaveButton();
|
||||
}
|
||||
|
Reference in New Issue
Block a user