Cross Platform Application to allow control with a MIDI controller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using LightweightIocContainer.Interfaces;
using Mystify.ViewModels;
using Mystify.Views;
namespace Mystify
{
public class App : Application
{
private IIocContainer? _kernel;
public override void Initialize() => AvaloniaXamlLoader.Load(this);
public override void OnFrameworkInitializationCompleted()
{
if (Design.IsDesignMode)
return;
Bootstrapper bootstrapper = new();
_kernel = bootstrapper.BootstrapKernel();
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopStyleApplicationLifetime)
{
desktopStyleApplicationLifetime.MainWindow = new MainWindow
{
DataContext = new MainWindowViewModel(),
};
desktopStyleApplicationLifetime.Exit += OnExit;
}
base.OnFrameworkInitializationCompleted();
}
private void OnExit(object? sender, ControlledApplicationLifetimeExitEventArgs args) => _kernel?.Dispose();
}
}