[chore:] implemented student view

This commit is contained in:
2026-02-18 15:13:11 +01:00
parent 6a08694753
commit 1b07d0e2ab
2 changed files with 107 additions and 11 deletions

View File

@@ -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
{
}
}
}