Avalonia Boilerplate

This commit is contained in:
Jöran Malek 2024-02-09 01:23:38 +01:00
parent a6d5a3eb72
commit 0d32e6a5c3
14 changed files with 117 additions and 23 deletions

View file

@ -17,4 +17,4 @@
<ProjectReference Include="..\InkForge.Common\InkForge.Common.csproj" />
</ItemGroup>
</Project>
</Project>

View file

@ -1,8 +1,9 @@
using Avalonia;
using Avalonia;
using Avalonia.ReactiveUI;
using Avalonia.Threading;
using InkForge.Common;
using InkForge.Data;
using Microsoft.Extensions.DependencyInjection;
@ -23,6 +24,7 @@ static class Program
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.UseReactiveUI()
.WithInterFont()
.LogToTrace();
private static void ConfigureServices(IServiceCollection services)
@ -32,11 +34,7 @@ static class Program
mutableResolver.InitializeSplat();
mutableResolver.InitializeReactiveUI();
services.AddHttpClient();
// services.UseFactories();
// services.AddViewModelFactory();
// services.AddTransient<IViewFor<MainViewModel>, MainWindow>();
services.AddInkForge();
}
private static void OnSetup(this IServiceCollection services, AppBuilder appBuilder)

View file

@ -0,0 +1,9 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="InkForge.Desktop.Views.MainWindow"
Title="InkForge">
</Window>

View file

@ -0,0 +1,13 @@
using Avalonia.ReactiveUI;
using InkForge.Common.ViewModels;
namespace InkForge.Desktop.Views;
public partial class MainWindow : ReactiveWindow<AppViewModel>
{
public MainWindow()
{
InitializeComponent();
}
}