mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-19 13:42:24 +00:00
Merge e45c1ddb36
into 8aceff7480
This commit is contained in:
commit
224677eb8f
3 changed files with 20 additions and 4 deletions
|
@ -31,9 +31,17 @@ public partial class App : Application
|
|||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
AppHandler.Instance.InitComponents();
|
||||
|
||||
desktop.ShutdownMode = Avalonia.Controls.ShutdownMode.OnExplicitShutdown;
|
||||
desktop.Exit += OnExit;
|
||||
desktop.MainWindow = new MainWindow();
|
||||
var mainWindow = new MainWindow();
|
||||
if (!AppHandler.Instance.Config.UiItem.AutoHideStartup)
|
||||
{
|
||||
desktop.MainWindow = mainWindow;
|
||||
}
|
||||
else
|
||||
{
|
||||
desktop.MainWindow = null;
|
||||
}
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
|
|
|
@ -396,6 +396,10 @@ namespace v2rayN.Desktop.Views
|
|||
if (bl)
|
||||
{
|
||||
this.Show();
|
||||
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
desktop.MainWindow = this;
|
||||
}
|
||||
if (this.WindowState == WindowState.Minimized)
|
||||
{
|
||||
this.WindowState = WindowState.Normal;
|
||||
|
|
|
@ -77,9 +77,13 @@ namespace v2rayN.Desktop.Views
|
|||
{
|
||||
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
desktop.MainWindow.Icon = AvaUtils.GetAppIcon(_config.SystemProxyItem.SysProxyType);
|
||||
var icon = AvaUtils.GetAppIcon(_config.SystemProxyItem.SysProxyType);
|
||||
if (desktop.MainWindow != null)
|
||||
{
|
||||
desktop.MainWindow.Icon = icon;
|
||||
}
|
||||
var iconslist = TrayIcon.GetIcons(Application.Current);
|
||||
iconslist[0].Icon = desktop.MainWindow.Icon;
|
||||
iconslist[0].Icon = icon;
|
||||
TrayIcon.SetIcons(Application.Current, iconslist);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue