Controls: Rewrite UnitTextBox as extension of TextBox instead of UserControl

This commit is contained in:
2024-04-28 20:07:09 +02:00
parent 21fe5bc094
commit c4d68d11bc
16 changed files with 150 additions and 123 deletions

View File

@ -429,7 +429,7 @@ namespace Elwig.Windows {
private void PriceInput_TextChanged(object sender, TextChangedEventArgs evt) {
if (PrimaryMarkedPoint != -1 && ActiveGraph != null && PriceInput.IsKeyboardFocusWithin == true) {
var res = Validator.CheckDecimal(PriceInput.TextBox, true, 2, Season.Precision);
var res = Validator.CheckDecimal(PriceInput, true, 2, Season.Precision);
if (res.IsValid && double.TryParse(PriceInput.Text, out double price)) {
ActiveGraph.SetPriceAt(PrimaryMarkedPoint, price);
PrimaryMarkedPointPlot.Location = new Coordinates(PrimaryMarkedPointPlot.Location.X, price);
@ -667,13 +667,13 @@ namespace Elwig.Windows {
private void EnableUnitTextBox(UnitTextBox u) {
if (PaymentVar.TestVariant) {
u.IsEnabled = true;
u.TextBox.IsReadOnly = false;
u.IsReadOnly = false;
}
}
private void DisableUnitTextBox(UnitTextBox u) {
u.IsEnabled = false;
u.TextBox.IsReadOnly = true;
u.IsReadOnly = true;
}
private void ChangeActiveGraph(Graph? g) {
@ -716,7 +716,7 @@ namespace Elwig.Windows {
private void GebundenFlatBonus_TextChanged(object sender, TextChangedEventArgs e) {
if (FillingInputs) return;
var r = Validator.CheckDecimal(GebundenFlatBonus.TextBox, true, 2, Season.Precision);
var r = Validator.CheckDecimal(GebundenFlatBonus, true, 2, Season.Precision);
if (r.IsValid && SelectedGraphEntry != null) {
SelectedGraphEntry.GebundenFlatBonus = double.Parse(GebundenFlatBonus.Text);
ResetPlot();