Add core UI

This commit is contained in:
Jöran Malek 2024-02-08 00:54:45 +01:00
parent 500d6df113
commit 2a7ff864bf
8 changed files with 181 additions and 19 deletions

View file

@ -0,0 +1,11 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:InkForge.Common"
x:Class="InkForge.Common.App"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>

View file

@ -0,0 +1,45 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Microsoft.Extensions.Hosting;
using ReactiveUI;
namespace InkForge.Common;
public partial class App : Application
{
public static readonly StyledProperty<IHost> HostProperty = AvaloniaProperty.Register<App, IHost>("Host");
public IHost Host => GetValue(HostProperty);
public IServiceProvider Services => Host.Services;
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
// var viewModel = Services.Activate<MainViewModel>();
// var view = ViewLocator.Current.ResolveView(viewModel);
// switch (ApplicationLifetime)
// {
// case IClassicDesktopStyleApplicationLifetime desktop:
// desktop.MainWindow = view as Window;
// break;
// case ISingleViewApplicationLifetime singleView:
// singleView.MainView = view as Control;
// break;
// default:
// throw new NotSupportedException();
// }
base.OnFrameworkInitializationCompleted();
}
}

View file

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>InkForge</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Http" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\shared\InkForge.Data\InkForge.Data.csproj" />
<ProjectReference Include="..\..\shared\migrations\InkForge.Sqlite\InkForge.Sqlite.csproj" />
</ItemGroup>
</Project>