Browse Source
Fix hidden Win32 TrayIcon appearing after icon updates Preserve the current tray icon registration state when updating its icon, so a hidden TrayIcon remains hidden until SetIsVisible(true) is called. (#22125 )
pull/22130/head
Lin
4 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
5 additions and
1 deletions
src/Windows/Avalonia.Win32/TrayIconImpl.cs
@ -94,7 +94,7 @@ namespace Avalonia.Win32
{
{
_ iconImpl = ( IconImpl ? ) icon ;
_ iconImpl = ( IconImpl ? ) icon ;
_ iconStale = true ;
_ iconStale = true ;
UpdateIcon ( ) ;
UpdateIcon ( ! _ iconAdded ) ;
}
}
/// <inheritdoc />
/// <inheritdoc />
@ -376,6 +376,10 @@ namespace Avalonia.Win32
if ( ! _d isposedValue )
if ( ! _d isposedValue )
{
{
UpdateIcon ( true ) ;
UpdateIcon ( true ) ;
s_trayIcons . Remove ( _ uniqueId ) ;
_ icon ? . Dispose ( ) ;
_ icon = null ;
_d isposedValue = true ;
_d isposedValue = true ;
}
}