Compare commits

...

2 Commits

Author SHA1 Message Date
5321be46c7 [#33] ChartWindow: Add CheckBox to indicate which graph (gebunden, normal) is currently selected
All checks were successful
Test / Run tests (push) Successful in 2m54s
2024-08-28 11:14:51 +02:00
0f24f9da08 [#33] ChartWindow: Fix scaling bug 2024-08-28 10:20:21 +02:00
2 changed files with 97 additions and 74 deletions

View File

@@ -132,18 +132,20 @@
<GroupBox Header="Datenpunkt" Grid.Row="0" Margin="0,5,5,5"> <GroupBox Header="Datenpunkt" Grid.Row="0" Margin="0,5,5,5">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="85"/> <ColumnDefinition Width="65"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Content="Oechsle:" Margin="10,10,0,0" Grid.Column="0"/> <Label Content="Oechsle:" Margin="10,10,0,0" Grid.Column="0"/>
<ctrl:UnitTextBox x:Name="OechsleInput" Unit="°Oe" TextChanged="OechsleInput_TextChanged" IsEnabled="False" LostFocus="OechsleInput_LostFocus" <ctrl:UnitTextBox x:Name="OechsleInput" Unit="°Oe" TextChanged="OechsleInput_TextChanged" IsEnabled="False"
Grid.Column="1" Width="90" Margin="0,10,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/> Grid.Column="1" Width="52" Margin="0,10,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<CheckBox x:Name="GebInput" Content="Geb." IsEnabled="False"
Grid.Column="1" Margin="0,15,10,0" HorizontalAlignment="Right" VerticalAlignment="Top"
Checked="GebInput_Changed" Unchecked="GebInput_Changed"/>
<Label Content="Preis:" Margin="10,40,0,0" Grid.Column="0"/> <Label Content="Preis:" Margin="10,40,0,0" Grid.Column="0"/>
<ctrl:UnitTextBox x:Name="PriceInput" Unit="€/kg" TextChanged="PriceInput_TextChanged" IsEnabled="False" LostFocus="PriceInput_LostFocus" <ctrl:UnitTextBox x:Name="PriceInput" Unit="€/kg" TextChanged="PriceInput_TextChanged" IsEnabled="False"
Grid.Column="1" Width="90" Margin="0,40,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/> Grid.Column="1" Margin="0,40,10,0" HorizontalAlignment="Stretch" VerticalAlignment="Top"/>
</Grid> </Grid>
</GroupBox> </GroupBox>

View File

@@ -5,7 +5,6 @@ using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using Elwig.Controls;
using Elwig.Helpers; using Elwig.Helpers;
using Elwig.Helpers.Billing; using Elwig.Helpers.Billing;
using Elwig.Models.Entities; using Elwig.Models.Entities;
@@ -22,8 +21,10 @@ namespace Elwig.Windows {
public readonly int Year; public readonly int Year;
public readonly int AvNr; public readonly int AvNr;
public Season Season; public Season Season;
public string CurrencySymbol;
private PaymentVar PaymentVar; private PaymentVar PaymentVar;
private bool HasChanged = false; private bool HasChanged = false;
private bool Updating = false;
private Scatter DataPlot; private Scatter DataPlot;
private Scatter? GebundenPlot; private Scatter? GebundenPlot;
@@ -72,6 +73,9 @@ namespace Elwig.Windows {
AvNr = avnr; AvNr = avnr;
using var ctx = new AppDbContext(); using var ctx = new AppDbContext();
Season = ctx.Seasons.Find(year) ?? throw new ArgumentException("Season not found"); Season = ctx.Seasons.Find(year) ?? throw new ArgumentException("Season not found");
CurrencySymbol = Season.Currency.Symbol ?? Season.Currency.Code;
PriceInput.Unit = $"{CurrencySymbol}/kg";
GebundenFlatBonus.Unit = $"{CurrencySymbol}/kg";
PaymentVar = ctx.PaymentVariants.Find(year, avnr) ?? throw new ArgumentException("PaymentVar not found"); PaymentVar = ctx.PaymentVariants.Find(year, avnr) ?? throw new ArgumentException("PaymentVar not found");
Title = $"{PaymentVar?.Name} - Lese {year} - Elwig"; Title = $"{PaymentVar?.Name} - Lese {year} - Elwig";
LockContext = true; LockContext = true;
@@ -99,6 +103,9 @@ namespace Elwig.Windows {
private async Task RefreshGraphList(AppDbContext ctx) { private async Task RefreshGraphList(AppDbContext ctx) {
PaymentVar = await ctx.PaymentVariants.FindAsync(Year, AvNr) ?? throw new ArgumentException("PaymentVar not found"); PaymentVar = await ctx.PaymentVariants.FindAsync(Year, AvNr) ?? throw new ArgumentException("PaymentVar not found");
Season = await ctx.Seasons.FindAsync(Year) ?? throw new ArgumentException("Season not found"); Season = await ctx.Seasons.FindAsync(Year) ?? throw new ArgumentException("Season not found");
CurrencySymbol = Season.Currency.Symbol ?? Season.Currency.Code;
PriceInput.Unit = $"{CurrencySymbol}/kg";
GebundenFlatBonus.Unit = $"{CurrencySymbol}/kg";
try { try {
var data = EditBillingData.FromJson(PaymentVar.Data, Utils.GetVaributes(ctx, Year)); var data = EditBillingData.FromJson(PaymentVar.Data, Utils.GetVaributes(ctx, Year));
@@ -146,6 +153,8 @@ namespace Elwig.Windows {
if (SelectedGraphEntry != null) { if (SelectedGraphEntry != null) {
CopyButton.IsEnabled = true; CopyButton.IsEnabled = true;
DeleteButton.IsEnabled = true; DeleteButton.IsEnabled = true;
EnableTextBox(OechsleInput);
GebInput.IsEnabled = SelectedGraphEntry?.GebundenGraph != null;
GebundenTypeFixed.IsEnabled = true; GebundenTypeFixed.IsEnabled = true;
GebundenTypeGraph.IsEnabled = true; GebundenTypeGraph.IsEnabled = true;
GebundenTypeNone.IsEnabled = true; GebundenTypeNone.IsEnabled = true;
@@ -156,15 +165,15 @@ namespace Elwig.Windows {
} else { } else {
CopyButton.IsEnabled = false; CopyButton.IsEnabled = false;
DeleteButton.IsEnabled = false; DeleteButton.IsEnabled = false;
DisableUnitTextBox(OechsleInput); DisableTextBox(OechsleInput);
GebInput.IsEnabled = false;
DisableOptionButtons(); DisableOptionButtons();
} }
if (!PaymentVar.TestVariant) { if (!PaymentVar.TestVariant) {
AddButton.IsEnabled = false; AddButton.IsEnabled = false;
CopyButton.IsEnabled = false; CopyButton.IsEnabled = false;
DeleteButton.IsEnabled = false; DeleteButton.IsEnabled = false;
DisableUnitTextBox(OechsleInput); DisableTextBox(PriceInput);
DisableUnitTextBox(PriceInput);
GebundenTypeFixed.IsEnabled = false; GebundenTypeFixed.IsEnabled = false;
GebundenTypeGraph.IsEnabled = false; GebundenTypeGraph.IsEnabled = false;
GebundenTypeNone.IsEnabled = false; GebundenTypeNone.IsEnabled = false;
@@ -388,26 +397,23 @@ namespace Elwig.Windows {
OechslePricePlot.Plot.Legend.ManualItems.Clear(); OechslePricePlot.Plot.Legend.ManualItems.Clear();
} }
private void OechsleInput_TextChanged(object sender, TextChangedEventArgs evt) { private void UpdateSelectedPoint() {
if (ActiveGraph == null || SelectedGraphEntry == null) { if (ActiveGraph == null || SelectedGraphEntry == null)
return; return;
}
bool success = int.TryParse(OechsleInput.Text, out int oechsle);
SecondaryMarkedPoint = -1; SecondaryMarkedPoint = -1;
ChangeMarker(SecondaryMarkedPointPlot, false); ChangeMarker(SecondaryMarkedPointPlot, false);
if (success) { if (int.TryParse(OechsleInput.Text, out int oe)) {
if (oechsle >= ActiveGraph.MinX && oechsle <= ActiveGraph.MaxX) { if (oe >= ActiveGraph.MinX && oe <= ActiveGraph.MaxX) {
PrimaryMarkedPoint = oechsle - ActiveGraph.MinX; PrimaryMarkedPoint = oe - ActiveGraph.MinX;
ChangeMarker(PrimaryMarkedPointPlot, true, ActiveGraph.GetOechsleAt(PrimaryMarkedPoint), ActiveGraph.GetPriceAt(PrimaryMarkedPoint)); ChangeMarker(PrimaryMarkedPointPlot, true, ActiveGraph.GetOechsleAt(PrimaryMarkedPoint), ActiveGraph.GetPriceAt(PrimaryMarkedPoint));
PriceInput.Text = Math.Round(ActiveGraph.GetPriceAt(PrimaryMarkedPoint), Season.Precision).ToString(); PriceInput.Text = Math.Round(ActiveGraph.GetPriceAt(PrimaryMarkedPoint), Season.Precision).ToString();
EnableActionButtons(); EnableActionButtons();
OechslePricePlot.Refresh(); OechslePricePlot.Refresh();
EnableUnitTextBox(PriceInput); EnableTextBox(PriceInput);
return; return;
} }
} }
@@ -416,9 +422,21 @@ namespace Elwig.Windows {
ChangeMarker(PrimaryMarkedPointPlot, false); ChangeMarker(PrimaryMarkedPointPlot, false);
DisableActionButtons(); DisableActionButtons();
PriceInput.Text = ""; PriceInput.Text = "";
DisableUnitTextBox(PriceInput); DisableTextBox(PriceInput);
OechslePricePlot.Refresh(); OechslePricePlot.Refresh();
DisableUnitTextBox(PriceInput); DisableTextBox(PriceInput);
}
private void OechsleInput_TextChanged(object sender, TextChangedEventArgs evt) {
UpdateSelectedPoint();
}
private void GebInput_Changed(object sender, RoutedEventArgs evt) {
if (Updating)
return;
var sel = GebInput.IsChecked == true ? SelectedGraphEntry?.GebundenGraph : SelectedGraphEntry?.DataGraph;
if (sel != ActiveGraph) ChangeActiveGraph(sel);
UpdateSelectedPoint();
} }
private void PriceInput_TextChanged(object sender, TextChangedEventArgs evt) { private void PriceInput_TextChanged(object sender, TextChangedEventArgs evt) {
@@ -479,31 +497,34 @@ namespace Elwig.Windows {
} }
private void OechslePricePlot_MouseDown(object sender, MouseEventArgs e) { private void OechslePricePlot_MouseDown(object sender, MouseEventArgs e) {
if (GraphList.SelectedItem == null) { if (GraphList.SelectedItem == null)
return; return;
}
if (HoverActive) { if (HoverActive) {
if (PaymentVar.TestVariant && Keyboard.IsKeyDown(System.Windows.Input.Key.LeftCtrl)) { if (PaymentVar.TestVariant && Keyboard.IsKeyDown(System.Windows.Input.Key.LeftCtrl)) {
if (PrimaryMarkedPoint == -1 || ActiveGraph == null || ActiveGraph != Highlighted.Graph) { if (SecondaryMarkedPoint == -1 || ActiveGraph == null || ActiveGraph != Highlighted.Graph)
return; return;
}
SecondaryMarkedPoint = Highlighted.Index; SecondaryMarkedPoint = Highlighted.Index;
ChangeMarker(SecondaryMarkedPointPlot, true, ActiveGraph.GetOechsleAt(SecondaryMarkedPoint), ActiveGraph.GetPriceAt(SecondaryMarkedPoint)); ChangeMarker(SecondaryMarkedPointPlot, true, ActiveGraph.GetOechsleAt(SecondaryMarkedPoint), ActiveGraph.GetPriceAt(SecondaryMarkedPoint));
InterpolateButton.IsEnabled = true; InterpolateButton.IsEnabled = true;
return; return;
} }
Updating = true;
PrimaryMarkedPoint = Highlighted.Index; PrimaryMarkedPoint = Highlighted.Index;
if (ActiveGraph != Highlighted.Graph) ChangeActiveGraph(Highlighted.Graph); if (ActiveGraph != Highlighted.Graph)
ChangeActiveGraph(Highlighted.Graph);
Updating = false;
if (PrimaryMarkedPoint == -1 || ActiveGraph == null)
return;
ChangeMarker(PrimaryMarkedPointPlot, true, ActiveGraph!.GetOechsleAt(PrimaryMarkedPoint), ActiveGraph.GetPriceAt(PrimaryMarkedPoint)); ChangeMarker(PrimaryMarkedPointPlot, true, ActiveGraph.GetOechsleAt(PrimaryMarkedPoint), ActiveGraph.GetPriceAt(PrimaryMarkedPoint));
Updating = true;
OechsleInput.Text = Highlighted.Graph!.GetOechsleAt(Highlighted.Index).ToString(); OechsleInput.Text = Highlighted.Graph!.GetOechsleAt(Highlighted.Index).ToString();
GebInput.IsChecked = Highlighted.Graph == SelectedGraphEntry?.GebundenGraph;
PriceInput.Text = Math.Round(Highlighted.Graph.GetPriceAt(Highlighted.Index), Season.Precision).ToString(); PriceInput.Text = Math.Round(Highlighted.Graph.GetPriceAt(Highlighted.Index), Season.Precision).ToString();
Updating = false;
EnableActionButtons(); EnableActionButtons();
} else { } else {
@@ -516,8 +537,9 @@ namespace Elwig.Windows {
ChangeMarker(SecondaryMarkedPointPlot, false); ChangeMarker(SecondaryMarkedPointPlot, false);
OechsleInput.Text = ""; OechsleInput.Text = "";
GebInput.IsChecked = false;
PriceInput.Text = ""; PriceInput.Text = "";
DisableUnitTextBox(PriceInput); DisableTextBox(PriceInput);
DisableActionButtons(); DisableActionButtons();
} }
@@ -531,28 +553,39 @@ namespace Elwig.Windows {
MouseChange(e); MouseChange(e);
} }
private Coordinates GetMouseCoordinates(Point p) {
Pixel px = new(p.X, p.Y);
var source = PresentationSource.FromVisual(this);
if (source?.CompositionTarget != null) {
var matrix = source.CompositionTarget.TransformToDevice;
px.X *= (float)matrix.M11;
px.Y *= (float)matrix.M22;
}
return OechslePricePlot.Plot.GetCoordinates(px);
}
private void MouseChange(MouseEventArgs e) { private void MouseChange(MouseEventArgs e) {
if (GraphList.SelectedItem == null) { if (GraphList.SelectedItem == null) {
return; return;
} }
(double x, double y, int index)? mouseOnData = MouseOnPlot(DataPlot, e.GetPosition(OechslePricePlot)); var mouseOnData = MouseOnPlot(DataPlot, GetMouseCoordinates(e.GetPosition(OechslePricePlot)));
(double x, double y, int index)? mouseOnGebunden = MouseOnPlot(GebundenPlot, e.GetPosition(OechslePricePlot)); var mouseOnGebunden = MouseOnPlot(GebundenPlot, GetMouseCoordinates(e.GetPosition(OechslePricePlot)));
Highlighted = LastHighlighted; Highlighted = LastHighlighted;
if (mouseOnData != null) { if (mouseOnData != null) {
ChangeMarker(HighlightedPointPlot, true, mouseOnData.Value.x, mouseOnData.Value.y); ChangeMarker(HighlightedPointPlot, true, mouseOnData.Value.X, mouseOnData.Value.Y);
HighlightedPointPlot.IsVisible = true; HighlightedPointPlot.IsVisible = true;
HoverChanged = true ^ HoverActive; HoverChanged = true ^ HoverActive;
HoverActive = true; HoverActive = true;
HandleTooltip(mouseOnData.Value.x, mouseOnData.Value.y, mouseOnData.Value.index, SelectedGraphEntry!.DataGraph, e.GetPosition(OechslePricePlot), e is MouseWheelEventArgs); HandleTooltip(mouseOnData.Value.X, mouseOnData.Value.Y, mouseOnData.Value.Index, SelectedGraphEntry!.DataGraph, e.GetPosition(OechslePricePlot), e is MouseWheelEventArgs);
} else if (mouseOnGebunden != null) { } else if (mouseOnGebunden != null) {
ChangeMarker(HighlightedPointPlot, true, mouseOnGebunden.Value.x, mouseOnGebunden.Value.y); ChangeMarker(HighlightedPointPlot, true, mouseOnGebunden.Value.X, mouseOnGebunden.Value.Y);
HighlightedPointPlot.IsVisible = true; HighlightedPointPlot.IsVisible = true;
HoverChanged = true ^ HoverActive; HoverChanged = true ^ HoverActive;
HoverActive = true; HoverActive = true;
HandleTooltip(mouseOnGebunden.Value.x, mouseOnGebunden.Value.y, mouseOnGebunden.Value.index, SelectedGraphEntry!.GebundenGraph!, e.GetPosition(OechslePricePlot), e is MouseWheelEventArgs); HandleTooltip(mouseOnGebunden.Value.X, mouseOnGebunden.Value.Y, mouseOnGebunden.Value.Index, SelectedGraphEntry!.GebundenGraph!, e.GetPosition(OechslePricePlot), e is MouseWheelEventArgs);
} else { } else {
ChangeMarker(HighlightedPointPlot, false); ChangeMarker(HighlightedPointPlot, false);
HoverChanged = false ^ HoverActive; HoverChanged = false ^ HoverActive;
@@ -562,30 +595,20 @@ namespace Elwig.Windows {
} }
} }
private (double, double, int)? MouseOnPlot(Scatter? plot, Point p) { private (double X, double Y, int Index)? MouseOnPlot(Scatter? plot, Coordinates c) {
if (plot == null) { if (plot == null)
return null; return null;
}
OechslePricePlot.Refresh(); OechslePricePlot.Refresh();
Pixel mousePixel = new(p.X, p.Y); DataPoint nearestPoint = plot.Data.GetNearest(c, OechslePricePlot.Plot.LastRender, 5);
Coordinates mouseLocation = OechslePricePlot.Plot.GetCoordinates(mousePixel); return nearestPoint.IsReal ? (nearestPoint.X, nearestPoint.Y, nearestPoint.Index) : null;
DataPoint nearestPoint = plot.Data.GetNearest(mouseLocation, OechslePricePlot.Plot.LastRender, 3);
if (nearestPoint.IsReal) {
return (nearestPoint.X, nearestPoint.Y, nearestPoint.Index);
} else {
return null;
}
} }
private void HandleTooltip(double pointX, double pointY, int pointIndex, Graph g, Point p, bool force) { private void HandleTooltip(double pointX, double pointY, int pointIndex, Graph g, Point p, bool force) {
if (force || LastHighlighted != Highlighted || HoverChanged) { if (force || LastHighlighted != Highlighted || HoverChanged) {
OechslePricePlot.Plot.PlottableList.Remove(TooltipPlot); OechslePricePlot.Plot.PlottableList.Remove(TooltipPlot);
if (TooltipInput.IsChecked == true) { if (TooltipInput.IsChecked == true) {
Pixel mousePixel = new(p.X, p.Y - 30); Coordinates mouseLocation = GetMouseCoordinates(new(p.X, p.Y - 30));
Coordinates mouseLocation = OechslePricePlot.Plot.GetCoordinates(mousePixel); TooltipPlot = OechslePricePlot.Plot.Add.Text($"Oechsle: {pointX:N2}, Preis: {Math.Round(pointY, Season.Precision)} {CurrencySymbol}/kg", mouseLocation.X, mouseLocation.Y);
TooltipPlot = OechslePricePlot.Plot.Add.Text($"Oechsle: {pointX:N2}, Preis: {Math.Round(pointY, Season.Precision)}€/kg", mouseLocation.X, mouseLocation.Y);
TooltipPlot.LabelFontSize = 12; TooltipPlot.LabelFontSize = 12;
TooltipPlot.LabelBold = true; TooltipPlot.LabelBold = true;
TooltipPlot.LabelBorderColor = Colors.Black; TooltipPlot.LabelBorderColor = Colors.Black;
@@ -658,31 +681,37 @@ namespace Elwig.Windows {
SetHasChanged(false); SetHasChanged(false);
} }
private void EnableUnitTextBox(UnitTextBox u) { private void EnableTextBox(TextBox u) {
if (PaymentVar.TestVariant) { if (PaymentVar.TestVariant || u == OechsleInput) {
u.IsEnabled = true; u.IsEnabled = true;
u.IsReadOnly = false; u.IsReadOnly = false;
} }
} }
private void DisableUnitTextBox(UnitTextBox u) { private void DisableTextBox(TextBox u) {
u.IsEnabled = false; u.IsEnabled = false;
u.IsReadOnly = true; u.IsReadOnly = true;
} }
private void ChangeActiveGraph(Graph? g) { private void ChangeActiveGraph(Graph? g) {
if (g != null && g == SelectedGraphEntry?.DataGraph) { if (g != null && g == SelectedGraphEntry?.DataGraph) {
EnableUnitTextBox(OechsleInput); EnableTextBox(OechsleInput);
if (SelectedGraphEntry?.GebundenGraph != null) ChangeLineWidth(DataPlot, 4); if (SelectedGraphEntry?.GebundenGraph != null) ChangeLineWidth(DataPlot, 4);
ChangeLineWidth(GebundenPlot, 1); ChangeLineWidth(GebundenPlot, 1);
GebInput.IsEnabled = SelectedGraphEntry?.GebundenGraph != null;
GebInput.IsChecked = false;
} else if (g != null && g == SelectedGraphEntry?.GebundenGraph) { } else if (g != null && g == SelectedGraphEntry?.GebundenGraph) {
EnableUnitTextBox(OechsleInput); EnableTextBox(OechsleInput);
ChangeLineWidth(GebundenPlot, 4); ChangeLineWidth(GebundenPlot, 4);
ChangeLineWidth(DataPlot, 1); ChangeLineWidth(DataPlot, 1);
GebInput.IsEnabled = SelectedGraphEntry?.GebundenGraph != null;
GebInput.IsChecked = true;
} else { } else {
DisableUnitTextBox(OechsleInput); DisableTextBox(OechsleInput);
DisableUnitTextBox(PriceInput); DisableTextBox(PriceInput);
OechsleInput.Text = ""; OechsleInput.Text = "";
GebInput.IsEnabled = false;
GebInput.IsChecked = false;
PriceInput.Text = ""; PriceInput.Text = "";
ChangeLineWidth(DataPlot, 1); ChangeLineWidth(DataPlot, 1);
ChangeLineWidth(GebundenPlot, 1); ChangeLineWidth(GebundenPlot, 1);
@@ -700,14 +729,6 @@ namespace Elwig.Windows {
RefreshInputs(); RefreshInputs();
} }
private void PriceInput_LostFocus(object sender, RoutedEventArgs e) {
}
private void OechsleInput_LostFocus(object sender, RoutedEventArgs e) {
}
private void GebundenFlatBonus_TextChanged(object sender, TextChangedEventArgs e) { private void GebundenFlatBonus_TextChanged(object sender, TextChangedEventArgs e) {
if (FillingInputs) return; if (FillingInputs) return;
var r = Validator.CheckDecimal(GebundenFlatBonus, true, 2, Season.Precision); var r = Validator.CheckDecimal(GebundenFlatBonus, true, 2, Season.Precision);
@@ -778,19 +799,19 @@ namespace Elwig.Windows {
private void GebundenType_Checked(object sender, RoutedEventArgs e) { private void GebundenType_Checked(object sender, RoutedEventArgs e) {
if (FillingInputs) return; if (FillingInputs) return;
if (SelectedGraphEntry == null) { if (SelectedGraphEntry == null) {
DisableUnitTextBox(GebundenFlatBonus); DisableTextBox(GebundenFlatBonus);
return; return;
} }
if (GebundenTypeNone.IsChecked == true) { if (GebundenTypeNone.IsChecked == true) {
SelectedGraphEntry.RemoveGebundenGraph(); SelectedGraphEntry.RemoveGebundenGraph();
DisableUnitTextBox(GebundenFlatBonus); DisableTextBox(GebundenFlatBonus);
} else if (GebundenTypeFixed.IsChecked == true) { } else if (GebundenTypeFixed.IsChecked == true) {
SelectedGraphEntry.GebundenFlatBonus = double.TryParse(GebundenFlatBonus.Text, out var val) ? val : 0.1; SelectedGraphEntry.GebundenFlatBonus = double.TryParse(GebundenFlatBonus.Text, out var val) ? val : 0.1;
SelectedGraphEntry.AddGebundenGraph(); SelectedGraphEntry.AddGebundenGraph();
EnableUnitTextBox(GebundenFlatBonus); EnableTextBox(GebundenFlatBonus);
} else if (GebundenTypeGraph.IsChecked == true) { } else if (GebundenTypeGraph.IsChecked == true) {
SelectedGraphEntry.AddGebundenGraph(); SelectedGraphEntry.AddGebundenGraph();
DisableUnitTextBox(GebundenFlatBonus); DisableTextBox(GebundenFlatBonus);
} }
SetHasChanged(); SetHasChanged();
RefreshInputs(); RefreshInputs();
@@ -801,11 +822,11 @@ namespace Elwig.Windows {
if (SelectedGraphEntry?.GebundenFlatBonus is double bonus) { if (SelectedGraphEntry?.GebundenFlatBonus is double bonus) {
GebundenTypeFixed.IsChecked = true; GebundenTypeFixed.IsChecked = true;
GebundenFlatBonus.Text = $"{bonus}"; GebundenFlatBonus.Text = $"{bonus}";
EnableUnitTextBox(GebundenFlatBonus); EnableTextBox(GebundenFlatBonus);
} else if (SelectedGraphEntry?.GebundenGraph != null) { } else if (SelectedGraphEntry?.GebundenGraph != null) {
GebundenTypeGraph.IsChecked = true; GebundenTypeGraph.IsChecked = true;
GebundenFlatBonus.Text = ""; GebundenFlatBonus.Text = "";
DisableUnitTextBox(GebundenFlatBonus); DisableTextBox(GebundenFlatBonus);
} }
FillingInputs = false; FillingInputs = false;
} }