diff --git a/LangLang/View/ExamSlotGUI/ExamApplications.xaml b/LangLang/View/ExamSlotGUI/ExamApplications.xaml
new file mode 100644
index 00000000..d80e4197
--- /dev/null
+++ b/LangLang/View/ExamSlotGUI/ExamApplications.xaml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LangLang/View/ExamSlotGUI/ExamApplications.xaml.cs b/LangLang/View/ExamSlotGUI/ExamApplications.xaml.cs
new file mode 100644
index 00000000..8a2c7ad7
--- /dev/null
+++ b/LangLang/View/ExamSlotGUI/ExamApplications.xaml.cs
@@ -0,0 +1,31 @@
+using LangLang.Core.Controller;
+using LangLang.DTO;
+using System.Windows;
+
+
+namespace LangLang.View.ExamSlotGUI
+{
+ ///
+ /// Interaction logic for ExamApplications.xaml
+ ///
+ public partial class ExamApplications : Window
+ {
+ public StudentDTO SelectedStudent { get; set; }
+ public ExamApplications(AppController appController)
+ {
+ InitializeComponent();
+
+ }
+
+ private void conifrmListBtn_Click(object sender, RoutedEventArgs e)
+ {
+ // TODO: implement
+ }
+
+ private void disallowBtn_Click(object sender, RoutedEventArgs e)
+ {
+ // TODO: implement
+ }
+
+ }
+}
diff --git a/LangLang/View/TutorWindow.xaml b/LangLang/View/TutorWindow.xaml
index 0d6540d2..e0a752f0 100644
--- a/LangLang/View/TutorWindow.xaml
+++ b/LangLang/View/TutorWindow.xaml
@@ -5,18 +5,25 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LangLang"
mc:Ignorable="d"
- Title="TutorWindow" Height="450" Width="600">
+ WindowStartupLocation="CenterScreen"
+ Title="TutorWindow" Height="550" Width="600"
+ ResizeMode="NoResize">
+
+
+
+
+
-
-
+
-
+
@@ -91,10 +98,14 @@
-
-
+
+
+
+
+
+
@@ -102,7 +113,7 @@
x:Name="ExamSlotsDataGrid"
ItemsSource="{Binding ExamSlots, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedExamSlot, UpdateSourceTrigger=PropertyChanged}"
- SelectionMode="Single" IsReadOnly="True">
+ SelectionMode="Single" IsReadOnly="True" SelectionChanged="ExamSlotsDataGrid_SelectionChanged">
@@ -115,5 +126,5 @@
-
+
diff --git a/LangLang/View/TutorWindow.xaml.cs b/LangLang/View/TutorWindow.xaml.cs
index 6e1bbc83..c330944b 100644
--- a/LangLang/View/TutorWindow.xaml.cs
+++ b/LangLang/View/TutorWindow.xaml.cs
@@ -1,29 +1,13 @@
using LangLang.Core.Controller;
using LangLang.Core.Model;
-
using LangLang.DTO;
using LangLang.View;
using LangLang.View.CourseGUI;
using LangLang.View.ExamSlotGUI;
using LangLang.Core.Observer;
-using System;
-using System.Collections.Generic;
using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using System.Data;
-using System.Reflection;
-using System.Xml.Linq;
-using System.Reflection.Emit;
using System.Diagnostics;
namespace LangLang
@@ -51,17 +35,20 @@ public TutorWindow(AppController appController, Profile currentlyLoggedIn)
this.tutor = appController.TutorController.GetAllTutors()[currentlyLoggedIn.Id];
InitializeComponent();
DataContext = this;
- courseDeleteBtn.IsEnabled = false;
- courseUpdateBtn.IsEnabled = false;
this.appController = appController;
examSlotsController = appController.ExamSlotController;
coursesController = appController.CourseController;
+
ExamSlots = new ObservableCollection();
Courses = new ObservableCollection();
-
+
+ disableButtonsES();
+ disableButtonsCourse();
+
coursesController.Subscribe(this);
examSlotsController.Subscribe(this);
+
Update();
}
@@ -83,47 +70,14 @@ public void Update()
private void ExamSlotCreateWindowBtn_Click(object sender, RoutedEventArgs e)
{
- //fix to courses by tutor
- Trace.WriteLine("U tutorwindow " + coursesController.GetAllCourses().Count);
-
ExamSlotCreateWindow examSlotCreateWindow = new ExamSlotCreateWindow(coursesController.GetCoursesByTutor(tutor), examSlotsController);
examSlotCreateWindow.Show();
}
private void ExamSlotUpdateWindowBtn_Click(object sender, RoutedEventArgs e)
{
-
- if (SelectedExamSlot == null)
- {
- MessageBox.Show("No exam slot selected. Please select an exam slot.");
- }
- else
- {
-
ExamSlotUpdateWindow examSlotUpdateWindow = new ExamSlotUpdateWindow(SelectedExamSlot, coursesController.GetCoursesByTutor(tutor), examSlotsController);
examSlotUpdateWindow.Show();
-
-
- }
- /*
- if (SelectedExamSlot == null)
- {
- MessageBox.Show("No exam slot selected. Please select an exam slot.");
- }else
- {
- bool canBeUpdated = examSlotsController.Update(SelectedExamSlot.ToExamSlot());
- if (!canBeUpdated)
- {
- MessageBox.Show("Exam can not be updated. There is less than 2 weeks left before the exam.");
- }else
- {
- ExamSlotUpdateWindow examSlotUpdateWindow = new ExamSlotUpdateWindow(SelectedExamSlot, coursesController.GetAllCourses(), examSlotsController);
- examSlotUpdateWindow.Show();
- }
-
- }
- */
-
}
private void CourseCreateWindowBtn_Click(object sender, RoutedEventArgs e)
@@ -191,6 +145,21 @@ private void CoursesTable_SelectionChanged(object sender, SelectionChangedEventA
}
}
+ private void disableButtonsCourse()
+ {
+ courseUpdateBtn.IsEnabled = false;
+ courseDeleteBtn.IsEnabled = false;
+ }
+ private void enableButtonsCourse()
+ {
+ if (SelectedCourse == null) {
+ disableButtonsCourse();
+ } else
+ {
+ enableButtonsCourse();
+ }
+ }
+
private void disableButtonsCourse()
{
courseUpdateBtn.IsEnabled = false;
@@ -207,5 +176,43 @@ private void ExamSlotSearchBtn_Click(object sender, RoutedEventArgs e)
ExamSlotSearchWindow examSlotSearchWindow = new ExamSlotSearchWindow(coursesController, examSlotsController, tutor.Id);
examSlotSearchWindow.Show();
}
+
+ private void disableButtonsES()
+ {
+ deleteExamBtn.IsEnabled = false;
+ updateExamBtn.IsEnabled = false;
+ examApplicationBtn.IsEnabled = false;
+ enterResultsBtn.IsEnabled = false;
+ }
+
+ private void enableButtonsES()
+ {
+ deleteExamBtn.IsEnabled = true;
+ updateExamBtn.IsEnabled = true;
+ examApplicationBtn.IsEnabled = true;
+ enterResultsBtn.IsEnabled = true;
+ }
+
+ private void ButtonSeeStudentInfo_Click(object sender, RoutedEventArgs e)
+ {
+ ExamApplications applicationsWindow = new ExamApplications(appController);
+ applicationsWindow.Show();
+ }
+
+ private void ButtonEnterResults_Click(object sender, RoutedEventArgs e)
+ {
+ // TODO: implement
+ }
+
+ private void ExamSlotsDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (SelectedExamSlot == null) // when the DataGrid listener is triggered, check if there is a selection, and based on that, decide whether to enable or disable the buttons
+ {
+ disableButtonsES();
+ } else {
+ enableButtonsES();
+ }
+ }
+
}
}