diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index efff6195..7990f219 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -60,6 +60,9 @@ namespace ServiceLib.ViewModels [Reactive] public int SystemProxySelected { get; set; } + [Reactive] + public bool BlSystemProxyPacVisible { get; set; } + #endregion System Proxy #region UI @@ -96,6 +99,7 @@ namespace ServiceLib.ViewModels SelectedRouting = new(); SelectedServer = new(); RunningServerToolTipText = "-"; + BlSystemProxyPacVisible = Utils.IsWindows(); if (_config.TunModeItem.EnableTun && AllowEnableTun()) { diff --git a/v2rayN/v2rayN.Desktop/App.axaml b/v2rayN/v2rayN.Desktop/App.axaml index 99852cd2..9dc9dd4a 100644 --- a/v2rayN/v2rayN.Desktop/App.axaml +++ b/v2rayN/v2rayN.Desktop/App.axaml @@ -46,6 +46,12 @@ Header="{x:Static resx:ResUI.menuSystemProxyNothing}" IsChecked="{Binding BlSystemProxyNothing}" ToggleType="Radio" /> + <NativeMenuItem + Command="{Binding SystemProxyPacCmd}" + Header="{x:Static resx:ResUI.menuSystemProxyPac}" + IsChecked="{Binding BlSystemProxyPac}" + IsVisible="{Binding BlSystemProxyPacVisible}" + ToggleType="Radio" /> <NativeMenuItemSeparator /> <NativeMenuItem Click="MenuAddServerViaClipboardClick" Header="{x:Static resx:ResUI.menuAddServerViaClipboard}" /> <NativeMenuItem Header="{x:Static resx:ResUI.menuAddServerViaScan}" IsVisible="False" /> @@ -61,4 +67,4 @@ </TrayIcon> </TrayIcons> </TrayIcon.Icons> -</Application> \ No newline at end of file +</Application> diff --git a/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml b/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml index 0eff80a3..c619a78f 100644 --- a/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml @@ -60,6 +60,7 @@ <ComboBoxItem Content="{x:Static resx:ResUI.menuSystemProxyClear}" /> <ComboBoxItem Content="{x:Static resx:ResUI.menuSystemProxySet}" /> <ComboBoxItem Content="{x:Static resx:ResUI.menuSystemProxyNothing}" /> + <ComboBoxItem Content="{x:Static resx:ResUI.menuSystemProxyPac}" /> </ComboBox> <ComboBox @@ -78,4 +79,4 @@ </StackPanel> </DockPanel> </Grid> -</UserControl> \ No newline at end of file +</UserControl> diff --git a/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs index 2ecd3ae6..7512ce80 100644 --- a/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs @@ -43,6 +43,11 @@ namespace v2rayN.Desktop.Views }); //spEnableTun.IsVisible = (Utils.IsWindows() || AppHandler.Instance.IsAdministrator); + + if (Utils.IsNonWindows() && cmbSystemProxy.Items.IsReadOnly == false) + { + cmbSystemProxy.Items.RemoveAt(cmbSystemProxy.Items.Count - 1); + } } private async Task<bool> UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/StatusBarView.xaml.cs b/v2rayN/v2rayN/Views/StatusBarView.xaml.cs index ed6177be..90e5c5b6 100644 --- a/v2rayN/v2rayN/Views/StatusBarView.xaml.cs +++ b/v2rayN/v2rayN/Views/StatusBarView.xaml.cs @@ -32,8 +32,8 @@ namespace v2rayN.Views this.OneWayBind(ViewModel, vm => vm.BlSystemProxyPac, v => v.menuSystemProxyPac2.Visibility, conversionHint: BooleanToVisibilityHint.UseHidden, vmToViewConverterOverride: new BooleanToVisibilityTypeConverter()).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SystemProxyClearCmd, v => v.menuSystemProxyClear).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SystemProxySetCmd, v => v.menuSystemProxySet).DisposeWith(disposables); - this.BindCommand(ViewModel, vm => vm.SystemProxyPacCmd, v => v.menuSystemProxyPac).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SystemProxyNothingCmd, v => v.menuSystemProxyNothing).DisposeWith(disposables); + this.BindCommand(ViewModel, vm => vm.SystemProxyPacCmd, v => v.menuSystemProxyPac).DisposeWith(disposables); //routings and servers this.OneWayBind(ViewModel, vm => vm.RoutingItems, v => v.cmbRoutings.ItemsSource).DisposeWith(disposables);