Browse Source

fix tray icon closing.

pull/6560/head
Dan Walmsley 5 years ago
parent
commit
261a0f0c23
  1. 25
      src/Windows/Avalonia.Win32/TrayIconImpl.cs

25
src/Windows/Avalonia.Win32/TrayIconImpl.cs

@ -181,32 +181,16 @@ namespace Avalonia.Win32
_positioner = new ManagedPopupPositioner(new TrayIconManagedPopupPositionerPopupImplHelper(MoveResize));
Topmost = true;
Activated += TrayPopupRoot_Activated;
Deactivated += TrayPopupRoot_Deactivated;
LostFocus += TrayPopupRoot_LostFocus1;
ShowInTaskbar = false;
}
private void TrayPopupRoot_LostFocus1(object sender, Interactivity.RoutedEventArgs e)
{
Debug.WriteLine("TrayIcon - Lost Focus");
}
private void TrayPopupRoot_Activated(object sender, EventArgs e)
{
Debug.WriteLine("TrayIcon - Activated");
ShowActivated = true;
}
private void TrayPopupRoot_Deactivated(object sender, EventArgs e)
{
Debug.WriteLine("TrayIcon - Deactivated");
Dispatcher.UIThread.Post(() =>
{
Close();
});
Close();
}
private void MoveResize(PixelPoint position, Size size, double scaling)
@ -215,11 +199,6 @@ namespace Avalonia.Win32
PlatformImpl.Resize(size, PlatformResizeReason.Layout);
}
private void TrayPopupRoot_LostFocus(object sender, Interactivity.RoutedEventArgs e)
{
Close();
}
protected override void ArrangeCore(Rect finalRect)
{
base.ArrangeCore(finalRect);

Loading…
Cancel
Save