diff --git a/HFUTCourseSimulation/Dialog/Simulator.xaml b/HFUTCourseSimulation/Dialog/Simulator.xaml
index 6f16129..efeed49 100644
--- a/HFUTCourseSimulation/Dialog/Simulator.xaml
+++ b/HFUTCourseSimulation/Dialog/Simulator.xaml
@@ -19,7 +19,7 @@
-
+
diff --git a/HFUTCourseSimulation/Dialog/Simulator.xaml.cs b/HFUTCourseSimulation/Dialog/Simulator.xaml.cs
index 3036db0..7af8109 100644
--- a/HFUTCourseSimulation/Dialog/Simulator.xaml.cs
+++ b/HFUTCourseSimulation/Dialog/Simulator.xaml.cs
@@ -1,5 +1,4 @@
-using HFUTCourseSimulation.Kernel.Data.Presentation;
-using HFUTCourseSimulation.Util;
+using HFUTCourseSimulation.Util;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -29,6 +28,22 @@ namespace HFUTCourseSimulation.Dialog {
"星期日"
};
+ private static readonly ColorPair HEADBAR_COLOR = Util.ColorPreset.MdColors.Grey;
+ private static ColorPair GetSidebarColor(Kernel.Data.Presentation.IndexKind kind) {
+ switch (kind) {
+ case Kernel.Data.Presentation.IndexKind.Dawn:
+ return Util.ColorPreset.MdColors.Cyan;
+ case Kernel.Data.Presentation.IndexKind.Morning:
+ return Util.ColorPreset.MdColors.LightBlue;
+ case Kernel.Data.Presentation.IndexKind.Afternoon:
+ return Util.ColorPreset.MdColors.Amber;
+ case Kernel.Data.Presentation.IndexKind.Night:
+ return Util.ColorPreset.MdColors.BlueGrey;
+ default:
+ return Util.ColorPreset.MdColors.Grey;
+ }
+ }
+
public Simulator() {
InitializeComponent();
@@ -55,12 +70,19 @@ namespace HFUTCourseSimulation.Dialog {
for (int i = 0; i < CurrentSemester.indexCount; ++i) {
uiCoreGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
}
- // Set header bar
-
+ // Set head bar
+ var headbar = new Rectangle();
+ headbar.Fill = new SolidColorBrush(HEADBAR_COLOR.Background);
+ Grid.SetRow(headbar, 0);
+ Grid.SetRowSpan(headbar, 2);
+ Grid.SetColumn(headbar, 0);
+ Grid.SetColumnSpan(headbar, WEEK_NAMES.Length + 1);
+ uiCoreGrid.Children.Add(headbar);
// Setup week text block
for (int week = 1; week <= WEEK_NAMES.Length; ++week) {
var weekLabel = new TextBlock();
weekLabel.Text = WEEK_NAMES[week - 1];
+ weekLabel.Foreground = new SolidColorBrush(HEADBAR_COLOR.Foreground);
weekLabel.HorizontalAlignment = HorizontalAlignment.Center;
Grid.SetRow(weekLabel, 0);
Grid.SetColumn(weekLabel, week - 1 + 1);
@@ -68,6 +90,7 @@ namespace HFUTCourseSimulation.Dialog {
var weekDateLabel = new TextBlock();
weekDateLabel.Text = "N/A";
+ weekDateLabel.Foreground = new SolidColorBrush(HEADBAR_COLOR.Foreground);
weekDateLabel.HorizontalAlignment = HorizontalAlignment.Center;
Grid.SetRow(weekDateLabel, 1);
Grid.SetColumn(weekDateLabel, week - 1 + 1);
@@ -75,10 +98,19 @@ namespace HFUTCourseSimulation.Dialog {
weekTextBlocks.Add(weekDateLabel);
}
- // Setup index text block
+ // Setup sidebar and index text block
for (int index = 1; index <= CurrentSemester.indexCount; ++index) {
+ var color = GetSidebarColor(CurrentSemester.GetIndexKind(index));
+
+ var sidebar = new Rectangle();
+ sidebar.Fill = new SolidColorBrush(color.Background);
+ Grid.SetColumn(sidebar, 0);
+ Grid.SetRow(sidebar, index - 1 + 2);
+ uiCoreGrid.Children.Add(sidebar);
+
var indexLabel = new TextBlock();
indexLabel.Text = index.ToString();
+ indexLabel.Foreground = new SolidColorBrush(color.Foreground);
indexLabel.VerticalAlignment = VerticalAlignment.Center;
indexLabel.HorizontalAlignment = HorizontalAlignment.Center;
Grid.SetColumn(indexLabel, 0);
@@ -93,6 +125,7 @@ namespace HFUTCourseSimulation.Dialog {
Grid.SetColumn(cornerLabel, 0);
Grid.SetRow(cornerLabel, 0);
Grid.SetRowSpan(cornerLabel, 2);
+ uiCoreGrid.Children.Add(cornerLabel);
// Render for week 1
currentWeek = 1;
@@ -128,6 +161,7 @@ namespace HFUTCourseSimulation.Dialog {
// 更新当天课程
foreach (var lesson in day.lessons) {
var courseBlock = new Border();
+ courseBlock.ToolTip = lesson.description;
courseBlock.Background = new SolidColorBrush(lesson.color.Background);
courseBlock.CornerRadius = new CornerRadius(5);
Grid.SetColumn(courseBlock, i + 1);
@@ -138,7 +172,6 @@ namespace HFUTCourseSimulation.Dialog {
var courseNameLabel = new TextBlock();
courseNameLabel.Text = lesson.name;
- courseNameLabel.ToolTip = lesson.description;
courseNameLabel.Foreground = new SolidColorBrush(lesson.color.Foreground);
courseNameLabel.HorizontalAlignment = HorizontalAlignment.Left;
courseNameLabel.VerticalAlignment = VerticalAlignment.Center;
@@ -148,9 +181,12 @@ namespace HFUTCourseSimulation.Dialog {
// 更新教学周序号
uiWeek.Text = currentWeek.ToString();
+ // 更新按钮启用情况
+ uiBtnPrev.IsEnabled = currentWeek > 1;
+ uiBtnNext.IsEnabled = currentWeek < CurrentSemester.weekCount;
}
- private void uiBtnPre_Click(object sender, RoutedEventArgs e) {
+ private void uiBtnPrev_Click(object sender, RoutedEventArgs e) {
if (currentWeek == 1) {
Win32Dialog.Info("已经是第一周了", "错误");
return;
diff --git a/HFUTCourseSimulation/HFUTCourseSimulation.csproj b/HFUTCourseSimulation/HFUTCourseSimulation.csproj
index 0b61d15..03cd914 100644
--- a/HFUTCourseSimulation/HFUTCourseSimulation.csproj
+++ b/HFUTCourseSimulation/HFUTCourseSimulation.csproj
@@ -91,11 +91,6 @@
-
- Simulation.xaml
-
-
-
@@ -123,9 +118,6 @@
MainWindow.xaml
Code
-
- MSBuild:Compile
-
diff --git a/HFUTCourseSimulation/MainWindow.xaml.cs b/HFUTCourseSimulation/MainWindow.xaml.cs
index 40729e9..832c3da 100644
--- a/HFUTCourseSimulation/MainWindow.xaml.cs
+++ b/HFUTCourseSimulation/MainWindow.xaml.cs
@@ -283,7 +283,7 @@ namespace HFUTCourseSimulation {
private void uiMenuAbout_Click(object sender, RoutedEventArgs e) {
Win32Dialog.Info(@"本程序为开源程序。
开源地址:https://gitee.com/yyc12345/HFUTCourseSimulation
-本程序旨在为各位选课的同学提供一个用于查验课程冲突以及查看课表的功能。如果您想参与开发,提交PullRequest即可,欢迎您的加入。", "关于");
+本程序旨在为我个人提供用于查验课程冲突,以及离线查看课表的功能。", "关于");
}
#endregion