From edbe3f8311a1e49b4bd8e1955a66927762d61444 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Mon, 6 Oct 2025 21:17:14 +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 --- .../Windows/SeewoStyleTimerWindow.xaml.cs | 86 +++---------------- 1 file changed, 13 insertions(+), 73 deletions(-) diff --git a/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml.cs b/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml.cs index 135c792b..4e4ad348 100644 --- a/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml.cs +++ b/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml.cs @@ -90,7 +90,7 @@ namespace Ink_Canvas bool isTimerRunning = false; bool isPaused = false; TimeSpan remainingTime = TimeSpan.Zero; - + Timer timer = new Timer(); private Timer hideTimer; private MinimizedTimerWindow minimizedWindow; @@ -395,6 +395,7 @@ namespace Ink_Canvas // 第1位数字(小时十位) private void Digit1Plus_Click(object sender, RoutedEventArgs e) { + if (isTimerRunning) return; int currentHour = hour; int hourTens = currentHour / 10; int hourOnes = currentHour % 10; @@ -404,16 +405,11 @@ namespace Ink_Canvas hour = hourTens * 10 + hourOnes; UpdateDigitDisplays(); - - // 如果计时器正在运行,重新计算剩余时间并继续计时 - if (isTimerRunning && !isPaused) - { - UpdateSpecificTimeUnit(hour, minute, second); - } } private void Digit1Minus_Click(object sender, RoutedEventArgs e) { + if (isTimerRunning) return; int currentHour = hour; int hourTens = currentHour / 10; int hourOnes = currentHour % 10; @@ -423,17 +419,12 @@ namespace Ink_Canvas hour = hourTens * 10 + hourOnes; UpdateDigitDisplays(); - - // 如果计时器正在运行,重新计算剩余时间并继续计时 - if (isTimerRunning && !isPaused) - { - UpdateSpecificTimeUnit(hour, minute, second); - } } // 第2位数字(小时个位) private void Digit2Plus_Click(object sender, RoutedEventArgs e) { + if (isTimerRunning) return; int currentHour = hour; int hourTens = currentHour / 10; int hourOnes = currentHour % 10; @@ -448,16 +439,11 @@ namespace Ink_Canvas hour = hourTens * 10 + hourOnes; UpdateDigitDisplays(); - - // 如果计时器正在运行,重新计算剩余时间并继续计时 - if (isTimerRunning && !isPaused) - { - UpdateSpecificTimeUnit(hour, minute, second); - } } private void Digit2Minus_Click(object sender, RoutedEventArgs e) { + if (isTimerRunning) return; int currentHour = hour; int hourTens = currentHour / 10; int hourOnes = currentHour % 10; @@ -472,17 +458,12 @@ namespace Ink_Canvas hour = hourTens * 10 + hourOnes; UpdateDigitDisplays(); - - // 如果计时器正在运行,重新计算剩余时间并继续计时 - if (isTimerRunning && !isPaused) - { - UpdateSpecificTimeUnit(hour, minute, second); - } } // 第3位数字(分钟十位) private void Digit3Plus_Click(object sender, RoutedEventArgs e) { + if (isTimerRunning) return; int currentMinute = minute; int minuteTens = currentMinute / 10; int minuteOnes = currentMinute % 10; @@ -492,16 +473,11 @@ namespace Ink_Canvas minute = minuteTens * 10 + minuteOnes; UpdateDigitDisplays(); - - // 如果计时器正在运行,重新计算剩余时间并继续计时 - if (isTimerRunning && !isPaused) - { - UpdateSpecificTimeUnit(hour, minute, second); - } } private void Digit3Minus_Click(object sender, RoutedEventArgs e) { + if (isTimerRunning) return; int currentMinute = minute; int minuteTens = currentMinute / 10; int minuteOnes = currentMinute % 10; @@ -511,17 +487,12 @@ namespace Ink_Canvas minute = minuteTens * 10 + minuteOnes; UpdateDigitDisplays(); - - // 如果计时器正在运行,重新计算剩余时间并继续计时 - if (isTimerRunning && !isPaused) - { - UpdateSpecificTimeUnit(hour, minute, second); - } } // 第4位数字(分钟个位) private void Digit4Plus_Click(object sender, RoutedEventArgs e) { + if (isTimerRunning) return; int currentMinute = minute; int minuteTens = currentMinute / 10; int minuteOnes = currentMinute % 10; @@ -536,16 +507,11 @@ namespace Ink_Canvas minute = minuteTens * 10 + minuteOnes; UpdateDigitDisplays(); - - // 如果计时器正在运行,重新计算剩余时间并继续计时 - if (isTimerRunning && !isPaused) - { - UpdateSpecificTimeUnit(hour, minute, second); - } } private void Digit4Minus_Click(object sender, RoutedEventArgs e) { + if (isTimerRunning) return; int currentMinute = minute; int minuteTens = currentMinute / 10; int minuteOnes = currentMinute % 10; @@ -560,17 +526,12 @@ namespace Ink_Canvas minute = minuteTens * 10 + minuteOnes; UpdateDigitDisplays(); - - // 如果计时器正在运行,重新计算剩余时间并继续计时 - if (isTimerRunning && !isPaused) - { - UpdateSpecificTimeUnit(hour, minute, second); - } } // 第5位数字(秒十位) private void Digit5Plus_Click(object sender, RoutedEventArgs e) { + if (isTimerRunning) return; int currentSecond = second; int secondTens = currentSecond / 10; int secondOnes = currentSecond % 10; @@ -580,16 +541,11 @@ namespace Ink_Canvas second = secondTens * 10 + secondOnes; UpdateDigitDisplays(); - - // 如果计时器正在运行,重新计算剩余时间并继续计时 - if (isTimerRunning && !isPaused) - { - UpdateSpecificTimeUnit(hour, minute, second); - } } private void Digit5Minus_Click(object sender, RoutedEventArgs e) { + if (isTimerRunning) return; int currentSecond = second; int secondTens = currentSecond / 10; int secondOnes = currentSecond % 10; @@ -599,17 +555,12 @@ namespace Ink_Canvas second = secondTens * 10 + secondOnes; UpdateDigitDisplays(); - - // 如果计时器正在运行,重新计算剩余时间并继续计时 - if (isTimerRunning && !isPaused) - { - UpdateSpecificTimeUnit(hour, minute, second); - } } // 第6位数字(秒个位) private void Digit6Plus_Click(object sender, RoutedEventArgs e) { + if (isTimerRunning) return; int currentSecond = second; int secondTens = currentSecond / 10; int secondOnes = currentSecond % 10; @@ -624,16 +575,11 @@ namespace Ink_Canvas second = secondTens * 10 + secondOnes; UpdateDigitDisplays(); - - // 如果计时器正在运行,重新计算剩余时间并继续计时 - if (isTimerRunning && !isPaused) - { - UpdateSpecificTimeUnit(hour, minute, second); - } } private void Digit6Minus_Click(object sender, RoutedEventArgs e) { + if (isTimerRunning) return; int currentSecond = second; int secondTens = currentSecond / 10; int secondOnes = currentSecond % 10; @@ -648,12 +594,6 @@ namespace Ink_Canvas second = secondTens * 10 + secondOnes; UpdateDigitDisplays(); - - // 如果计时器正在运行,重新计算剩余时间并继续计时 - if (isTimerRunning && !isPaused) - { - UpdateSpecificTimeUnit(hour, minute, second); - } } // 图标数据常量