diff --git a/HFUTCourseSimulation/Dialog/EditCourse.xaml b/HFUTCourseSimulation/Dialog/EditCourse.xaml
index 930d044..250e5cb 100644
--- a/HFUTCourseSimulation/Dialog/EditCourse.xaml
+++ b/HFUTCourseSimulation/Dialog/EditCourse.xaml
@@ -25,7 +25,7 @@
-
+
diff --git a/HFUTCourseSimulation/Dialog/EditCourse.xaml.cs b/HFUTCourseSimulation/Dialog/EditCourse.xaml.cs
index 6251b37..705af88 100644
--- a/HFUTCourseSimulation/Dialog/EditCourse.xaml.cs
+++ b/HFUTCourseSimulation/Dialog/EditCourse.xaml.cs
@@ -85,16 +85,10 @@ namespace HFUTCourseSimulation.Dialog {
CurrentCourse.Schedules.Clear();
}
- private void uiColorPicker_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
- var color = Util.Win32Dialog.PickColor();
- if (color is null) return;
- else CurrentCourse.Color.Background = color.Value;
- }
-
- private void uiColorPicker_MouseRightButtonDown(object sender, MouseButtonEventArgs e) {
- var color = Util.Win32Dialog.PickColor();
- if (color is null) return;
- else CurrentCourse.Color.Foreground = color.Value;
+ private void uiColorPicker_MouseDown(object sender, MouseButtonEventArgs e) {
+ var widget = new Widget.ColorPicker();
+ widget.CurrentColor = CurrentCourse.Color;
+ widget.ShowDialog();
}
}
diff --git a/HFUTCourseSimulation/HFUTCourseSimulation.csproj b/HFUTCourseSimulation/HFUTCourseSimulation.csproj
index 3f3d830..32f71fc 100644
--- a/HFUTCourseSimulation/HFUTCourseSimulation.csproj
+++ b/HFUTCourseSimulation/HFUTCourseSimulation.csproj
@@ -96,6 +96,9 @@
+
+ ColorPicker.xaml
+
LogChecker.xaml
@@ -123,6 +126,10 @@
MainWindow.xaml
Code
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/HFUTCourseSimulation/Widget/ColorPicker.xaml b/HFUTCourseSimulation/Widget/ColorPicker.xaml
new file mode 100644
index 0000000..37c8c14
--- /dev/null
+++ b/HFUTCourseSimulation/Widget/ColorPicker.xaml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HFUTCourseSimulation/Widget/ColorPicker.xaml.cs b/HFUTCourseSimulation/Widget/ColorPicker.xaml.cs
new file mode 100644
index 0000000..6080bd6
--- /dev/null
+++ b/HFUTCourseSimulation/Widget/ColorPicker.xaml.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+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;
+
+namespace HFUTCourseSimulation.Widget {
+ ///
+ /// Interaction logic for ColorPicker.xaml
+ ///
+ public partial class ColorPicker : Window {
+ public ColorPicker() {
+ InitializeComponent();
+ }
+
+ public Kernel.Data.Ui.ColorPair CurrentColor { get; set; }
+ private Color _foregroundBackup, _backgroundBackup;
+
+ private void uiMainWindow_Loaded(object sender, RoutedEventArgs e) {
+ // Set context and backup color for restoring
+ uiPicker.DataContext = CurrentColor;
+ _foregroundBackup = CurrentColor.Foreground;
+ _backgroundBackup = CurrentColor.Background;
+ }
+
+ private void uiMainWindow_Closed(object sender, EventArgs e) {
+ uiPicker.DataContext = null;
+ }
+
+ private void uiForegroundPicker_MouseDown(object sender, MouseButtonEventArgs e) {
+ var color = Util.Win32Dialog.PickColor();
+ if (color is null) return;
+ else CurrentColor.Foreground = color.Value;
+ }
+ private void uiBackgroundPicker_MouseDown(object sender, MouseButtonEventArgs e) {
+ var color = Util.Win32Dialog.PickColor();
+ if (color is null) return;
+ else CurrentColor.Background = color.Value;
+ }
+
+ private void uiBtnOk_Click(object sender, RoutedEventArgs e) {
+ this.Close();
+ }
+
+ private void uiBtnCancel_Click(object sender, RoutedEventArgs e) {
+ // Restore and quit
+ CurrentColor.Foreground = _foregroundBackup;
+ CurrentColor.Background = _backgroundBackup;
+ this.Close();
+ }
+ }
+}
diff --git a/HFUTCourseSimulation/Widget/LogChecker.xaml b/HFUTCourseSimulation/Widget/LogChecker.xaml
index 8d8e24e..636c988 100644
--- a/HFUTCourseSimulation/Widget/LogChecker.xaml
+++ b/HFUTCourseSimulation/Widget/LogChecker.xaml
@@ -7,7 +7,7 @@
xmlns:uidata="clr-namespace:HFUTCourseSimulation.Kernel"
mc:Ignorable="d"
x:Name="uiMainWindow"
- Title="检查器日志" Height="500" Width="400" Closed="uiMainWindow_Closed" Loaded="uiMainWindow_Loaded">
+ Title="检查器日志" Height="500" Width="400" WindowStyle="ToolWindow" Closed="uiMainWindow_Closed" Loaded="uiMainWindow_Loaded">
@@ -32,6 +32,6 @@
-
+