diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index dfb5c854..bbc6c585 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -34,6 +34,8 @@ public class StatusBarViewModel : MyReactiveObject public ReactiveCommand SubUpdateViaProxyCmd { get; } public ReactiveCommand CopyProxyCmdToClipboardCmd { get; } public ReactiveCommand NotifyLeftClickCmd { get; } + public ReactiveCommand ShowWindowCmd { get; } + public ReactiveCommand HideWindowCmd { get; } #region System Proxy @@ -91,6 +93,9 @@ public class StatusBarViewModel : MyReactiveObject [Reactive] public bool EnableTun { get; set; } + [Reactive] + public bool BlIsNonWindows { get; set; } + #endregion UI public StatusBarViewModel(Func>? updateView) @@ -100,6 +105,7 @@ public class StatusBarViewModel : MyReactiveObject SelectedServer = new(); RunningServerToolTipText = "-"; BlSystemProxyPacVisible = Utils.IsWindows(); + BlIsNonWindows = Utils.IsNonWindows(); if (_config.TunModeItem.EnableTun && AllowEnableTun()) { @@ -143,11 +149,21 @@ public class StatusBarViewModel : MyReactiveObject Locator.Current.GetService()?.ShowHideWindow(null); await Task.CompletedTask; }); + ShowWindowCmd = ReactiveCommand.CreateFromTask(async () => + { + Locator.Current.GetService()?.ShowHideWindow(true); + await Task.CompletedTask; + }); + HideWindowCmd = ReactiveCommand.CreateFromTask(async () => + { + Locator.Current.GetService()?.ShowHideWindow(false); + await Task.CompletedTask; + }); AddServerViaClipboardCmd = ReactiveCommand.CreateFromTask(async () => - { - await AddServerViaClipboard(); - }); + { + await AddServerViaClipboard(); + }); AddServerViaScanCmd = ReactiveCommand.CreateFromTask(async () => { await AddServerViaScan(); diff --git a/v2rayN/v2rayN.Desktop/App.axaml b/v2rayN/v2rayN.Desktop/App.axaml index 22b10811..8b61125f 100644 --- a/v2rayN/v2rayN.Desktop/App.axaml +++ b/v2rayN/v2rayN.Desktop/App.axaml @@ -32,7 +32,15 @@ ToolTipText="{Binding RunningServerToolTipText}"> - + + + - -