Merge branch 'net6' into net462

This commit is contained in:
doudou0720
2026-05-02 12:42:54 +08:00
8 changed files with 142 additions and 61 deletions
@@ -302,7 +302,7 @@
<TextBlock Text="{i18n:I18n Key=AutoSave_Title}" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
<controls:LabeledSettingsCard x:Name="CardSaveScreenshotsInDateFolders"
Header="{i18n:I18n Key=Storage_AutoSaveInkOnScreenshot}"
Header="{i18n:I18n Key=Storage_ScreenshotsByDateFolder}"
Icon="{x:Static ui:SegoeFluentIcons.Folder}"
Toggled="ToggleSwitchSaveScreenshotsInDateFolders_Toggled"/>
@@ -59,9 +59,18 @@
</Grid>
<!-- 横向占比柱状图 -->
<Border Height="14" CornerRadius="7"
<Border x:Name="UsageBarBorder" Height="14" CornerRadius="2"
Background="{DynamicResource ControlStrokeColorDefaultBrush}"
ClipToBounds="True">
<Border.OpacityMask>
<VisualBrush>
<VisualBrush.Visual>
<Border Background="Black" CornerRadius="2"
Width="{Binding ActualWidth, ElementName=UsageBarBorder}"
Height="{Binding ActualHeight, ElementName=UsageBarBorder}"/>
</VisualBrush.Visual>
</VisualBrush>
</Border.OpacityMask>
<Grid x:Name="UsageStackedBar">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="BarCoreCol" Width="0*"/>
@@ -78,6 +78,7 @@ namespace Ink_Canvas.Windows.SettingsViews
RegisterDpiChangedListener();
LoadPluginSettingsPages();
UpdateUpdateBadgeVisibility();
_ = PreloadAllPagesAsync();
};
this.Closed += (sender, e) =>
@@ -690,6 +691,42 @@ namespace Ink_Canvas.Windows.SettingsViews
return NavigationViewControl;
}
private async System.Threading.Tasks.Task PreloadAllPagesAsync()
{
try
{
var tags = _pageTypes.Keys.ToList();
foreach (var tag in tags)
{
if (_pages.ContainsKey(tag))
continue;
if (!_pageTypes.TryGetValue(tag, out var type))
continue;
if (type == typeof(PluginSettingsPage))
continue;
await Dispatcher.InvokeAsync(() =>
{
try
{
if (_pages.ContainsKey(tag))
return;
var page = Activator.CreateInstance(type);
_pages[tag] = page;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"预加载设置页面 {tag} 失败: {ex.Message}");
}
}, System.Windows.Threading.DispatcherPriority.Background);
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"异步预加载设置页面时出错: {ex.Message}");
}
}
public void UpdateUpdateBadgeVisibility()
{
try