From 11da14aeabc3ee7fe246fe9e1c5ad6ca566edd6e Mon Sep 17 00:00:00 2001
From: CJKmkp <2564608840@qq.com>
Date: Mon, 6 Oct 2025 20:11:49 +0800
Subject: [PATCH] =?UTF-8?q?improve:=E8=AE=A1=E6=97=B6=E5=99=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Ink Canvas/Windows/FullscreenTimerWindow.xaml | 95 +++++++++++++
.../Windows/FullscreenTimerWindow.xaml.cs | 126 ++++++++++++++++++
.../Windows/SeewoStyleTimerWindow.xaml.cs | 28 ++--
3 files changed, 236 insertions(+), 13 deletions(-)
create mode 100644 Ink Canvas/Windows/FullscreenTimerWindow.xaml
create mode 100644 Ink Canvas/Windows/FullscreenTimerWindow.xaml.cs
diff --git a/Ink Canvas/Windows/FullscreenTimerWindow.xaml b/Ink Canvas/Windows/FullscreenTimerWindow.xaml
new file mode 100644
index 00000000..3ec9c407
--- /dev/null
+++ b/Ink Canvas/Windows/FullscreenTimerWindow.xaml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ink Canvas/Windows/FullscreenTimerWindow.xaml.cs b/Ink Canvas/Windows/FullscreenTimerWindow.xaml.cs
new file mode 100644
index 00000000..edd56364
--- /dev/null
+++ b/Ink Canvas/Windows/FullscreenTimerWindow.xaml.cs
@@ -0,0 +1,126 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Shapes;
+using System.Timers;
+
+namespace Ink_Canvas
+{
+ ///
+ /// 全屏计时器窗口
+ ///
+ public partial class FullscreenTimerWindow : Window
+ {
+ private SeewoStyleTimerWindow parentWindow;
+ private System.Timers.Timer updateTimer;
+
+ public FullscreenTimerWindow(SeewoStyleTimerWindow parent)
+ {
+ InitializeComponent();
+ parentWindow = parent;
+
+ // 设置窗口位置和大小
+ this.Left = 0;
+ this.Top = 0;
+ this.Width = SystemParameters.PrimaryScreenWidth;
+ this.Height = SystemParameters.PrimaryScreenHeight;
+
+ // 启动更新定时器
+ updateTimer = new System.Timers.Timer(100); // 100ms更新一次
+ updateTimer.Elapsed += UpdateTimer_Elapsed;
+ updateTimer.Start();
+ }
+
+ private void UpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
+ {
+ if (parentWindow != null && parentWindow.IsTimerRunning)
+ {
+ Application.Current.Dispatcher.Invoke(() =>
+ {
+ UpdateTimeDisplay();
+ });
+ }
+ }
+
+ private void UpdateTimeDisplay()
+ {
+ if (parentWindow == null) return;
+
+ // 获取剩余时间
+ var remainingTime = parentWindow.GetRemainingTime();
+ if (remainingTime.HasValue)
+ {
+ var timeSpan = remainingTime.Value;
+ int hours = (int)timeSpan.TotalHours;
+ int minutes = timeSpan.Minutes;
+ int seconds = timeSpan.Seconds;
+
+ // 更新小时显示
+ SetDigitDisplay("FullHour1Display", hours / 10);
+ SetDigitDisplay("FullHour2Display", hours % 10);
+
+ // 更新分钟显示
+ SetDigitDisplay("FullMinute1Display", minutes / 10);
+ SetDigitDisplay("FullMinute2Display", minutes % 10);
+
+ // 更新秒显示
+ SetDigitDisplay("FullSecond1Display", seconds / 10);
+ SetDigitDisplay("FullSecond2Display", seconds % 10);
+ }
+ }
+
+ private void SetDigitDisplay(string pathName, int digit)
+ {
+ var path = this.FindName(pathName) as Path;
+ if (path != null)
+ {
+ string resourceKey = $"Digit{digit}";
+ var geometry = this.FindResource(resourceKey) as Geometry;
+ if (geometry != null)
+ {
+ path.Data = geometry;
+ }
+ }
+ }
+
+ private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ // 点击屏幕退出全屏
+ ExitFullscreen();
+ }
+
+ private void Window_KeyDown(object sender, KeyEventArgs e)
+ {
+ // 按ESC键退出全屏
+ if (e.Key == Key.Escape)
+ {
+ ExitFullscreen();
+ }
+ }
+
+ private void ExitFullscreen()
+ {
+ // 恢复主窗口
+ if (parentWindow != null)
+ {
+ parentWindow.Show();
+ parentWindow.Activate();
+ parentWindow.WindowState = WindowState.Normal;
+ }
+ this.Close();
+ }
+
+ protected override void OnClosed(EventArgs e)
+ {
+ // 清理资源
+ if (updateTimer != null)
+ {
+ updateTimer.Stop();
+ updateTimer.Dispose();
+ }
+ base.OnClosed(e);
+ }
+ }
+}
diff --git a/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml.cs b/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml.cs
index 57be3dd1..98b1b1bc 100644
--- a/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml.cs
+++ b/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml.cs
@@ -555,19 +555,6 @@ namespace Ink_Canvas
}
}
- private void Fullscreen_Click(object sender, RoutedEventArgs e)
- {
- if (WindowState == WindowState.Normal)
- {
- WindowState = WindowState.Maximized;
- }
- else
- {
- WindowState = WindowState.Normal;
- }
- }
-
-
private void PlayTimerSound()
{
try
@@ -1014,5 +1001,20 @@ namespace Ink_Canvas
{
}
}
+
+ private void Fullscreen_Click(object sender, RoutedEventArgs e)
+ {
+ ShowFullscreenTimer();
+ }
+
+ private void ShowFullscreenTimer()
+ {
+ // 创建全屏计时器窗口
+ var fullscreenWindow = new FullscreenTimerWindow(this);
+ fullscreenWindow.Show();
+
+ // 隐藏主窗口
+ this.Hide();
+ }
}
}