diff --git a/Elwig/Windows/ChartWindow.xaml b/Elwig/Windows/ChartWindow.xaml index 1c75004..f032d81 100644 --- a/Elwig/Windows/ChartWindow.xaml +++ b/Elwig/Windows/ChartWindow.xaml @@ -74,7 +74,7 @@ - diff --git a/Elwig/Windows/ChartWindow.xaml.cs b/Elwig/Windows/ChartWindow.xaml.cs index fa0c8a7..ef8753b 100644 --- a/Elwig/Windows/ChartWindow.xaml.cs +++ b/Elwig/Windows/ChartWindow.xaml.cs @@ -96,7 +96,7 @@ namespace Elwig.Windows { FillingInputs = true; ControlUtils.RenewItemsSource(ContractInput, contracts, g => (g as ContractSelection)?.Listing); FillingInputs = false; - ControlUtils.RenewItemsSource(GraphList, GraphEntries, g => (g as GraphEntry)?.Id, GraphList_SelectionChanged, ControlUtils.RenewSourceDefault.First); + ControlUtils.RenewItemsSource(GraphList, GraphEntries, g => (g as GraphEntry)?.ContractsStringSimple, GraphList_SelectionChanged, ControlUtils.RenewSourceDefault.First); RefreshInputs(); } @@ -137,6 +137,7 @@ namespace Elwig.Windows { private void FillInputs() { FillingInputs = true; + AbgewertetInput.IsChecked = SelectedGraphEntry?.Abgewertet; if (SelectedGraphEntry?.GebundenFlatBonus is double bonus) { GebundenTypeFixed.IsChecked = true; GebundenFlatBonus.Text = $"{bonus}"; @@ -418,8 +419,9 @@ namespace Elwig.Windows { } private void PriceInput_TextChanged(object sender, TextChangedEventArgs evt) { - if (PrimaryMarkedPoint != -1 && ActiveGraph != null) { - if (double.TryParse(PriceInput.Text, out double price)) { + if (PrimaryMarkedPoint != -1 && ActiveGraph != null && PriceInput.IsKeyboardFocusWithin == true) { + var res = Validator.CheckDecimal(PriceInput.TextBox, 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); SetHasChanged(); @@ -642,6 +644,7 @@ namespace Elwig.Windows { tr = Context.Update(PaymentVar); await Context.SaveChangesAsync(); LockContext = false; + tr = null; await App.HintContextChange(); } catch (Exception exc) { if (tr != null) await tr.ReloadAsync(); @@ -720,13 +723,14 @@ namespace Elwig.Windows { } var r = ContractInput.SelectedItems.Cast(); SelectedGraphEntry!.Contracts = r.ToList(); + SetHasChanged(); GraphList.Items.Refresh(); } private void RemoveContractFromOtherGraphEntries(string? contract) { if (contract == null) return; foreach (var ge in GraphEntries) { - if (ge != SelectedGraphEntry) { + if (ge != SelectedGraphEntry && ge.Abgewertet == SelectedGraphEntry?.Abgewertet) { ge.Contracts.RemoveAll(c => c.Listing.Equals(contract)); } } @@ -737,6 +741,7 @@ namespace Elwig.Windows { if (SelectedGraphEntry == null) return; SelectedGraphEntry.Abgewertet = AbgewertetInput.IsChecked == true; SetHasChanged(); + GraphList.Items.Refresh(); } private void GebundenType_Checked(object sender, RoutedEventArgs e) {