[chore:] delete alternative names from sport courses

This commit is contained in:
2026-03-02 10:55:38 +01:00
parent 8672b09ff0
commit af2ad3dab7
2 changed files with 27 additions and 1 deletions

View File

@@ -172,13 +172,18 @@
<Grid ColumnDefinitions="*,3*"> <Grid ColumnDefinitions="*,3*">
<Label Content="Alternativbezeichnungen"></Label> <Label Content="Alternativbezeichnungen"></Label>
<StackPanel Grid.Column="1" Orientation="Vertical"> <StackPanel Grid.Column="1" Orientation="Vertical">
<Grid ColumnDefinitions="*,50"> <Grid ColumnDefinitions="*,50,50">
<TextBox Grid.Column="0" Height="35" HorizontalAlignment="Stretch" x:Name="TbSportAlternativeName"></TextBox> <TextBox Grid.Column="0" Height="35" HorizontalAlignment="Stretch" x:Name="TbSportAlternativeName"></TextBox>
<Button Grid.Column="1" Margin="0,10,0,0" x:Name="BtnAlternativeNameAdd" VerticalAlignment="Top" Height="35" HorizontalAlignment="Stretch" Click="BtnAlternativeNameAdd_OnClick" HorizontalContentAlignment="Center"> <Button Grid.Column="1" Margin="0,10,0,0" x:Name="BtnAlternativeNameAdd" VerticalAlignment="Top" Height="35" HorizontalAlignment="Stretch" Click="BtnAlternativeNameAdd_OnClick" HorizontalContentAlignment="Center">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<LucideIcon Kind="Plus" Width="24" Height="24" /> <LucideIcon Kind="Plus" Width="24" Height="24" />
</StackPanel> </StackPanel>
</Button> </Button>
<Button Grid.Column="2" Margin="0,10,0,0" x:Name="BtnAlternativeNameRemove" VerticalAlignment="Top" Height="35" HorizontalAlignment="Stretch" Click="BtnAlternativeNameRemove_OnClick" HorizontalContentAlignment="Center">
<StackPanel Orientation="Horizontal">
<LucideIcon Kind="Minus" Width="24" Height="24" />
</StackPanel>
</Button>
</Grid> </Grid>
<ListBox x:Name="LbAlternativeNames"> <ListBox x:Name="LbAlternativeNames">

View File

@@ -331,6 +331,27 @@ public partial class MainWindow : Window
((Sport)LbSportCourses.SelectedItem).AlternativeNames.Add(TbSportAlternativeName.Text); ((Sport)LbSportCourses.SelectedItem).AlternativeNames.Add(TbSportAlternativeName.Text);
LbAlternativeNames.Items.Add(TbSportAlternativeName.Text); LbAlternativeNames.Items.Add(TbSportAlternativeName.Text);
TbSportAlternativeName.Text = ""; TbSportAlternativeName.Text = "";
int curr_selected = LbSportCourses.SelectedIndex;
RefreshCoursesList();
LbSportCourses.SelectedIndex = curr_selected;
} catch {} } 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) {}
}
} }