Skip to content

Commit

Permalink
为旧版课程表添加临时课表
Browse files Browse the repository at this point in the history
  • Loading branch information
STBBRD committed Nov 25, 2023
1 parent fbd69cc commit 552b750
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 25 deletions.
7 changes: 7 additions & 0 deletions ZongziTEK_Blackboard_Sticker/Classes/Curriculums.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand All @@ -15,6 +16,7 @@ public class Curriculums
public Sunday Sunday { get; set; } = new Sunday();
public Thursday Thursday { get; set; } = new Thursday();
public Saturday Saturday { get; set; } = new Saturday();
public Temp Temp { get; set; } = new Temp();
}

public class Monday
Expand Down Expand Up @@ -51,4 +53,9 @@ public class Sunday
{
public string Curriculums { get; set; }
}

public class Temp
{
public string Curriculums { get; set; }
}
}
7 changes: 5 additions & 2 deletions ZongziTEK_Blackboard_Sticker/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@

<TextBlock Text="周日" FontSize="24" Foreground="{DynamicResource ForegroundColor}"/>
<TextBox x:Name="textBoxSunday" AcceptsReturn="True" TextWrapping="Wrap" FontSize="16" Foreground="{DynamicResource ForegroundColor}"/>

<TextBlock Text="临时" FontSize="24" Foreground="{DynamicResource ForegroundColor}"/>
<TextBox x:Name="textBoxTempCurriculums" AcceptsReturn="True" TextWrapping="Wrap" FontSize="16" Foreground="{DynamicResource ForegroundColor}"/>
</ui:SimpleStackPanel>
</ScrollViewer>
<!--设置-->
Expand Down Expand Up @@ -198,8 +201,8 @@
<ui:ToggleSwitch Name="ToggleSwitchUseTimetable" Header="使用带时间信息的课程表" OnContent="" OffContent="" IsOn="True" Toggled="ToggleSwitchUseTimetable_Toggled" Foreground="{DynamicResource ForegroundColor}"/>
<TextBlock Text="开启上面的开关后,将使用带时间信息的课程表,并且出现上下课提醒功能。关闭上面的开关后,课程表就是文本信息,方便编辑,但没有上下课提醒。&#10;注意:如果需要使用上下课提醒,请下载 黑板通知服务 (https://github.com/STBBRD/Blackboard-Notification-Service)"
TextWrapping="Wrap" Opacity="0.75"/>
<ui:ToggleSwitch Name="ToggleSwitchTimetableNotification" Header="启用上下课提醒" OnContent="" OffContent="" IsOn="True" Toggled="ToggleSwitchTimetableNotification_Toggled" Foreground="{DynamicResource ForegroundColor}"/>
<ui:ToggleSwitch Name="ToggleSwitchTempTimetable" Header="展示临时课表" OnContent="" OffContent="" IsOn="False" Toggled="ToggleSwitchTempTimetable_Toggled" Foreground="{DynamicResource ForegroundColor}" IsEnabled="{Binding IsOn, ElementName=ToggleSwitchUseTimetable}"/>
<ui:ToggleSwitch Name="ToggleSwitchTimetableNotification" Header="启用上下课提醒" OnContent="" OffContent="" IsOn="True" Toggled="ToggleSwitchTimetableNotification_Toggled" Foreground="{DynamicResource ForegroundColor}" IsEnabled="{Binding IsOn, ElementName=ToggleSwitchUseTimetable}"/>
<ui:ToggleSwitch Name="ToggleSwitchTempTimetable" Header="展示临时课表" OnContent="" OffContent="" IsOn="False" Toggled="ToggleSwitchTempTimetable_Toggled" Foreground="{DynamicResource ForegroundColor}"/>
<ui:ToggleSwitch Name="ToggleSwitchUseDefaultBNSPath" Header="使用默认黑板通知服务路径" OnContent="" OffContent="" IsOn="True" Toggled="ToggleSwitchUseDefaultBNSPath_Toggled" Foreground="{DynamicResource ForegroundColor}"/>
<TextBlock Text="黑板通知服务路径" FontSize="14"/>
<TextBox Name="TextBoxBNSPath" TextChanged="TextBoxBNSPath_TextChanged" Foreground="{DynamicResource ForegroundColor}" IsEnabled="{Binding IsOn, ElementName=ToggleSwitchUseDefaultBNSPath,Converter={StaticResource InverseBooleanConverter}}"/>
Expand Down
55 changes: 32 additions & 23 deletions ZongziTEK_Blackboard_Sticker/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ private void SaveCurriculum()
Curriculums.Friday.Curriculums = textBoxFriday.Text;
Curriculums.Saturday.Curriculums = textBoxSaturday.Text;
Curriculums.Sunday.Curriculums = textBoxSunday.Text;
Curriculums.Temp.Curriculums = textBoxTempCurriculums.Text;

string text = JsonConvert.SerializeObject(Curriculums, Formatting.Indented);

Expand Down Expand Up @@ -748,32 +749,40 @@ private void LoadCurriculum()
textBoxFriday.Text = Curriculums.Friday.Curriculums;
textBoxSaturday.Text = Curriculums.Saturday.Curriculums;
textBoxSunday.Text = Curriculums.Sunday.Curriculums;
textBoxTempCurriculums.Text = Curriculums.Temp.Curriculums;

string day = DateTime.Today.DayOfWeek.ToString();

switch (day)
{
case "Monday":
textBlockCurriculum.Text = Curriculums.Monday.Curriculums;
break;
case "Tuesday":
textBlockCurriculum.Text = Curriculums.Tuesday.Curriculums;
break;
case "Wednesday":
textBlockCurriculum.Text = Curriculums.Wednesday.Curriculums;
break;
case "Thursday":
textBlockCurriculum.Text = Curriculums.Thursday.Curriculums;
break;
case "Friday":
textBlockCurriculum.Text = Curriculums.Friday.Curriculums;
break;
case "Saturday":
textBlockCurriculum.Text = Curriculums.Saturday.Curriculums;
break;
case "Sunday":
textBlockCurriculum.Text = Curriculums.Sunday.Curriculums;
break;
if (!ToggleSwitchTempTimetable.IsOn)
{
switch (day)
{
case "Monday":
textBlockCurriculum.Text = Curriculums.Monday.Curriculums;
break;
case "Tuesday":
textBlockCurriculum.Text = Curriculums.Tuesday.Curriculums;
break;
case "Wednesday":
textBlockCurriculum.Text = Curriculums.Wednesday.Curriculums;
break;
case "Thursday":
textBlockCurriculum.Text = Curriculums.Thursday.Curriculums;
break;
case "Friday":
textBlockCurriculum.Text = Curriculums.Friday.Curriculums;
break;
case "Saturday":
textBlockCurriculum.Text = Curriculums.Saturday.Curriculums;
break;
case "Sunday":
textBlockCurriculum.Text = Curriculums.Sunday.Curriculums;
break;
}
}
else
{
textBlockCurriculum.Text = Curriculums.Temp.Curriculums;
}
}

Expand Down

0 comments on commit 552b750

Please sign in to comment.