0
0
mirror of https://github.com/sp-tarkov/patcher.git synced 2025-02-13 05:30:45 -05:00
patcher/Patcher/PatchClient/App.axaml.cs

44 lines
1.2 KiB
C#
Raw Normal View History

using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using PatchClient.ViewModels;
using PatchClient.Views;
2023-09-04 16:12:31 -04:00
using ReactiveUI;
using System.Reactive;
using System;
using PatcherUtils.Model;
namespace PatchClient
{
public class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
2023-09-04 16:12:31 -04:00
RxApp.DefaultExceptionHandler = Observer.Create<Exception>((exception) =>
{
PatchLogger.LogException(exception);
});
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
bool autoClose = false;
2022-05-15 18:12:50 -04:00
if(desktop.Args != null && desktop.Args.Length >= 1 && desktop.Args[0]?.ToLower() == "autoclose")
autoClose = true;
desktop.MainWindow = new MainWindow
{
DataContext = new MainWindowViewModel(autoClose),
};
}
base.OnFrameworkInitializationCompleted();
}
}
}