Refactor application to remove Windows Forms dependencies and transition to Avalonia UI

- Deleted MainWindow.xaml.cs, which contained the WPF implementation of the main window.
- Updated Program.cs to remove Windows Forms initialization and support only Avalonia UI.
- Removed Windows Forms specific code from ViewModelBase, including control marshalling logic.
This commit is contained in:
MaddoScientisto 2026-05-09 14:04:21 +02:00
commit d6b778a648
16 changed files with 64 additions and 4415 deletions

View file

@ -4,7 +4,7 @@
```powershell
# Build
dotnet build Catalog.sln
dotnet build Catalog.slnx
# Run all tests
dotnet test MaddoShared.Tests
@ -21,13 +21,13 @@ dotnet publish "imagecatalog\ImageCatalog 2.csproj" -c Release -r win-x64 --self
## Architecture
This is a WinForms/WPF image cataloging application targeting .NET 10.0-windows.
This is an Avalonia image cataloging application targeting .NET 10.0-windows.
### Projects
| Project | Purpose |
|---------|---------|
| **imagecatalog** | Main desktop application — WinForms (default), WPF (`--wpf`), or Avalonia (`--avalonia`) |
| **imagecatalog** | Main desktop application — Avalonia with Fluent theme (`AvaloniaMainWindow`) |
| **MaddoShared** | Shared image processing library (the core) |
| **MaddoShared.Tests** | Unit tests for MaddoShared |
| **MaddoShared.Benchmarks** | BenchmarkDotNet performance benchmarks |
@ -35,12 +35,7 @@ This is a WinForms/WPF image cataloging application targeting .NET 10.0-windows.
| **ImageCatalogCS / ImageCatalogParallel** | Legacy/experimental variants |
| **CatalogLib / CatalogLibVb / CatalogVbLib** | Legacy VB.NET libraries |
The main app selects its UI at startup via command-line flag:
- *(default)* — WinForms (`MainForm`)
- `--wpf` — WPF with MahApps.Metro (`MainWindow`)
- `--avalonia` — Avalonia with Fluent theme (`AvaloniaMainWindow`)
All three UIs bind to the same `DataModel`. Dialog events (`SelectSourceFolderRequested`, etc.) are subscribed in each window's code-behind. `DataModel.UiInvoker` must be set by the active UI to enable cross-thread UI updates (Avalonia sets this to `Dispatcher.UIThread.Invoke`; WPF uses `Application.Current.Dispatcher`).
The main app launches Avalonia directly. Dialog events (`SelectSourceFolderRequested`, etc.) are subscribed in `AvaloniaMainWindow` code-behind. `DataModel.UiInvoker` must be set by the active UI to enable cross-thread UI updates (Avalonia sets this to `Dispatcher.UIThread.Invoke`).
### Core Flow