Update AppBuilderExtension.cs && Fix Bug (#9483)

* Update AppBuilderExtension.cs

* Update OptionSettingWindow.axaml.cs

* Update OptionSettingWindow.axaml.cs

* Update Global.cs

* Rename ResUI.fa-Ir.resx to ResUI.fa.resx

* Update ServiceLib.csproj
This commit is contained in:
JieXu
2026-06-06 11:09:53 +08:00
committed by GitHub
parent eb9c974436
commit 4dc9c60b85
5 changed files with 52 additions and 13 deletions
@@ -1,3 +1,4 @@
using Avalonia.Media;
using v2rayN.Desktop.Base;
using v2rayN.Desktop.Common;
@@ -88,7 +89,6 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.DisplayRealTimeSpeed, v => v.togDisplayRealTimeSpeed.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
//this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AutoHideStartup, v => v.togAutoHideStartup.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.Hide2TrayWhenClose, v => v.togHide2TrayWhenClose.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.MacOSShowInDock, v => v.togMacOSShowInDock.IsChecked).DisposeWith(disposables);
@@ -166,9 +166,10 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
var lstFonts = new List<string>();
try
{
var lst = Avalonia.Media.FontManager.Current.SystemFonts
var lst = FontManager.Current.SystemFonts
.Select(t => t.Name)
.Where(t => t.IsNotEmpty())
.Append(GetDefaultFontFamilyName())
.Where(IsInstalledFontFamilyName)
.Distinct(StringComparer.OrdinalIgnoreCase)
.OrderBy(t => t)
.ToList();
@@ -181,6 +182,20 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
return lstFonts;
}
private static string GetDefaultFontFamilyName() => "Noto Sans SC";
private static bool IsInstalledFontFamilyName(string fontFamilyName)
{
return fontFamilyName.IsNotEmpty()
&& !IsCssFontFamilyAlias(fontFamilyName);
}
private static bool IsCssFontFamilyAlias(string fontFamilyName)
{
return fontFamilyName.StartsWith("-", StringComparison.Ordinal)
|| fontFamilyName.Equals("BlinkMacSystemFont", StringComparison.OrdinalIgnoreCase);
}
private void ClbdestOverride_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
if (ViewModel != null)