Files
SteamTools/System.Application.SteamTools.Client.Desktop.Avalonia.App/Program.cs
T
rmbgame eab0e9d2ec ui
2021-02-26 19:34:54 +08:00

46 lines
1.7 KiB
C#

using Avalonia;
using Avalonia.ReactiveUI;
using NLog;
namespace System.Application.UI
{
static class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
static void Main(string[] args)
{
// 目前桌面端默认使用 SystemTextJson 如果出现兼容性问题可取消下面这行代码
// Serializable.DefaultJsonImplType = Serializable.JsonImplType.NewtonsoftJson;
var logger = LogManager.GetCurrentClassLogger();
try
{
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}
catch (Exception ex)
{
AppHelper.SetNLoggerMinLevel(LogLevel.Trace);
// NLog: catch any exception and log it.
logger.Error(ex, "Stopped program because of exception");
throw;
}
finally
{
// Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
LogManager.Shutdown();
}
}
// Avalonia configuration, don't remove; also used by visual designer.
static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.With(new SkiaOptions { MaxGpuResourceSizeBytes = 8096000 })
.With(new Win32PlatformOptions { AllowEglInitialization = true })
.LogToTrace()
.UseReactiveUI();
}
}