From 1626c89d3245ede77441e592a8a5b584450156e8 Mon Sep 17 00:00:00 2001 From: STBBRD <62409850+STBBRD@users.noreply.github.com> Date: Sat, 21 Sep 2024 11:04:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=AF=BE=E7=A8=8B=E8=A1=A8?= =?UTF-8?q?=E6=97=B6=E8=87=AA=E5=8A=A8=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZongziTEK_Blackboard_Sticker/Classes/Timetable.cs | 8 ++++++++ ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml | 2 +- ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml.cs | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ZongziTEK_Blackboard_Sticker/Classes/Timetable.cs b/ZongziTEK_Blackboard_Sticker/Classes/Timetable.cs index 9816599..d4a8965 100644 --- a/ZongziTEK_Blackboard_Sticker/Classes/Timetable.cs +++ b/ZongziTEK_Blackboard_Sticker/Classes/Timetable.cs @@ -35,6 +35,14 @@ public string ToCurriculums(List list) } return curriculums; } + + public void Sort(Timetable timetable) + { + foreach (List day in new[] { timetable.Monday, timetable.Tuesday, timetable.Wednesday, timetable.Thursday, timetable.Friday, timetable.Saturday, timetable.Sunday, timetable.Temp }) + { + day.Sort((x, y) => x.StartTime.CompareTo(y.StartTime)); + } + } } public class Lesson diff --git a/ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml b/ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml index d3c8506..5e06a07 100644 --- a/ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml +++ b/ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml @@ -97,7 +97,7 @@ diff --git a/ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml.cs b/ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml.cs index d207dac..104b29d 100644 --- a/ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml.cs +++ b/ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml.cs @@ -67,6 +67,8 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs private void ButtonSave_Click(object sender, RoutedEventArgs e) { + Timetable.Sort(Timetable); + string text = JsonConvert.SerializeObject(Timetable, Formatting.Indented); try { @@ -75,6 +77,8 @@ private void ButtonSave_Click(object sender, RoutedEventArgs e) catch { } isEdited = false; + LoadTimetable(); + //isCloseWithoutWarning = true; //Close(); }