Skip to content

Commit

Permalink
避免内存泄漏
Browse files Browse the repository at this point in the history
  • Loading branch information
STBBRD committed Aug 15, 2024
1 parent 1fa0ca1 commit d93f2af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
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" Loaded="Window_Loaded">
Title="ZongziTEK 黑板贴 - 通知" d:Height="900" d:Width="1600" WindowStyle="None" WindowState="Maximized" AllowsTransparency="True" Background="{x:Null}" Topmost="True"
Loaded="Window_Loaded" Closing="Window_Closing">
<Grid Name="GridNotification">
<Border x:Name="border" Height="{Binding ActualHeight, ElementName=BorderNotification, Mode=OneWay}"
Width="{Binding ActualWidth, ElementName=BorderNotification, Mode=OneWay}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
ShowNotification();
}

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
timeTimer.Stop();
timeTimer.Tick -= Timer_Tick;
}

private DispatcherTimer timeTimer = new()
{
Interval = TimeSpan.FromMilliseconds(10)
Expand Down

0 comments on commit d93f2af

Please sign in to comment.