feat(设置): 添加实验性选项页面并优化图标显示
添加新的实验性选项页面,将高级设置中的实验性功能移至该页面 优化设置页面中图标的显示,支持自定义字体 为外部协议调用和避免全屏助手添加设置项 默认启用避免全屏助手功能
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using iNKORE.UI.WPF.Modern.Common.IconKeys;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
@@ -13,6 +14,7 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
public string Description { get; set; }
|
||||
public string PageTag { get; set; }
|
||||
public string IconGlyph { get; set; }
|
||||
public FontFamily IconFontFamily { get; set; }
|
||||
}
|
||||
|
||||
public partial class HomePage
|
||||
@@ -54,8 +56,8 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
string tag = navItem.Tag as string;
|
||||
if (!string.IsNullOrEmpty(tag) && tag != "HomePage")
|
||||
{
|
||||
string glyph = ExtractIconGlyph(navItem);
|
||||
string description = System.Windows.Controls.ToolTipService.GetToolTip(navItem) as string
|
||||
(string glyph, FontFamily fontFamily) = ExtractIconInfo(navItem);
|
||||
string description = ToolTipService.GetToolTip(navItem) as string
|
||||
?? $"点击跳转到{navItem.Content}";
|
||||
|
||||
_navItems.Add(new QuickNavItem
|
||||
@@ -63,26 +65,47 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
Header = navItem.Content?.ToString() ?? "",
|
||||
Description = description,
|
||||
PageTag = tag,
|
||||
IconGlyph = glyph
|
||||
IconGlyph = glyph,
|
||||
IconFontFamily = fontFamily
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string ExtractIconGlyph(NavigationViewItem navItem)
|
||||
private (string glyph, FontFamily fontFamily) ExtractIconInfo(NavigationViewItem navItem)
|
||||
{
|
||||
if (navItem.Icon is FontIcon fontIcon)
|
||||
{
|
||||
return fontIcon.Glyph ?? "\uE713";
|
||||
string glyph = fontIcon.Glyph ?? "\uE713";
|
||||
FontFamily fontFamily = fontIcon.FontFamily ?? new FontFamily("Segoe Fluent Icons");
|
||||
|
||||
if (fontIcon.Icon != null)
|
||||
{
|
||||
string iconStr = fontIcon.Icon.ToString();
|
||||
if (iconStr.Contains("_20_"))
|
||||
{
|
||||
string key24 = iconStr.Replace("_20_", "_24_");
|
||||
var field = typeof(FluentSystemIcons).GetField(key24, BindingFlags.Public | BindingFlags.Static);
|
||||
if (field != null)
|
||||
{
|
||||
var value = field.GetValue(null);
|
||||
if (value is FontIconData data24)
|
||||
{
|
||||
glyph = data24.Glyph ?? glyph;
|
||||
fontFamily = data24.FontFamily ?? fontFamily;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (glyph, fontFamily);
|
||||
}
|
||||
|
||||
if (navItem.Icon is SymbolIcon symbolIcon)
|
||||
{
|
||||
return char.ConvertFromUtf32((int)symbolIcon.Symbol);
|
||||
}
|
||||
return (char.ConvertFromUtf32((int)symbolIcon.Symbol), new FontFamily("Segoe Fluent Icons"));
|
||||
|
||||
return "\uE713";
|
||||
return ("\uE713", new FontFamily("Segoe Fluent Icons"));
|
||||
}
|
||||
|
||||
private void QuickNavCard_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user