47 lines
1.3 KiB
C#
Raw Normal View History

2023-09-05 20:09:11 -04:00
using Avalonia;
2023-05-11 23:11:39 -04:00
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
2023-09-05 20:09:11 -04:00
using ReactiveUI;
using Serilog;
2023-05-11 23:11:39 -04:00
using SPTInstaller.ViewModels;
using SPTInstaller.Views;
2023-09-05 20:09:11 -04:00
using System.Reactive;
2023-05-11 23:11:39 -04:00
namespace SPTInstaller;
public partial class App : Application
2023-05-11 23:11:39 -04:00
{
public override void Initialize()
2023-05-11 23:11:39 -04:00
{
AvaloniaXamlLoader.Load(this);
2023-09-05 20:09:11 -04:00
2023-09-05 20:23:28 -04:00
var logPath = Path.Join(Environment.CurrentDirectory, "spt-aki-installer_.log");
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo
.File(path: logPath,
restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Debug,
rollingInterval: RollingInterval.Day)
.CreateLogger();
2023-09-05 20:09:11 -04:00
RxApp.DefaultExceptionHandler = Observer.Create<Exception>((exception) =>
{
Log.Error(exception, "An application exception occurred");
});
}
2023-05-11 23:11:39 -04:00
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
2023-05-11 23:11:39 -04:00
{
desktop.MainWindow = new MainWindow
2023-05-11 23:11:39 -04:00
{
DataContext = new MainWindowViewModel(),
};
2023-05-11 23:11:39 -04:00
}
base.OnFrameworkInitializationCompleted();
2023-05-11 23:11:39 -04:00
}
}