From dea289ab8e512425aa8005be2f09a0bcb4d737ea Mon Sep 17 00:00:00 2001 From: arcanix601 Date: Thu, 2 Jul 2026 15:17:03 +0800 Subject: [PATCH] build(avalonia): upgrade to v12 --- LabelAva.csproj | 17 ++++++++--------- LabelAva.sln | 24 ------------------------ LabelAva.slnx | 3 +++ MainWindow.axaml | 4 ++-- MainWindow.axaml.cs | 14 ++++++-------- Program.cs | 3 +++ Views/ImageAssociationWindow.axaml | 2 +- Views/ImageSelectionWindow.axaml | 2 +- Views/PreferencesWindow.axaml | 18 +++++++++--------- 9 files changed, 33 insertions(+), 54 deletions(-) delete mode 100644 LabelAva.sln create mode 100644 LabelAva.slnx diff --git a/LabelAva.csproj b/LabelAva.csproj index 93623f6..dbe8eb7 100644 --- a/LabelAva.csproj +++ b/LabelAva.csproj @@ -26,18 +26,17 @@ - - - - - - - + + + + + + None All - - + + diff --git a/LabelAva.sln b/LabelAva.sln deleted file mode 100644 index 1c845e2..0000000 --- a/LabelAva.sln +++ /dev/null @@ -1,24 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.5.2.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LabelAva", "LabelAva.csproj", "{20413409-46E2-6311-83C2-7F8C3E780B17}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {20413409-46E2-6311-83C2-7F8C3E780B17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {20413409-46E2-6311-83C2-7F8C3E780B17}.Debug|Any CPU.Build.0 = Debug|Any CPU - {20413409-46E2-6311-83C2-7F8C3E780B17}.Release|Any CPU.ActiveCfg = Release|Any CPU - {20413409-46E2-6311-83C2-7F8C3E780B17}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {D12D9FF8-D778-48D4-BA75-83136FAC0EB4} - EndGlobalSection -EndGlobal diff --git a/LabelAva.slnx b/LabelAva.slnx new file mode 100644 index 0000000..b0e79cf --- /dev/null +++ b/LabelAva.slnx @@ -0,0 +1,3 @@ + + + diff --git a/MainWindow.axaml b/MainWindow.axaml index f609f0f..2b6397f 100644 --- a/MainWindow.axaml +++ b/MainWindow.axaml @@ -61,7 +61,7 @@ - + - TopLevel.GetTopLevel(this)?.FocusManager?.ClearFocus(), + TopLevel.GetTopLevel(this)?.FocusManager?.Focus(null), DispatcherPriority.Loaded); Dispatcher.UIThread.Post(() => _isIntentionalBlur = false, @@ -1325,19 +1326,16 @@ private void OnTranslationTextBoxTextChanged(object? sender, TextChangedEventArg /// 若处于"主动离焦"状态(_isIntentionalBlur),立即清除焦点并复位标志。 /// 正常情况下(用户点击文本框、AutoFocusTextBox 触发)不受影响。 /// - private void OnTranslationTextBoxGotFocus(object? sender, GotFocusEventArgs e) + private void OnTranslationTextBoxGotFocus(object? sender, FocusChangedEventArgs e) { if (!_isIntentionalBlur) return; _isIntentionalBlur = false; Dispatcher.UIThread.Post( - () => TopLevel.GetTopLevel(this)?.FocusManager?.ClearFocus(), + () => TopLevel.GetTopLevel(this)?.FocusManager?.Focus(null), DispatcherPriority.Input); } - /// - - /// /// 全局快捷键拦截(隧道路由,在子控件处理前触发) /// 用于接管并统一处理 TextBox 等子控件的撤销/重做快捷键冲突 @@ -1481,7 +1479,7 @@ private void SelectLabelByIndex(int labelIndex) // UI 层补充操作 if (Navigation.SelectedItem != null) { - TopLevel.GetTopLevel(this)?.FocusManager?.ClearFocus(); + TopLevel.GetTopLevel(this)?.FocusManager?.Focus(null); StatusBar.UpdateStatus($"已选中标注 #{labelIndex}", StatusBarViewModel.StatusType.Info); } } diff --git a/Program.cs b/Program.cs index df96512..8c9381c 100644 --- a/Program.cs +++ b/Program.cs @@ -16,6 +16,9 @@ public static void Main(string[] args) => BuildAvaloniaApp() public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() +#if DEBUG + .WithDeveloperTools() +#endif .WithInterFont() .LogToTrace(); } diff --git a/Views/ImageAssociationWindow.axaml b/Views/ImageAssociationWindow.axaml index e21b759..e9742ff 100644 --- a/Views/ImageAssociationWindow.axaml +++ b/Views/ImageAssociationWindow.axaml @@ -91,7 +91,7 @@ - +