[chore:] implemented button handlers for course view and gui refresh functions
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Platform.Storage;
|
||||
|
||||
@@ -171,9 +172,6 @@ public partial class MainWindow : Window
|
||||
try
|
||||
{
|
||||
((Student)LbStudentsImported.SelectedItem).Name = TbStudentName.Text;
|
||||
//int current = LbStudentsImported.SelectedIndex;
|
||||
//RefreshImportedStudentList();
|
||||
//LbStudentsImported.SelectedIndex = current;
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -185,13 +183,54 @@ public partial class MainWindow : Window
|
||||
try
|
||||
{
|
||||
((Student)LbStudentsImported.SelectedItem).Name = TbStudentID.Text;
|
||||
//int current = LbStudentsImported.SelectedIndex;
|
||||
//RefreshImportedStudentList();
|
||||
//LbStudentsImported.SelectedIndex = current;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnImportDefaultCourses_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
Settings.ImportInitial();
|
||||
RefreshCoursesList();
|
||||
}
|
||||
|
||||
private void RefreshCoursesList()
|
||||
{
|
||||
LbSportCourses.Items.Clear();
|
||||
foreach (var sp in Settings.Instance.Sports)
|
||||
{
|
||||
LbSportCourses.Items.Add(sp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void LbSportCourses_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (LbSportCourses.SelectedItem != null)
|
||||
{
|
||||
if (LbSportCourses.SelectedItem is Sport item)
|
||||
{
|
||||
LblSportID.Content = item.ID;
|
||||
TbSportName.Text = item.Name;
|
||||
NudSportMaxStudents.Value = item.MaxStudents;
|
||||
NudSportMinStudents.Value = item.MinStudents;
|
||||
NudAmountCoursesSem1.Value = item.Semester[0];
|
||||
NudAmountCoursesSem2.Value = item.Semester[1];
|
||||
NudAmountCoursesSem3.Value = item.Semester[2];
|
||||
NudAmountCoursesSem4.Value = item.Semester[3];
|
||||
LbAlternativeCourses.Items.Clear();
|
||||
foreach (var alternative in item.AlternativeCourses)
|
||||
{
|
||||
LbAlternativeCourses.Items.Add(Settings.GetSportNameFromID(alternative));
|
||||
}
|
||||
LbAlternativeNames.Items.Clear();
|
||||
foreach (var alternative in item.AlternativeNames)
|
||||
{
|
||||
LbAlternativeNames.Items.Add(alternative);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user