mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-30 23:06:20 +00:00
修复:后台启动时,窗口闪一下的问题
This commit is contained in:
parent
d3a0b44247
commit
a08f255104
3 changed files with 20 additions and 5 deletions
|
@ -33,7 +33,15 @@ public partial class App : Application
|
|||
AppHandler.Instance.InitComponents();
|
||||
|
||||
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();
|
||||
|
|
|
@ -397,6 +397,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;
|
||||
|
|
|
@ -76,6 +76,8 @@ namespace v2rayN.Desktop.Views
|
|||
private void RefreshIcon()
|
||||
{
|
||||
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
if (desktop.MainWindow != null)
|
||||
{
|
||||
desktop.MainWindow.Icon = AvaUtils.GetAppIcon(_config.SystemProxyItem.SysProxyType);
|
||||
var iconslist = TrayIcon.GetIcons(Application.Current);
|
||||
|
@ -83,6 +85,7 @@ namespace v2rayN.Desktop.Views
|
|||
TrayIcon.SetIcons(Application.Current, iconslist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TxtRunningServerDisplay_Tapped(object? sender, Avalonia.Input.TappedEventArgs e)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue