From c8481842c176a0a01d758e771956b3098ba3d16d Mon Sep 17 00:00:00 2001 From: STBBRD <62409850+STBBRD@users.noreply.github.com> Date: Tue, 1 Oct 2024 20:18:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E9=AB=98=E4=B8=8A=E4=B8=8B=E8=AF=BE?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=8A=A8=E7=94=BB=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZongziTEK_Blackboard_Sticker/MainWindow.xaml.cs | 3 ++- .../TimetableNotificationWindow.xaml.cs | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ZongziTEK_Blackboard_Sticker/MainWindow.xaml.cs b/ZongziTEK_Blackboard_Sticker/MainWindow.xaml.cs index 87086b2..7ebbbb5 100644 --- a/ZongziTEK_Blackboard_Sticker/MainWindow.xaml.cs +++ b/ZongziTEK_Blackboard_Sticker/MainWindow.xaml.cs @@ -1242,7 +1242,8 @@ private void CheckTimetable(object sender, EventArgs e) LoadTimetable(); } - TimeSpan currentTime = new TimeSpan(DateTime.Now.TimeOfDay.Hours, DateTime.Now.TimeOfDay.Minutes, DateTime.Now.TimeOfDay.Seconds) + TimeSpan.FromSeconds(Settings.TimetableSettings.TimeOffset); + TimeSpan currentTime = new TimeSpan + (DateTime.Now.TimeOfDay.Hours, DateTime.Now.TimeOfDay.Minutes, DateTime.Now.TimeOfDay.Seconds) + TimeSpan.FromSeconds(Settings.TimetableSettings.TimeOffset); if (timetableToShow != null && timetableToShow.Count != 0) { diff --git a/ZongziTEK_Blackboard_Sticker/TimetableNotificationWindow.xaml.cs b/ZongziTEK_Blackboard_Sticker/TimetableNotificationWindow.xaml.cs index 2c7ad7d..24e3787 100644 --- a/ZongziTEK_Blackboard_Sticker/TimetableNotificationWindow.xaml.cs +++ b/ZongziTEK_Blackboard_Sticker/TimetableNotificationWindow.xaml.cs @@ -64,6 +64,14 @@ private void Window_Loaded(object sender, RoutedEventArgs e) { Timer_Tick(null, null); ShowNotification(); + + DoubleAnimation barWidthAnimation = new() + { + From = BorderNotification.ActualWidth, + To = 0, + Duration = totalTime + }; + RectangleProgressBar.BeginAnimation(WidthProperty, barWidthAnimation); } private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) @@ -81,9 +89,6 @@ private void Timer_Tick(object sender, EventArgs e) { timeLeft = timeToHide - DateTime.Now.TimeOfDay; TextTime.Text = timeLeft.TotalSeconds.ToString("00"); - double barWidth = BorderNotification.ActualWidth * (timeLeft.TotalSeconds / totalTime.TotalSeconds); - if (barWidth >= 0) RectangleProgressBar.Width = barWidth; - if (barWidth == 0) timeTimer.Stop(); if (Convert.ToInt32(TextTime.Text) == 1) {