mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-18 10:25:00 +03:00
Removed the server selection from the tray menu in the WPF version.
This commit is contained in:
@@ -66,7 +66,6 @@ public class GUIItem
|
||||
public bool DisplayRealTimeSpeed { get; set; }
|
||||
public bool KeepOlderDedupl { get; set; }
|
||||
public int AutoUpdateInterval { get; set; }
|
||||
public int TrayMenuServersLimit { get; set; } = 20;
|
||||
public bool EnableHWA { get; set; } = false;
|
||||
public bool EnableLog { get; set; } = true;
|
||||
public string? RootCertProvider { get; set; }
|
||||
|
||||
Generated
-9
@@ -4932,15 +4932,6 @@ namespace ServiceLib.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Tray right-click menu display limit 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsTrayMenuServersLimit {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsTrayMenuServersLimit", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Auto Route 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -744,9 +744,6 @@
|
||||
<data name="TbSettingsSystemproxy" xml:space="preserve">
|
||||
<value>Sistem proksisi parametrləri</value>
|
||||
</data>
|
||||
<data name="TbSettingsTrayMenuServersLimit" xml:space="preserve">
|
||||
<value>Sistem panelinin sağ klik menyusunda göstərilən elementlərin həddi</value>
|
||||
</data>
|
||||
<data name="TbSettingsUdpEnabled" xml:space="preserve">
|
||||
<value>UDP-ni aktiv et</value>
|
||||
</data>
|
||||
|
||||
@@ -744,9 +744,6 @@
|
||||
<data name="TbSettingsSystemproxy" xml:space="preserve">
|
||||
<value>تنظیمات پراکسی سیستم</value>
|
||||
</data>
|
||||
<data name="TbSettingsTrayMenuServersLimit" xml:space="preserve">
|
||||
<value>محدودیت نمایش سرورهای منوی سینی کلیک راست</value>
|
||||
</data>
|
||||
<data name="TbSettingsUdpEnabled" xml:space="preserve">
|
||||
<value>فعال سازی UDP</value>
|
||||
</data>
|
||||
@@ -1812,4 +1809,4 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||
<data name="TransportPathTip6" xml:space="preserve">
|
||||
<value>پوشه ریموت XDRIVE</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
@@ -741,9 +741,6 @@
|
||||
<data name="TbSettingsSystemproxy" xml:space="preserve">
|
||||
<value>Paramètres du proxy système</value>
|
||||
</data>
|
||||
<data name="TbSettingsTrayMenuServersLimit" xml:space="preserve">
|
||||
<value>Limite du nombre de configurations affichées dans le menu du plateau</value>
|
||||
</data>
|
||||
<data name="TbSettingsUdpEnabled" xml:space="preserve">
|
||||
<value>Activer l’UDP</value>
|
||||
</data>
|
||||
@@ -1806,4 +1803,4 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||
<data name="TransportPathTip6" xml:space="preserve">
|
||||
<value>Dossier distant XDRIVE</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
@@ -741,9 +741,6 @@
|
||||
<data name="TbSettingsSystemproxy" xml:space="preserve">
|
||||
<value>Rendszerproxy beállítások</value>
|
||||
</data>
|
||||
<data name="TbSettingsTrayMenuServersLimit" xml:space="preserve">
|
||||
<value>Tálca jobb egérgombos menü konfigurációk megjelenítési limitje</value>
|
||||
</data>
|
||||
<data name="TbSettingsUdpEnabled" xml:space="preserve">
|
||||
<value>UDP engedélyezése</value>
|
||||
</data>
|
||||
@@ -1809,4 +1806,4 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||
<data name="TransportPathTip6" xml:space="preserve">
|
||||
<value>XDRIVE távoli mappa</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
@@ -741,9 +741,6 @@
|
||||
<data name="TbSettingsSystemproxy" xml:space="preserve">
|
||||
<value>Pengaturan proxy sistem</value>
|
||||
</data>
|
||||
<data name="TbSettingsTrayMenuServersLimit" xml:space="preserve">
|
||||
<value>Batas item pada menu klik kanan tray</value>
|
||||
</data>
|
||||
<data name="TbSettingsUdpEnabled" xml:space="preserve">
|
||||
<value>Aktifkan UDP</value>
|
||||
</data>
|
||||
@@ -1833,4 +1830,4 @@ Tindakan "Ambil sertifikat" mungkin gagal jika sertifikat self-signed digunakan
|
||||
<data name="TransportPathTip6" xml:space="preserve">
|
||||
<value>Folder jarak jauh XDRIVE</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
@@ -747,9 +747,6 @@
|
||||
<data name="TbSettingsSystemproxy" xml:space="preserve">
|
||||
<value>System proxy settings</value>
|
||||
</data>
|
||||
<data name="TbSettingsTrayMenuServersLimit" xml:space="preserve">
|
||||
<value>Tray right-click menu display limit</value>
|
||||
</data>
|
||||
<data name="TbSettingsUdpEnabled" xml:space="preserve">
|
||||
<value>Enable UDP</value>
|
||||
</data>
|
||||
@@ -1974,4 +1971,4 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||
<data name="TransportPathTip6" xml:space="preserve">
|
||||
<value>XDRIVE remote folder</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
@@ -747,9 +747,6 @@
|
||||
<data name="TbSettingsSystemproxy" xml:space="preserve">
|
||||
<value>Настройки системного прокси</value>
|
||||
</data>
|
||||
<data name="TbSettingsTrayMenuServersLimit" xml:space="preserve">
|
||||
<value>Лимит отображения серверов в контекстном меню трея</value>
|
||||
</data>
|
||||
<data name="TbSettingsUdpEnabled" xml:space="preserve">
|
||||
<value>Включить UDP</value>
|
||||
</data>
|
||||
@@ -1974,4 +1971,4 @@
|
||||
<data name="TransportPathTip6" xml:space="preserve">
|
||||
<value>Удаленная папка XDRIVE</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
@@ -747,9 +747,6 @@
|
||||
<data name="TbSettingsSystemproxy" xml:space="preserve">
|
||||
<value>系统代理设置</value>
|
||||
</data>
|
||||
<data name="TbSettingsTrayMenuServersLimit" xml:space="preserve">
|
||||
<value>托盘右键菜单配置展示数量限制</value>
|
||||
</data>
|
||||
<data name="TbSettingsUdpEnabled" xml:space="preserve">
|
||||
<value>开启 UDP</value>
|
||||
</data>
|
||||
@@ -1966,4 +1963,4 @@
|
||||
<data name="TransportPathTip6" xml:space="preserve">
|
||||
<value>XDRIVE 远端目录</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
@@ -747,9 +747,6 @@
|
||||
<data name="TbSettingsSystemproxy" xml:space="preserve">
|
||||
<value>系統代理設定</value>
|
||||
</data>
|
||||
<data name="TbSettingsTrayMenuServersLimit" xml:space="preserve">
|
||||
<value>工具列右鍵選單設定展示數量限制</value>
|
||||
</data>
|
||||
<data name="TbSettingsUdpEnabled" xml:space="preserve">
|
||||
<value>開啟 UDP</value>
|
||||
</data>
|
||||
@@ -1975,4 +1972,4 @@
|
||||
<data name="TransportPathTip6" xml:space="preserve">
|
||||
<value>XDRIVE 遠端目錄</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
@@ -308,11 +308,6 @@ public partial class MainWindowViewModel : MyReactiveObject
|
||||
await ShowHideWindowInteraction.HandleSafe(blShow);
|
||||
});
|
||||
|
||||
StatusBarViewModel.SetDefaultServerRequested
|
||||
.AsObservable()
|
||||
.ObserveOn(RxSchedulers.MainThreadScheduler)
|
||||
.SubscribeAsync(async indexId => await ProfilesViewModel.SetDefaultServer(indexId));
|
||||
|
||||
StatusBarViewModel.SubscriptionsUpdateRequested
|
||||
.AsObservable()
|
||||
.ObserveOn(RxSchedulers.MainThreadScheduler)
|
||||
|
||||
@@ -53,7 +53,6 @@ public partial class OptionSettingViewModel : MyReactiveObject, ICloseable
|
||||
[Reactive] public partial bool EnableDragDropSort { get; set; }
|
||||
[Reactive] public partial bool DoubleClick2Activate { get; set; }
|
||||
[Reactive] public partial int AutoUpdateInterval { get; set; }
|
||||
[Reactive] public partial int TrayMenuServersLimit { get; set; }
|
||||
[Reactive] public partial string CurrentFontFamily { get; set; }
|
||||
[Reactive] public partial int SpeedTestTimeout { get; set; }
|
||||
[Reactive] public partial string SpeedTestUrl { get; set; }
|
||||
@@ -188,7 +187,6 @@ public partial class OptionSettingViewModel : MyReactiveObject, ICloseable
|
||||
EnableDragDropSort = _config.UiItem.EnableDragDropSort;
|
||||
DoubleClick2Activate = _config.UiItem.DoubleClick2Activate;
|
||||
AutoUpdateInterval = _config.GuiItem.AutoUpdateInterval;
|
||||
TrayMenuServersLimit = _config.GuiItem.TrayMenuServersLimit;
|
||||
CurrentFontFamily = _config.UiItem.CurrentFontFamily;
|
||||
SpeedTestTimeout = _config.SpeedTestItem.SpeedTestTimeout;
|
||||
SpeedTestUrl = _config.SpeedTestItem.SpeedTestUrl;
|
||||
@@ -368,7 +366,6 @@ public partial class OptionSettingViewModel : MyReactiveObject, ICloseable
|
||||
_config.GuiItem.AutoUpdateInterval = AutoUpdateInterval;
|
||||
_config.UiItem.EnableDragDropSort = EnableDragDropSort;
|
||||
_config.UiItem.DoubleClick2Activate = DoubleClick2Activate;
|
||||
_config.GuiItem.TrayMenuServersLimit = TrayMenuServersLimit;
|
||||
_config.UiItem.CurrentFontFamily = CurrentFontFamily;
|
||||
_config.SpeedTestItem.SpeedTestTimeout = SpeedTestTimeout;
|
||||
_config.SpeedTestItem.MixedConcurrencyCount = MixedConcurrencyCount;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
namespace ServiceLib.ViewModels;
|
||||
|
||||
public partial class StatusBarViewModel : MyReactiveObject
|
||||
@@ -13,7 +11,6 @@ public partial class StatusBarViewModel : MyReactiveObject
|
||||
private static readonly Lazy<StatusBarViewModel> _instance = new(() => new());
|
||||
public static StatusBarViewModel Instance => _instance.Value;
|
||||
|
||||
public EventChannel<string> SetDefaultServerRequested { get; } = new();
|
||||
public EventChannel<RxVoid> ReloadRequested { get; } = new();
|
||||
public EventChannel<RxVoid> AddServerViaScanRequested { get; } = new();
|
||||
public EventChannel<RxVoid> AddServerViaClipboardRequested { get; } = new();
|
||||
@@ -22,17 +19,9 @@ public partial class StatusBarViewModel : MyReactiveObject
|
||||
|
||||
public BulkObservableCollection<RoutingItem> RoutingItems { get; } = [];
|
||||
|
||||
public BulkObservableCollection<ComboItem> Servers { get; } = [];
|
||||
|
||||
[Reactive]
|
||||
public partial RoutingItem SelectedRouting { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public partial ComboItem SelectedServer { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public partial bool BlServers { get; set; }
|
||||
|
||||
#endregion ObservableCollection
|
||||
|
||||
public ReactiveCommand<RxVoid, RxVoid> AddServerViaClipboardCmd { get; }
|
||||
@@ -109,7 +98,6 @@ public partial class StatusBarViewModel : MyReactiveObject
|
||||
{
|
||||
_config = ConfigTextHandler.Config;
|
||||
SelectedRouting = new();
|
||||
SelectedServer = new();
|
||||
RunningServerToolTipText = GetRunningServerToolTipText("-");
|
||||
BlSystemProxyPacVisible = Utils.IsWindows();
|
||||
BlIsNonWindows = Utils.IsNonWindows();
|
||||
@@ -129,10 +117,6 @@ public partial class StatusBarViewModel : MyReactiveObject
|
||||
.Where(y => y != null && !y.Remarks.IsNullOrEmpty())
|
||||
.SubscribeAsync(async _ => await RoutingSelectedChangedAsync());
|
||||
|
||||
this.WhenAnyValue(x => x.SelectedServer)
|
||||
.Where(y => y != null && !y.Text.IsNullOrEmpty())
|
||||
.Subscribe(_ => ServerSelectedChanged());
|
||||
|
||||
SystemProxySelected = (int)_config.SystemProxyItem.SysProxyType;
|
||||
this.WhenAnyValue(x => x.SystemProxySelected)
|
||||
.Where(y => y >= 0)
|
||||
@@ -264,8 +248,6 @@ public partial class StatusBarViewModel : MyReactiveObject
|
||||
|
||||
public async Task RefreshServersBiz()
|
||||
{
|
||||
await RefreshServersMenu();
|
||||
|
||||
//display running server
|
||||
var running = await ConfigTextHandler.GetDefaultServer();
|
||||
if (running != null)
|
||||
@@ -285,38 +267,6 @@ public partial class StatusBarViewModel : MyReactiveObject
|
||||
return Utils.IsLinux() ? Global.AppName : serverInfo;
|
||||
}
|
||||
|
||||
private async Task RefreshServersMenu()
|
||||
{
|
||||
var lstModel = await ConfigDbQuery.ProfileModels(_config.SubIndexId, "");
|
||||
|
||||
if (lstModel?.Count > _config.GuiItem.TrayMenuServersLimit)
|
||||
{
|
||||
BlServers = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var models = lstModel.Select(it => new ComboItem { ID = it.IndexId, Text = it.GetSummary() }).ToList();
|
||||
|
||||
BlServers = true;
|
||||
Servers.ReplaceRange(models);
|
||||
|
||||
// Update the ItemsSource before SelectedItem so a collection reset does not clear the tray selection.
|
||||
SelectedServer = models.FirstOrDefault(it => it.ID == _config.IndexId) ?? new();
|
||||
}
|
||||
|
||||
private void ServerSelectedChanged()
|
||||
{
|
||||
if (SelectedServer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (SelectedServer.ID.IsNullOrEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
SetDefaultServerRequested.Publish(SelectedServer.ID);
|
||||
}
|
||||
|
||||
public async Task<AvailabilityCheckResult?> TestServerAvailability()
|
||||
{
|
||||
var item = await ConfigTextHandler.GetDefaultServer();
|
||||
|
||||
@@ -950,22 +950,6 @@
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="14"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource Margin8}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsTrayMenuServersLimit}" />
|
||||
<TextBox
|
||||
x:Name="txttrayMenuServersLimit"
|
||||
Grid.Row="14"
|
||||
Grid.Column="1"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin8}"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="15"
|
||||
Grid.Column="0"
|
||||
|
||||
@@ -104,7 +104,6 @@ public partial class OptionSettingWindow
|
||||
this.Bind(ViewModel, vm => vm.EnableDragDropSort, v => v.togEnableDragDropSort.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.DoubleClick2Activate, v => v.togDoubleClick2Activate.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.AutoUpdateInterval, v => v.txtautoUpdateInterval.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TrayMenuServersLimit, v => v.txttrayMenuServersLimit.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.CurrentFontFamily, v => v.cmbcurrentFontFamily.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SpeedTestTimeout, v => v.cmbSpeedTestTimeout.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.Text).DisposeWith(disposables);
|
||||
|
||||
@@ -188,20 +188,6 @@
|
||||
</DockPanel>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<MenuItem Height="Auto" AutomationProperties.Name="{x:Static resx:ResUI.menuServers}">
|
||||
<MenuItem.Header>
|
||||
<DockPanel>
|
||||
<ComboBox
|
||||
x:Name="cmbServers"
|
||||
MaxWidth="300"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.menuServers}"
|
||||
AutomationProperties.Name="{x:Static resx:ResUI.menuServers}"
|
||||
DisplayMemberPath="Text"
|
||||
FontSize="{DynamicResource StdFontSize}"
|
||||
Style="{StaticResource MaterialDesignFilledComboBox}" />
|
||||
</DockPanel>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem
|
||||
x:Name="menuAddServerViaClipboard2"
|
||||
|
||||
@@ -33,10 +33,6 @@ public partial class StatusBarView
|
||||
this.OneWayBind(ViewModel, vm => vm.BlRouting, v => v.menuRoutings.Visibility).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.BlRouting, v => v.sepRoutings.Visibility).DisposeWith(disposables);
|
||||
|
||||
this.OneWayBind(ViewModel, vm => vm.Servers, v => v.cmbServers.ItemsSource).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedServer, v => v.cmbServers.SelectedItem).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.BlServers, v => v.cmbServers.Visibility).DisposeWith(disposables);
|
||||
|
||||
//tray menu
|
||||
this.BindCommand(ViewModel, vm => vm.AddServerViaClipboardCmd, v => v.menuAddServerViaClipboard2).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.AddServerViaScanCmd, v => v.menuAddServerViaScan2).DisposeWith(disposables);
|
||||
|
||||
Reference in New Issue
Block a user