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

Loading…
Cancel
Save