feat: migrate from WPF to Avalonia for cross-platform support#1
Open
doandat943 wants to merge 9 commits intomasterLazy:masterfrom
Open
feat: migrate from WPF to Avalonia for cross-platform support#1doandat943 wants to merge 9 commits intomasterLazy:masterfrom
doandat943 wants to merge 9 commits intomasterLazy:masterfrom
Conversation
- Replace WPF with Avalonia framework for Windows/Linux/macOS compatibility - Update project file: net10.0 (platform-agnostic) instead of net10.0-windows - Migrate XAML syntax from WPF to Avalonia format - Implement cross-platform file dialogs with async API - Update resource references to use avares:// protocol - Add Program.cs entry point for Avalonia initialization - Refactor event handlers and control access patterns - Replace WPF MessageBox with Avalonia MessageBoxManager - Simplify animations using Avalonia's auto-smoothing - Add comprehensive migration guide (AVALONIA_MIGRATION.md) This enables the application to run natively on all major platforms while maintaining the same functionality and visual appearance.
…orm GUI - Remove WPF-specific AssemblyInfo.cs file - Use AvaloniaXamlLoader instead of InitializeComponent - Remove Avalonia.Dialogs package (not available in 11.0) - Simplify dialog system (print to debug output for now) - Use IControlledApplicationLifetime instead of ClassicDesktopApplicationLifetime - Project now builds successfully with no errors, only warnings Build: SUCCESS (20 warnings, 0 errors)
- Created DialogService.cs with proper dialog windows for info, error, and confirmation messages - Fixed async/await warnings in MainWindow (lines 87, 214, 219) - Changed HandleDrop to async to properly await ShowErrorAsync - Changed OnDrop to async to properly await ShowInfoAsync/ShowErrorAsync - Initialize DialogService in MainWindow constructor - Replaced debug output implementation with actual Avalonia Window dialogs
- Document cross-platform support (Windows, macOS, Linux) - Add prerequisites section (NET 10.0 SDK) - Add clone and build instructions - Add platform-specific publish commands for each OS - Update features to highlight Avalonia migration
- Add build.yml: Builds and publishes for Windows (win-x64), macOS (osx-x64), and Linux (linux-x64) - Add release.yml: Creates GitHub releases with platform-specific artifacts - Add code-quality.yml: Runs code analysis and checks for build warnings - Supports automated releases when tags are pushed
…p application initialization
There was a problem hiding this comment.
Pull request overview
This PR migrates the RePKG.Neo UI layer from WPF to Avalonia to enable cross-platform desktop support (Windows/macOS/Linux), and adds GitHub Actions workflows for multi-OS build/publish and basic code-quality checks.
Changes:
- Switch
RePKG.Neofrom WPF (net10.0-windows,UseWPF) to Avalonia (net10.0) with newProgram,App, and.axamlUI files. - Replace WPF
MessageBoxusage with a custom AvaloniaDialogServiceand update file/folder picking + drag-and-drop handling. - Add CI workflows to build/publish for Linux/Windows/macOS and create GitHub Releases from version tags.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| RePKG.Neo/RePKG.Neo.csproj | Switch to Avalonia packages/resources and non-Windows TFM |
| RePKG.Neo/Program.cs | New Avalonia entry point (StartWithClassicDesktopLifetime) |
| RePKG.Neo/MainWindow.xaml.cs | Remove WPF code-behind implementation |
| RePKG.Neo/MainWindow.xaml | Remove WPF XAML window layout |
| RePKG.Neo/MainWindow.axaml.cs | New Avalonia window logic (picker, drag-drop, extraction flow) |
| RePKG.Neo/MainWindow.axaml | New Avalonia window layout/resources usage |
| RePKG.Neo/DialogService.cs | New custom dialog implementation for info/error/confirm |
| RePKG.Neo/AssemblyInfo.cs | Remove WPF theme assembly metadata |
| RePKG.Neo/App.xaml | Remove WPF app definition/resources |
| RePKG.Neo/App.axaml.cs | Convert app startup to Avalonia Application lifecycle |
| RePKG.Neo/App.axaml | Define Avalonia styles/resources for theming/brushes |
| README.md | Document cross-platform/Avalonia and build instructions |
| .github/workflows/code-quality.yml | Add a basic build + warnings-as-errors check job |
| .github/workflows/build.yml | Add multi-OS build/publish + tagged release workflow |
Comments suppressed due to low confidence (1)
RePKG.Neo/App.axaml.cs:33
App.droppedFileis no longer populated from command-line args.MainWindowstill callsHandleDrop(App.droppedFile), so file-association/"open with" scenarios will stop working. Consider readingdesktop.ArgsinOnFrameworkInitializationCompleted(or wiring args handling inProgram.Main) and settingdroppedFileaccordingly.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+18
to
+22
| <PackageReference Include="Avalonia.Diagnostics" Version="11.0.0" /> | ||
| </ItemGroup> | ||
|
|
||
|
|
||
|
|
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>WinExe</OutputType> |
Comment on lines
+3
to
+6
| x:Class="RePKG.Neo.App" | ||
| RequestedThemeVariant="Light"> | ||
| <Application.Styles> | ||
| <FluentTheme /> |
Comment on lines
+68
to
+74
|
|
||
| if (tbInput?.Text != null) { | ||
| int i = tbInput.Text.LastIndexOf('.'); | ||
| if (i > 0) { | ||
| tbOutput!.Text = string.Concat(tbInput.Text.AsSpan(0, i), "-repkg\\"); | ||
| } | ||
| } |
Comment on lines
+83
to
+88
| if (!File.Exists(droppedFile)) { | ||
| droppedFile += "\\scene.pkg"; | ||
| } | ||
|
|
||
| tbInput!.Text = droppedFile; | ||
| MakeOutputDir(); |
Comment on lines
+32
to
+35
| run: | | ||
| dotnet build -c Release -p:TreatWarningsAsErrors=true --no-restore 2>&1 | \ | ||
| grep -E "(error|warning)" || echo "Build succeeded with no errors" | ||
| continue-on-error: true |
Comment on lines
+98
to
+104
| // Open input file | ||
| private async void BtnBrowseIn_Click(object? sender, RoutedEventArgs e) { | ||
| var topLevel = GetTopLevel(this); | ||
| if (topLevel?.StorageProvider == null) return; | ||
|
|
||
| var files = await topLevel.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions { | ||
| Title = "Select Package File", |
Comment on lines
+128
to
+131
| var folders = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions { | ||
| Title = "Select Output Directory", | ||
| AllowMultiple = false | ||
| }); |
| Content="{x:Static loc:Lang.Main_Select}" | ||
| IsEnabled="{Binding IsInputEnabled}"/> | ||
| <TextBox Margin="10 0 5 0" x:Name="TbOutput" VerticalAlignment="Center" | ||
| Text="repkg\" FontSize="13" |
| @@ -13,7 +15,8 @@ An enhanced Wallpaper Engine PKG extractor and TEX converter, built upon the ori | |||
| > | |||
| > To use RePKG.Neo, you need to install [.NET 10 Desktop Runtime](https://get.dot.net/10). | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Motivation
This PR completes the migration from WPF to Avalonia, enabling the application to run on multiple platforms instead of Windows only.
Testing