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) {