Skip to content

Commit

Permalink
修复新建课程时任一属性没有修改就无法保存的问题,允许在编辑课程表时操作黑板贴
Browse files Browse the repository at this point in the history
  • Loading branch information
STBBRD committed May 25, 2024
1 parent 2eb83e0 commit b069c93
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
17 changes: 15 additions & 2 deletions ZongziTEK_Blackboard_Sticker/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1046,12 +1046,19 @@ private void LoadCurriculum()
}
}

private bool isTimetableEditorOpen = false;

private void editCurriculumButton_Click(object sender, RoutedEventArgs e)
{
if (Settings.TimetableSettings.IsTimetableEnabled)
{
new TimetableEditor().ShowDialog();
LoadTimetableorCurriculum();
if (!isTimetableEditorOpen)
{
TimetableEditor timetableEditor = new();
timetableEditor.Closed += TimetableEditor_Closed;
isTimetableEditorOpen = true;
timetableEditor.Show();
}
}
else
{
Expand All @@ -1063,6 +1070,12 @@ private void editCurriculumButton_Click(object sender, RoutedEventArgs e)
}
}

private void TimetableEditor_Closed(object sender, EventArgs e)
{
LoadTimetableorCurriculum();
isTimetableEditorOpen = false;
}

private void saveCurriculumButton_Click(object sender, RoutedEventArgs e)
{
SaveCurriculum();
Expand Down
10 changes: 8 additions & 2 deletions ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private void Item_LessonInfoChanged(object sender, EventArgs e)
changedItem.Margin = new Thickness(0);
}
}
catch { }
catch (Exception ex) { MessageBox.Show(ex.Message); }
}

isEdited = true;
Expand All @@ -155,7 +155,13 @@ private void Item_LessonDeleting(object sender, EventArgs e)

private void ButtonInsertLesson_Click(object sender, RoutedEventArgs e)
{
TimetableEditorItem item = new TimetableEditorItem();
TimetableEditorItem item = new TimetableEditorItem()
{
Subject = "",
StartTime = "00:00",
EndTime = "00:00",
IsSplitBelow = false
};
item.LessonInfoChanged += Item_LessonInfoChanged;
item.LessonDeleting += Item_LessonDeleting;
GetSelectedDay().Add(new Lesson("", new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0), false));
Expand Down

0 comments on commit b069c93

Please sign in to comment.