Skip to content

feat: migrate from WPF to Avalonia for cross-platform support#1

Open
doandat943 wants to merge 9 commits intomasterLazy:masterfrom
doandat943:feature/avalonia-migration
Open

feat: migrate from WPF to Avalonia for cross-platform support#1
doandat943 wants to merge 9 commits intomasterLazy:masterfrom
doandat943:feature/avalonia-migration

Conversation

@doandat943
Copy link
Copy Markdown

Summary

  • Migrate UI from WPF to Avalonia 11
  • Add cross-platform support (Windows/macOS/Linux)
  • Setup CI/CD with GitHub Actions
  • Implement dialog system

Motivation

This PR completes the migration from WPF to Avalonia, enabling the application to run on multiple platforms instead of Windows only.

Testing

  • Build succeeds on local
  • Build succeeds on Windows/macOS/Linux (via CI/CD)

- 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
Copilot AI review requested due to automatic review settings May 6, 2026 13:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Neo from WPF (net10.0-windows, UseWPF) to Avalonia (net10.0) with new Program, App, and .axaml UI files.
  • Replace WPF MessageBox usage with a custom Avalonia DialogService and 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.droppedFile is no longer populated from command-line args. MainWindow still calls HandleDrop(App.droppedFile), so file-association/"open with" scenarios will stop working. Consider reading desktop.Args in OnFrameworkInitializationCompleted (or wiring args handling in Program.Main) and setting droppedFile accordingly.

💡 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 thread RePKG.Neo/App.axaml
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"
Comment thread README.md
@@ -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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants