From 8092465f6d17a1e2bf365c6821e7b7423bd68cbd Mon Sep 17 00:00:00 2001 From: Sergey Khabibullin Date: Wed, 1 May 2019 10:39:19 +0300 Subject: [PATCH] Update Avalonia --- .../Tel.Egram.Application.csproj | 6 +-- src/Tel.Egram.Model/Tel.Egram.Model.csproj | 4 +- .../Tel.Egram.Services.csproj | 2 +- src/Tel.Egram.Views/Tel.Egram.Views.csproj | 6 +-- src/Tel.Egram/Program.cs | 52 +++++++++++-------- src/Tel.Egram/Tel.Egram.csproj | 8 +-- 6 files changed, 42 insertions(+), 36 deletions(-) diff --git a/src/Tel.Egram.Application/Tel.Egram.Application.csproj b/src/Tel.Egram.Application/Tel.Egram.Application.csproj index efa1a83..87b57c6 100644 --- a/src/Tel.Egram.Application/Tel.Egram.Application.csproj +++ b/src/Tel.Egram.Application/Tel.Egram.Application.csproj @@ -4,9 +4,9 @@ Tel.Egram.Application - - - + + + diff --git a/src/Tel.Egram.Model/Tel.Egram.Model.csproj b/src/Tel.Egram.Model/Tel.Egram.Model.csproj index 19da948..ab477b1 100644 --- a/src/Tel.Egram.Model/Tel.Egram.Model.csproj +++ b/src/Tel.Egram.Model/Tel.Egram.Model.csproj @@ -5,8 +5,8 @@ - - + + diff --git a/src/Tel.Egram.Services/Tel.Egram.Services.csproj b/src/Tel.Egram.Services/Tel.Egram.Services.csproj index 0673e76..011b7e2 100644 --- a/src/Tel.Egram.Services/Tel.Egram.Services.csproj +++ b/src/Tel.Egram.Services/Tel.Egram.Services.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/Tel.Egram.Views/Tel.Egram.Views.csproj b/src/Tel.Egram.Views/Tel.Egram.Views.csproj index 74ddd6b..8f29a4e 100644 --- a/src/Tel.Egram.Views/Tel.Egram.Views.csproj +++ b/src/Tel.Egram.Views/Tel.Egram.Views.csproj @@ -4,9 +4,9 @@ Tel.Egram.Views - - - + + + diff --git a/src/Tel.Egram/Program.cs b/src/Tel.Egram/Program.cs index 84f6f7d..fb7bb6d 100644 --- a/src/Tel.Egram/Program.cs +++ b/src/Tel.Egram/Program.cs @@ -1,6 +1,5 @@ using System; using Avalonia; -using Avalonia.Gtk3; using Avalonia.Platform; using Splat; using Tel.Egram.Application; @@ -38,31 +37,38 @@ private static void Run( { var app = resolver.GetService(); var builder = AppBuilder.Configure(app); - var os = builder.RuntimePlatform.GetRuntimeInfo().OperatingSystem; + var runtime = builder.RuntimePlatform.GetRuntimeInfo(); var model = new MainWindowModel(); - if (os == OperatingSystemType.OSX) + switch (runtime.OperatingSystem) { - builder.UseAvaloniaNative(null, opt => - { - opt.MacOptions.ShowInDock = true; - opt.UseDeferredRendering = true; - opt.UseGpu = true; - }).UseSkia(); - } - else if (os == OperatingSystemType.Linux) - { - builder.UseGtk3(new Gtk3PlatformOptions - { - UseDeferredRendering = true, - UseGpuAcceleration = true - }).UseSkia(); - } - else - { - builder.UseWin32( - deferredRendering: true - ).UseSkia(); + case OperatingSystemType.OSX: + builder.UseAvaloniaNative() + .With(new AvaloniaNativePlatformOptions + { + UseGpu = true, + UseDeferredRendering = true + }) + .UseSkia(); + break; + + case OperatingSystemType.Linux: + builder.UseX11() + .With(new X11PlatformOptions + { + UseGpu = true + }) + .UseSkia(); + break; + + default: + builder.UseWin32() + .With(new Win32PlatformOptions + { + UseDeferredRendering = true + }) + .UseSkia(); + break; } builder.UseReactiveUI(); diff --git a/src/Tel.Egram/Tel.Egram.csproj b/src/Tel.Egram/Tel.Egram.csproj index f5c5f16..74f2492 100644 --- a/src/Tel.Egram/Tel.Egram.csproj +++ b/src/Tel.Egram/Tel.Egram.csproj @@ -25,10 +25,10 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers