From 398ebb8d865e25bb5c25468c1591059880eed4b9 Mon Sep 17 00:00:00 2001
From: STBBRD <62409850+STBBRD@users.noreply.github.com>
Date: Sat, 19 Oct 2024 21:00:31 +0800
Subject: [PATCH] =?UTF-8?q?=E2=80=9C=E9=98=B3=E9=97=B4=E5=8C=96=E2=80=9D?=
=?UTF-8?q?=E5=B0=8F=E9=BB=91=E6=9D=BF=E9=A2=9C=E8=89=B2=E9=80=89=E6=8B=A9?=
=?UTF-8?q?=E7=95=8C=E9=9D=A2=20=E7=AD=89=202=20=E9=A1=B9=E8=B0=83?=
=?UTF-8?q?=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## 小黑板颜色选择界面
- 优化外观
- 加入画笔大小调节
- 在画笔为黑色或白色时,调整色相,提醒用户调整饱和度
## 上下课通知
- 修复倒计时显示 "-01" 的问题
---
ZongziTEK_Blackboard_Sticker/MainWindow.xaml | 52 ++++++++++++++-----
.../MainWindow.xaml.cs | 44 ++++++++++------
.../TimetableNotificationWindow.xaml.cs | 36 ++++++++++---
3 files changed, 93 insertions(+), 39 deletions(-)
diff --git a/ZongziTEK_Blackboard_Sticker/MainWindow.xaml b/ZongziTEK_Blackboard_Sticker/MainWindow.xaml
index e4c2018..17670ee 100644
--- a/ZongziTEK_Blackboard_Sticker/MainWindow.xaml
+++ b/ZongziTEK_Blackboard_Sticker/MainWindow.xaml
@@ -91,26 +91,50 @@
HorizontalAlignment="Right" Visibility="{Binding Visibility, ElementName=eraserButton}">
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
diff --git a/ZongziTEK_Blackboard_Sticker/MainWindow.xaml.cs b/ZongziTEK_Blackboard_Sticker/MainWindow.xaml.cs
index 2ddcca6..c5e7019 100644
--- a/ZongziTEK_Blackboard_Sticker/MainWindow.xaml.cs
+++ b/ZongziTEK_Blackboard_Sticker/MainWindow.xaml.cs
@@ -290,33 +290,41 @@ private void btnClearOK_Click(object sender, RoutedEventArgs e)
//touchGrid.Visibility = Visibility.Visible;
}
- private void squarePicker_ColorChanged(object sender, RoutedEventArgs e)
- {
- borderShowColor.Background = new SolidColorBrush(squarePicker.SelectedColor);
- inkCanvas.DefaultDrawingAttributes.Color = squarePicker.SelectedColor;
- }
- private void btnWhite_Click(object sender, RoutedEventArgs e)
+ private void BorderColorSelector_MouseUp(object sender, MouseButtonEventArgs e)
{
- squarePicker.SelectedColor = ((SolidColorBrush)btnWhite.Background).Color;
+ if (sender is Border)
+ {
+ Border border = (Border)sender;
+ squarePicker.SelectedColor = ((SolidColorBrush)border.Background).Color;
+ }
}
- private void btnBlue_Click(object sender, RoutedEventArgs e)
+ private void squarePicker_PreviewMouseUp(object sender, MouseButtonEventArgs e)
{
- squarePicker.SelectedColor = ((SolidColorBrush)btnBlue.Background).Color;
+ if (squarePicker.ColorState.HSL_S == 0 || squarePicker.ColorState.HSL_L == 0)
+ {
+ TeachingTipColorPicker.IsOpen = true;
+ }
}
- private void btnYellow_Click(object sender, RoutedEventArgs e)
+ private void squarePicker_ColorChanged(object sender, RoutedEventArgs e)
{
- squarePicker.SelectedColor = ((SolidColorBrush)btnYellow.Background).Color;
+ borderShowColor.Background = new SolidColorBrush(squarePicker.SelectedColor);
+ inkCanvas.DefaultDrawingAttributes.Color = squarePicker.SelectedColor;
}
- private void btnRed_Click(object sender, RoutedEventArgs e)
+ private void btnCloseColorPicker_Click(object sender, RoutedEventArgs e)
{
- squarePicker.SelectedColor = ((SolidColorBrush)btnRed.Background).Color;
+ HideColorPicker();
}
- private void btnCloseColorPicker_Click(object sender, RoutedEventArgs e)
+
+ private void SliderPenThickness_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
{
- borderColorPicker.Visibility = Visibility.Collapsed;
+ if (drawingAttributes != null)
+ {
+ drawingAttributes.Width = SliderPenThickness.Value;
+ drawingAttributes.Height = SliderPenThickness.Value;
+ }
}
private void ToggleButtonLock_Click(object sender, RoutedEventArgs e)
@@ -433,6 +441,8 @@ private void ShowColorPicker()
private async void HideColorPicker()
{
+ TeachingTipColorPicker.IsOpen = false;
+
ThicknessAnimation marginAnimation = new()
{
From = originalColorPickerMargin,
@@ -1983,7 +1993,7 @@ public static void SetTheme()
if (window.inkCanvas.DefaultDrawingAttributes.Color == Colors.White)
{
- window.btnWhite_Click(null, null);
+ window.inkCanvas.DefaultDrawingAttributes.Color = Colors.Black;
}
foreach (Stroke stroke in window.inkCanvas.Strokes)
@@ -2005,7 +2015,7 @@ public static void SetTheme()
if (window.inkCanvas.DefaultDrawingAttributes.Color == Colors.Black)
{
- window.btnWhite_Click(null, null);
+ window.inkCanvas.DefaultDrawingAttributes.Color = Colors.White;
}
foreach (Stroke stroke in window.inkCanvas.Strokes)
{
diff --git a/ZongziTEK_Blackboard_Sticker/TimetableNotificationWindow.xaml.cs b/ZongziTEK_Blackboard_Sticker/TimetableNotificationWindow.xaml.cs
index b599389..9be9ace 100644
--- a/ZongziTEK_Blackboard_Sticker/TimetableNotificationWindow.xaml.cs
+++ b/ZongziTEK_Blackboard_Sticker/TimetableNotificationWindow.xaml.cs
@@ -86,13 +86,15 @@ private void Timer_Tick(object sender, EventArgs e)
timeLeft = timeToHide - DateTime.Now.TimeOfDay;
TextTime.Text = timeLeft.TotalSeconds.ToString("00");
- if (timeLeft.TotalSeconds == 1)
+ if (timeLeft.TotalSeconds <= 1)
{
- if (!isTimeHidden) HideTime();
+ if (!isTimeHidden)
+ HideTime();
}
- else if (timeLeft.TotalSeconds <= 0)
+ if (timeLeft <= TimeSpan.Zero)
{
- if (!isNotificationHidden) HideNotification();
+ if (!isNotificationHidden)
+ HideNotification();
}
}
@@ -106,16 +108,25 @@ private void ShowNotification()
EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }
};
- ThicknessAnimation marginAnimation = new()
+ /*ThicknessAnimation marginAnimation = new()
{
From = new Thickness(0, -160, 0, 0),
To = new Thickness(0),
Duration = TimeSpan.FromMilliseconds(750),
EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }
+ };*/
+
+ DoubleAnimation topAnimation = new()
+ {
+ From = -Height,
+ To = 0,
+ Duration = TimeSpan.FromMilliseconds(750),
+ EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }
};
GridNotification.BeginAnimation(OpacityProperty, opacityAnimation);
- GridNotification.BeginAnimation(MarginProperty, marginAnimation);
+ //GridNotification.BeginAnimation(MarginProperty, marginAnimation);
+ BeginAnimation(TopProperty, topAnimation);
}
private async void HideNotification()
@@ -130,16 +141,25 @@ private async void HideNotification()
EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseIn }
};
- ThicknessAnimation marginAnimation = new()
+ /*ThicknessAnimation marginAnimation = new()
{
From = new Thickness(0),
To = new Thickness(0, -160, 0, 0),
Duration = TimeSpan.FromMilliseconds(750),
EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseIn }
+ };*/
+
+ DoubleAnimation topAnimation = new()
+ {
+ From = 0,
+ To = -Height,
+ Duration = TimeSpan.FromMilliseconds(750),
+ EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseIn }
};
GridNotification.BeginAnimation(OpacityProperty, opacityAnimation);
- GridNotification.BeginAnimation(MarginProperty, marginAnimation);
+ //GridNotification.BeginAnimation(MarginProperty, marginAnimation);
+ BeginAnimation(TopProperty, topAnimation);
await Task.Delay(750);
Close();