Update NotifyIcon.cs
This commit is contained in:
1 parent
bd0e46f4b5
commit
5fd37e97fb
1 file changed
+17
-15
@@ -85,21 +85,7 @@ namespace HandyControl.Controls
|
|||||||
_id = ++NextId;
|
_id = ++NextId;
|
||||||
_callback = Callback;
|
_callback = Callback;
|
||||||
|
|
||||||
Loaded += (s, e) =>
|
Loaded += (s, e) => Init();
|
||||||
{
|
|
||||||
RegisterClass();
|
|
||||||
if (Visibility == Visibility.Visible)
|
|
||||||
{
|
|
||||||
OnIconChanged();
|
|
||||||
UpdateIcon(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
_dispatcherTimerPos = new DispatcherTimer
|
|
||||||
{
|
|
||||||
Interval = TimeSpan.FromMilliseconds(200)
|
|
||||||
};
|
|
||||||
_dispatcherTimerPos.Tick += DispatcherTimerPos_Tick;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (Application.Current != null) Application.Current.Exit += (s, e) => Dispose();
|
if (Application.Current != null) Application.Current.Exit += (s, e) => Dispose();
|
||||||
}
|
}
|
||||||
@@ -109,6 +95,22 @@ namespace HandyControl.Controls
|
|||||||
Dispose(false);
|
Dispose(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Init()
|
||||||
|
{
|
||||||
|
RegisterClass();
|
||||||
|
if (Visibility == Visibility.Visible)
|
||||||
|
{
|
||||||
|
OnIconChanged();
|
||||||
|
UpdateIcon(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
_dispatcherTimerPos = new DispatcherTimer
|
||||||
|
{
|
||||||
|
Interval = TimeSpan.FromMilliseconds(200)
|
||||||
|
};
|
||||||
|
_dispatcherTimerPos.Tick += DispatcherTimerPos_Tick;
|
||||||
|
}
|
||||||
|
|
||||||
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
|
||||||
"Text", typeof(string), typeof(NotifyIcon), new PropertyMetadata(default(string)));
|
"Text", typeof(string), typeof(NotifyIcon), new PropertyMetadata(default(string)));
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user