[chore:] implemented student view
This commit is contained in:
@@ -28,8 +28,8 @@
|
||||
<Label FontSize="20" Content="Planung" VerticalContentAlignment="Center" />
|
||||
</StackPanel>
|
||||
</TabItem.Header>
|
||||
<Grid ColumnDefinitions="*,2*">
|
||||
<Button Margin="0,10,0,0" x:Name="BtnImport" VerticalAlignment="Top" Height="50" HorizontalAlignment="Stretch" Click="BtnImport_OnClick" HorizontalContentAlignment="Center">
|
||||
<Grid ColumnDefinitions="*,2*" RowDefinitions="*,*">
|
||||
<Button Grid.RowSpan="2" Margin="0,10,0,0" x:Name="BtnImport" VerticalAlignment="Top" Height="50" HorizontalAlignment="Stretch" Click="BtnImport_OnClick" HorizontalContentAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<LucideIcon Kind="Import" Width="36" Height="36" />
|
||||
<Label Content="Importieren..." VerticalContentAlignment="Center" FontSize="15"
|
||||
@@ -37,7 +37,7 @@
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<Button Margin="0,00,0,10" x:Name="BtnCraftCourses" VerticalAlignment="Bottom" Height="50" HorizontalAlignment="Stretch" Click="BtnCraftCourses_OnClick" HorizontalContentAlignment="Center">
|
||||
<Button Grid.RowSpan="2" Margin="0,00,0,10" x:Name="BtnCraftCourses" VerticalAlignment="Bottom" Height="50" HorizontalAlignment="Stretch" Click="BtnCraftCourses_OnClick" HorizontalContentAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<LucideIcon Kind="Pickaxe" Width="36" Height="36" />
|
||||
<Label Content="Kurse basteln" VerticalContentAlignment="Center" FontSize="15"
|
||||
@@ -45,34 +45,49 @@
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<ListBox x:Name="LbStudentsImported" Margin="0,70,0,70" Background="MintCream" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"></ListBox>
|
||||
<ListBox Grid.RowSpan="2" x:Name="LbStudentsImported" SelectionChanged="LbStudentsImported_OnSelectionChanged" Margin="0,70,0,70" Background="MintCream" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"></ListBox>
|
||||
|
||||
<StackPanel Grid.Column="1" Margin="10,10,10,10" Orientation="Vertical" Spacing="10">
|
||||
<StackPanel Grid.Column="1" Grid.Row="0" Margin="10,10,10,10" Orientation="Vertical" Spacing="10">
|
||||
<Grid ColumnDefinitions="*,3*">
|
||||
<Label Content="Name"></Label>
|
||||
<TextBox Grid.Column="1" x:Name="TbStudentName"></TextBox>
|
||||
<Label Content="ID"></Label>
|
||||
<TextBox Grid.Column="1" x:Name="TbStudentID" TextChanged="TbStudentID_OnTextChanged"></TextBox>
|
||||
</Grid>
|
||||
|
||||
<Grid ColumnDefinitions="*,2*">
|
||||
<Grid ColumnDefinitions="*,3*">
|
||||
<Label Content="Name"></Label>
|
||||
<TextBox Grid.Column="1" x:Name="TbStudentName" TextChanged="TbStudentName_OnTextChanged"></TextBox>
|
||||
</Grid>
|
||||
|
||||
<Grid ColumnDefinitions="*,3*">
|
||||
<Label Content="Sport 1"></Label>
|
||||
<Label Grid.Column="1" x:Name="LblSport1"></Label>
|
||||
</Grid>
|
||||
|
||||
<Grid ColumnDefinitions="*,2*">
|
||||
<Grid ColumnDefinitions="*,3*">
|
||||
<Label Content="Sport 2"></Label>
|
||||
<Label Grid.Column="1" x:Name="LblSport2"></Label>
|
||||
</Grid>
|
||||
|
||||
<Grid ColumnDefinitions="*,2*">
|
||||
<Grid ColumnDefinitions="*,3*">
|
||||
<Label Content="Sport 3"></Label>
|
||||
<Label Grid.Column="1" x:Name="LblSport3"></Label>
|
||||
</Grid>
|
||||
|
||||
<Grid ColumnDefinitions="*,2*">
|
||||
<Grid ColumnDefinitions="*,3*">
|
||||
<Label Content="Sport 4"></Label>
|
||||
<Label Grid.Column="1" x:Name="LblSport4"></Label>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Grid.Row="1" Margin="10,10,10,10" Orientation="Vertical" Spacing="10">
|
||||
<Grid ColumnDefinitions="*,3*">
|
||||
<Label Content="Anzahl Einträge"></Label>
|
||||
<Label Grid.Column="1" x:Name="LblStudentAmount"></Label>
|
||||
</Grid>
|
||||
|
||||
<Grid ColumnDefinitions="*,3*">
|
||||
<Label Content="Anzahl gewählte Kurse"></Label>
|
||||
<Label Grid.Column="1" x:Name="LblSelectedAmount"></Label>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
@@ -103,14 +103,95 @@ public partial class MainWindow : Window
|
||||
private void RefreshImportedStudentList()
|
||||
{
|
||||
LbStudentsImported.Items.Clear();
|
||||
int count_selected = 0;
|
||||
foreach (var s in Settings.Instance.Students)
|
||||
{
|
||||
LbStudentsImported.Items.Add(s);
|
||||
count_selected += s.SelectedCourseNames.Count;
|
||||
}
|
||||
LblStudentAmount.Content = Settings.Instance.Students.Count.ToString();
|
||||
LblSelectedAmount.Content = count_selected.ToString();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void BtnCraftCourses_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
// Craft courses here / call course-crafter
|
||||
}
|
||||
|
||||
private void LbStudentsImported_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
Prepare();
|
||||
var stud = (Student)LbStudentsImported.SelectedItem;
|
||||
if (stud == null)
|
||||
{
|
||||
TbStudentName.Text = string.Empty;
|
||||
TbStudentID.Text = string.Empty;
|
||||
SetEmpty();
|
||||
return;
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
TbStudentName.Text = stud.Name;
|
||||
TbStudentID.Text = stud.ID;
|
||||
LblSport1.Content = stud.SelectedCourseNames[0];
|
||||
LblSport2.Content = stud.SelectedCourseNames[1];
|
||||
LblSport3.Content = stud.SelectedCourseNames[2];
|
||||
LblSport4.Content = stud.SelectedCourseNames[3];
|
||||
}
|
||||
catch
|
||||
{
|
||||
SetEmpty();
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
void SetEmpty()
|
||||
{
|
||||
if(LblSport1.Content == "null") LblSport1.Content = "ungewählt";
|
||||
if(LblSport2.Content == "null") LblSport2.Content = "ungewählt";
|
||||
if(LblSport3.Content == "null") LblSport3.Content = "ungewählt";
|
||||
if(LblSport4.Content == "null") LblSport4.Content = "ungewählt";
|
||||
}
|
||||
|
||||
void Prepare()
|
||||
{
|
||||
LblSport1.Content = "null";
|
||||
LblSport2.Content = "null";
|
||||
LblSport3.Content = "null";
|
||||
LblSport4.Content = "null";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void TbStudentName_OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
((Student)LbStudentsImported.SelectedItem).Name = TbStudentName.Text;
|
||||
//int current = LbStudentsImported.SelectedIndex;
|
||||
//RefreshImportedStudentList();
|
||||
//LbStudentsImported.SelectedIndex = current;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
private void TbStudentID_OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
((Student)LbStudentsImported.SelectedItem).Name = TbStudentID.Text;
|
||||
//int current = LbStudentsImported.SelectedIndex;
|
||||
//RefreshImportedStudentList();
|
||||
//LbStudentsImported.SelectedIndex = current;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user