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:
parent
3ae4da3e49
commit
311b3e76f0
8 changed files with 535 additions and 9 deletions
20
imagecatalog/AvaloniaApp.axaml.cs
Normal file
20
imagecatalog/AvaloniaApp.axaml.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace ImageCatalog_2;
|
||||
|
||||
public partial class AvaloniaApp : Avalonia.Application
|
||||
{
|
||||
public override void Initialize() => AvaloniaXamlLoader.Load(this);
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
var model = Program.ServiceProvider.GetRequiredService<DataModel>();
|
||||
desktop.MainWindow = new AvaloniaMainWindow(model);
|
||||
}
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue