Add Avalonia UI frontend alongside WinForms and WPF

Introduce Avalonia as a new cross-platform UI option, including new XAML and code-behind files for the application and main window. Update Program.cs to support a --avalonia launch argument and add corresponding launch profile. Integrate Avalonia NuGet packages and ensure DataModel supports UI-thread invocation for all frontends. All business logic and state are shared via DI, enabling consistent behavior across WinForms, WPF, and Avalonia.
This commit is contained in:
MaddoScientisto 2026-02-26 18:43:07 +01:00
commit 311b3e76f0
8 changed files with 535 additions and 9 deletions

View file

@ -207,12 +207,20 @@ namespace ImageCatalog_2
return digits;
}
/// <summary>
/// Optional UI-thread invoker set by the active UI layer (WPF, Avalonia, etc.).
/// When set, <see cref="InvokeOnUiThreadAsync"/> uses this delegate instead of the WPF dispatcher.
/// </summary>
public Action<Action>? UiInvoker { get; set; }
private Task InvokeOnUiThreadAsync(Action action)
{
// Use SynchronizationContext via Task to ensure UI thread update
return Task.Run(() =>
{
System.Windows.Application.Current?.Dispatcher.Invoke(action);
if (UiInvoker != null)
UiInvoker(action);
else
System.Windows.Application.Current?.Dispatcher.Invoke(action);
});
}