|
|
|
|
@ -2,6 +2,7 @@ using Avalonia; |
|
|
|
|
using Avalonia.Controls; |
|
|
|
|
using Avalonia.Controls.ApplicationLifetimes; |
|
|
|
|
using Avalonia.Markup.Xaml; |
|
|
|
|
using Lib.NotifyIcon; |
|
|
|
|
using LightweightIocContainer.Interfaces; |
|
|
|
|
using Mystify.ViewModels; |
|
|
|
|
using Mystify.Views; |
|
|
|
|
@ -11,6 +12,7 @@ namespace Mystify |
|
|
|
|
public class App : Application |
|
|
|
|
{ |
|
|
|
|
private IIocContainer? _kernel; |
|
|
|
|
private INotifyIcon? _notifyIcon; |
|
|
|
|
|
|
|
|
|
public override void Initialize() => AvaloniaXamlLoader.Load(this); |
|
|
|
|
public override void OnFrameworkInitializationCompleted() |
|
|
|
|
@ -29,11 +31,20 @@ namespace Mystify |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
desktopStyleApplicationLifetime.Exit += OnExit; |
|
|
|
|
|
|
|
|
|
_notifyIcon = _kernel.Resolve<INotifyIcon>(); |
|
|
|
|
_notifyIcon.ToolTipText = "Test tool tip"; |
|
|
|
|
_notifyIcon.IconPath = "avares://Mystify/Resources/TestIcon.ico"; |
|
|
|
|
_notifyIcon.Visible = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
base.OnFrameworkInitializationCompleted(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void OnExit(object? sender, ControlledApplicationLifetimeExitEventArgs args) => _kernel?.Dispose(); |
|
|
|
|
private void OnExit(object? sender, ControlledApplicationLifetimeExitEventArgs args) |
|
|
|
|
{ |
|
|
|
|
_notifyIcon?.Remove(); |
|
|
|
|
_kernel?.Dispose(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |