Files
LanMountainDesktop/.trae/documents/avalonia12-migration-plan.md
lincube abfa64b3d7 Avalonia12 (#7)
* ava12升级

* Enable centralized package versioning

Add <Project> and <PropertyGroup> with <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> to Directory.Packages.props to enable centralized package version management across the repository. This allows package versions to be controlled from this single file instead of individual project files.

* Migrate codebase to Avalonia 12 APIs

Apply Avalonia 12 migration changes: replace SystemDecorations with WindowDecorations and remove ExtendClientAreaChromeHints/ExtendClientAreaTitleBarHeightHint usages; update BindingPlugins removal logic (no-op); switch clipboard usage to ClipboardExtensions.SetTextAsync; update Bitmap.CopyPixels calls to the new signature. Replace TextBox.Watermark with PlaceholderText, convert NumberBox styles to FANumberBox and adjust templates, change Checked/Unchecked handlers to IsCheckedChanged, and adapt FluentIcons usages (SymbolIconSource -> FASymbol/FAFont/FluentIcon equivalents). Fix MainWindow partial classes to inherit Window and correct missing variables/fields/usings. Add migration docs/specs/tasks under .trae and include a small TestFluentIcons project for icon testing.

* Migrate to Avalonia 12 and Plugin SDK v5

Upgrade project to the Avalonia 12 baseline and Plugin SDK v5: centralize Avalonia packages, remove legacy WebView.Avalonia usage (use NativeWebView/WebView2 EnvironmentRequested), and update Fluent/Material icon/package usages. Bump multiple package/project versions to 5.0.0 and Avalonia 12.0.1, update plugin template and README/docs to SDK v5, and add PLUGIN_SDK_V5_MIGRATION.md.

Also fix runtime/behavior bugs: make DataLocationResolver use a fixed bootstrap launcher data path and avoid recursive ResolveDataRoot; add legacy-state handling and extraction in OobeStateService; and update component settings tests to reflect migrated storage (DB/backup) and reset cache for test reloads. Various csproj, tests, and docs updated to reflect the migration and ensure build/test compatibility.

* Update icon glyphs and symbol mappings

Replace and refine icon sources across settings pages and controls: many FAFontIconSource glyphs were updated to specific Seagull Fluent Icons codepoints, some FASymbolIconSource usages were replaced with FAFontIconSource, and a number of symbol-to-Symbol enum mappings were adjusted (e.g. "Bell" -> AlertOn, "Shield" -> ShieldLock). Also clarified a comment in SettingsWindow and fixed a trailing newline in StudySettingsPage. Changes standardize icon visuals and bridge FluentIcons glyphs into FluentAvalonia icon sources.

* fix.修复合并产生的问题。
2026-04-29 12:14:29 +08:00

3.3 KiB
Raw Permalink Blame History

Avalonia 12 迁移计划

当前状态

项目已完成以下迁移准备:

  • Directory.Packages.props 中 Avalonia 包已升级到 12.0.1

  • FluentAvaloniaUI 已升级到 3.0.0-preview1

  • Avalonia.Diagnostics 已替换为 AvaloniaUI.DiagnosticsSupport

  • Avalonia.Controls.WebView 已升级到 12.0.0

  • ClassIsland.Markdown.Avalonia 已升级到 12.0.0

构建错误清单26 errors

1. 窗口装饰 API 移除8 errors

文件LanMountainDesktop/Views/SettingsWindow.axaml.cs4 errors

  • ExtendClientAreaChromeHints 不存在line 166, 179

  • SystemDecorations 已过时,需改用 WindowDecorationsline 168, 177

文件LanMountainDesktop/Views/ComponentEditorWindow.axaml.cs4 errors

  • ExtendClientAreaChromeHints 不存在line 63, 72

  • SystemDecorations 已过时,需改用 WindowDecorationsline 65, 70

AXAML 文件13 个文件使用 SystemDecorations 属性(编译警告)

2. 变量/字段未找到8 errors

文件LanMountainDesktop/Views/MainWindow.ComponentSystem.cs

  • centerLeft 不存在line 759, 766, 778

  • positions 不存在line 1266

文件LanMountainDesktop/Views/MainWindow.DesktopPaging.cs

  • child 不存在line 312

  • _isThreeFingerOrRightDragSwipeActive 不存在line 517, 828, 847, 850

3. API 变更3 errors

文件LanMountainDesktop/App.axaml.cs

  • BindingPlugins 不可访问line 532, 537

文件LanMountainDesktop/Views/Components/DesktopComponentFailureView.cs

  • IClipboard.SetTextAsync 不存在line 187

文件LanMountainDesktop/Services/MonetColorService.cs

  • Bitmap.CopyPixels 参数不匹配line 91

4. 第三方库变更1 error

文件LanMountainDesktop/Views/SettingsWindow.axaml.cs

  • FluentIcons.Avalonia.SymbolIconSource 不存在line 215

5. 过时属性警告(需同步修复)

  • TextBox.WatermarkPlaceholderText7 处 .cs + 7 处 .axaml

迁移步骤

Phase 1: 修复窗口装饰 API高优先级

  1. 重写 SettingsWindow.ApplyChromeMode() 使用 Avalonia 12 新 API
  2. 重写 ComponentEditorWindow.ApplyChromeMode() 使用 Avalonia 12 新 API
  3. 批量替换所有 .axaml 中的 SystemDecorationsWindowDecorations

Phase 2: 修复 MainWindow 编译错误(高优先级)

  1. 检查 MainWindow.ComponentSystem.cscenterLeftpositions 的作用域问题
  2. 检查 MainWindow.DesktopPaging.cschild_isThreeFingerOrRightDragSwipeActive 的作用域问题
  3. 确认这些变量是否被意外删除或重命名

Phase 3: 修复 Avalonia 12 API 变更(中优先级)

  1. App.axaml.cs: 替换 BindingPlugins.DataValidators 的访问方式
  2. DesktopComponentFailureView.cs: 使用新的剪贴板 API
  3. MonetColorService.cs: 更新 Bitmap.CopyPixels 调用签名

Phase 4: 修复第三方库变更(中优先级)

  1. SettingsWindow.axaml.cs: 替换 FluentIcons.Avalonia.SymbolIconSource 为 v3 等效 API

Phase 5: 清理过时属性(低优先级)

  1. 批量替换 WatermarkPlaceholderText(所有 .cs 和 .axaml

验证步骤

  • 每阶段修复后运行 dotnet build LanMountainDesktop.slnx -c Debug

  • 最终运行 dotnet test LanMountainDesktop.slnx -c Debug