2021-03-19 17:07:27 -03:00
|
|
|
using System;
|
2021-06-06 20:28:36 +01:00
|
|
|
using System.Diagnostics;
|
2021-03-19 17:07:27 -03:00
|
|
|
using System.IO;
|
|
|
|
|
using Avalonia;
|
|
|
|
|
using Avalonia.Controls;
|
|
|
|
|
using Avalonia.Controls.ApplicationLifetimes;
|
|
|
|
|
using Avalonia.Markup.Xaml;
|
2021-06-29 14:23:33 -07:00
|
|
|
using RedBookPlayer.GUI;
|
2021-03-19 17:07:27 -03:00
|
|
|
|
|
|
|
|
namespace RedBookPlayer
|
|
|
|
|
{
|
|
|
|
|
public class App : Application
|
|
|
|
|
{
|
2021-03-24 17:34:04 -03:00
|
|
|
public static Settings Settings;
|
2021-03-19 17:07:27 -03:00
|
|
|
|
2021-06-06 20:28:36 +01:00
|
|
|
static App() =>
|
|
|
|
|
Directory.SetCurrentDirectory(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName));
|
2021-03-19 17:07:27 -03:00
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
AppDomain.CurrentDomain.UnhandledException += (e, f) =>
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(((Exception)f.ExceptionObject).ToString());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
AvaloniaXamlLoader.Load(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnFrameworkInitializationCompleted()
|
|
|
|
|
{
|
2021-06-06 20:28:36 +01:00
|
|
|
if(ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
2021-03-19 17:07:27 -03:00
|
|
|
{
|
2021-06-06 20:28:36 +01:00
|
|
|
desktop.MainWindow = new MainWindow();
|
2021-03-19 17:07:27 -03:00
|
|
|
desktop.ShutdownMode = ShutdownMode.OnMainWindowClose;
|
2021-03-24 17:34:04 -03:00
|
|
|
|
|
|
|
|
Settings = Settings.Load("settings.json");
|
2021-03-19 17:07:27 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
base.OnFrameworkInitializationCompleted();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|