mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 18:11:27 -07:00
NotifyIcon disposal - second attempt
This commit is contained in:
parent
b0334b7866
commit
d1861262fc
@ -9,7 +9,7 @@ namespace Bloxstrap.UI
|
|||||||
{
|
{
|
||||||
// lol who needs properly structured mvvm and xaml when you have the absolute catastrophe that this is
|
// lol who needs properly structured mvvm and xaml when you have the absolute catastrophe that this is
|
||||||
|
|
||||||
bool _disposed = false;
|
private bool _disposing = false;
|
||||||
|
|
||||||
private readonly System.Windows.Forms.NotifyIcon _notifyIcon;
|
private readonly System.Windows.Forms.NotifyIcon _notifyIcon;
|
||||||
private MenuContainer? _menuContainer;
|
private MenuContainer? _menuContainer;
|
||||||
@ -128,15 +128,16 @@ namespace Bloxstrap.UI
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_disposed)
|
if (_disposing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
_disposing = true;
|
||||||
|
|
||||||
App.Logger.WriteLine($"[NotifyIconWrapper::Dispose] Disposing NotifyIcon");
|
App.Logger.WriteLine($"[NotifyIconWrapper::Dispose] Disposing NotifyIcon");
|
||||||
|
|
||||||
_menuContainer?.Dispatcher.Invoke(_menuContainer.Close);
|
_menuContainer?.Dispatcher.Invoke(_menuContainer.Close);
|
||||||
_notifyIcon?.Dispose();
|
_notifyIcon?.Dispose();
|
||||||
|
|
||||||
_disposed = true;
|
|
||||||
|
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user