Update NotifyIcon.cs

This commit is contained in:
NaBian committed 2019-05-31 22:49:37 +08:00
1 parent bd0e46f4b5
commit 5fd37e97fb
1 file changed
+11 -9
@@ -85,7 +85,17 @@ namespace HandyControl.Controls
_id = ++NextId; _id = ++NextId;
_callback = Callback; _callback = Callback;
Loaded += (s, e) => Loaded += (s, e) => Init();
if (Application.Current != null) Application.Current.Exit += (s, e) => Dispose();
}
~NotifyIcon()
{
Dispose(false);
}
public void Init()
{ {
RegisterClass(); RegisterClass();
if (Visibility == Visibility.Visible) if (Visibility == Visibility.Visible)
@@ -99,14 +109,6 @@ namespace HandyControl.Controls
Interval = TimeSpan.FromMilliseconds(200) Interval = TimeSpan.FromMilliseconds(200)
}; };
_dispatcherTimerPos.Tick += DispatcherTimerPos_Tick; _dispatcherTimerPos.Tick += DispatcherTimerPos_Tick;
};
if (Application.Current != null) Application.Current.Exit += (s, e) => Dispose();
}
~NotifyIcon()
{
Dispose(false);
} }
public static readonly DependencyProperty TextProperty = DependencyProperty.Register( public static readonly DependencyProperty TextProperty = DependencyProperty.Register(