From af2ad3dab77d5220d5bca2dcabc1ce67b3ad35ef Mon Sep 17 00:00:00 2001 From: Elias Fierke Date: Mon, 2 Mar 2026 10:55:38 +0100 Subject: [PATCH] [chore:] delete alternative names from sport courses --- MainWindow.axaml | 7 ++++++- MainWindow.axaml.cs | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/MainWindow.axaml b/MainWindow.axaml index a04a0f3..968e35f 100644 --- a/MainWindow.axaml +++ b/MainWindow.axaml @@ -172,13 +172,18 @@ - + + diff --git a/MainWindow.axaml.cs b/MainWindow.axaml.cs index 70971e7..f38e38c 100644 --- a/MainWindow.axaml.cs +++ b/MainWindow.axaml.cs @@ -331,6 +331,27 @@ public partial class MainWindow : Window ((Sport)LbSportCourses.SelectedItem).AlternativeNames.Add(TbSportAlternativeName.Text); LbAlternativeNames.Items.Add(TbSportAlternativeName.Text); TbSportAlternativeName.Text = ""; + + int curr_selected = LbSportCourses.SelectedIndex; + RefreshCoursesList(); + LbSportCourses.SelectedIndex = curr_selected; } catch {} } + + private void BtnAlternativeNameRemove_OnClick(object? sender, RoutedEventArgs e) + { + //try + //{ + LbAlternativeNames.Items.Remove(LbAlternativeNames.SelectedItem); + ((Sport)LbSportCourses.SelectedItem).AlternativeNames.Clear(); + foreach (string s in LbAlternativeNames.Items) + { + ((Sport)LbSportCourses.SelectedItem).AlternativeNames.Add(s); + } + + int curr_selected = LbSportCourses.SelectedIndex; + RefreshCoursesList(); + LbSportCourses.SelectedIndex = curr_selected; + //} catch (Exception ex) {} + } } \ No newline at end of file