Skip to content

Commit

Permalink
一定程度上避免上下课通知未响应 #30 (需要等我到教室里测试,在我电脑上没出现过未响应),优化颜色选择面板动画
Browse files Browse the repository at this point in the history
  • Loading branch information
STBBRD committed Oct 13, 2024
1 parent 0cb0162 commit e149139
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ZongziTEK_Blackboard_Sticker/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private void CheckIsBlackboardLocked()

if (GetIsLightTheme()) ToggleButtonLock.Foreground = new SolidColorBrush(Colors.White); else ToggleButtonLock.Foreground = new SolidColorBrush(Colors.Black);

eraserButton.Visibility = Visibility.Collapsed;
eraserButton.Visibility = Visibility.Hidden;
HideColorPicker();

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
xmlns:local="clr-namespace:ZongziTEK_Blackboard_Sticker"
mc:Ignorable="d"
Title="ZongziTEK 黑板贴 - 通知" d:Height="900" d:Width="1600" WindowStyle="None" WindowState="Maximized" AllowsTransparency="True" Background="{x:Null}" Topmost="True" ShowInTaskbar="False"
Title="ZongziTEK 黑板贴 - 通知" Height="192" d:Width="1600" Top="0" Left="0" WindowStyle="None" AllowsTransparency="True" Background="#00000000" Topmost="True" ShowInTaskbar="False"
Loaded="Window_Loaded" Closing="Window_Closing">
<Grid Name="GridNotification">
<Border x:Name="border" Height="{Binding ActualHeight, ElementName=BorderNotification, Mode=OneWay}"
Expand Down
18 changes: 7 additions & 11 deletions ZongziTEK_Blackboard_Sticker/TimetableNotificationWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public TimetableNotificationWindow(string title, string subtitle, double time, b
{
InitializeComponent();

Width = SystemParameters.WorkArea.Width;

totalTime = TimeSpan.FromSeconds(time);
timeLeft = totalTime;
timeToHide = DateTime.Now.TimeOfDay + timeLeft;
Expand All @@ -41,17 +43,11 @@ public TimetableNotificationWindow(string title, string subtitle, double time, b

if (!isTextTimeVisible)
{
TextTime.Visibility = Visibility.Collapsed;
TextTime.Visibility = Visibility.Hidden;
isTimeHidden = true;
}
}

protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);

var hwnd = new WindowInteropHelper(this).Handle;
WindowsHelper.SetWindowStyleToolWindow(hwnd);
TextTime.Text = (timeLeft.TotalSeconds - 1).ToString("00");
}

private TimeSpan totalTime;
Expand All @@ -62,7 +58,7 @@ protected override void OnSourceInitialized(EventArgs e)

private void Window_Loaded(object sender, RoutedEventArgs e)
{
Timer_Tick(null, null);
//Timer_Tick(null, null);
ShowNotification();

DoubleAnimation barWidthAnimation = new()
Expand Down Expand Up @@ -90,11 +86,11 @@ private void Timer_Tick(object sender, EventArgs e)
timeLeft = timeToHide - DateTime.Now.TimeOfDay;
TextTime.Text = timeLeft.TotalSeconds.ToString("00");

if (Convert.ToInt32(TextTime.Text) == 1)
if (timeLeft.TotalSeconds == 1)
{
if (!isTimeHidden) HideTime();
}
else if (Convert.ToInt32(TextTime.Text) <= 0)
else if (timeLeft.TotalSeconds <= 0)
{
if (!isNotificationHidden) HideNotification();
}
Expand Down

0 comments on commit e149139

Please sign in to comment.