switched to new way
This commit is contained in:
parent
f22d182c8f
commit
4a65c8e17b
96 changed files with 4991 additions and 10025 deletions
44
src/Poe2Trade.Ui/App.axaml.cs
Normal file
44
src/Poe2Trade.Ui/App.axaml.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Poe2Trade.Bot;
|
||||
using Poe2Trade.Core;
|
||||
using Poe2Trade.Ui.ViewModels;
|
||||
using Poe2Trade.Ui.Views;
|
||||
|
||||
namespace Poe2Trade.Ui;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
var store = new ConfigStore();
|
||||
var config = AppConfig.Load();
|
||||
var bot = new BotOrchestrator(store, config);
|
||||
|
||||
var mainVm = new MainWindowViewModel(bot)
|
||||
{
|
||||
DebugVm = new DebugViewModel(bot),
|
||||
SettingsVm = new SettingsViewModel(bot)
|
||||
};
|
||||
|
||||
var window = new MainWindow { DataContext = mainVm };
|
||||
window.SetConfigStore(store);
|
||||
desktop.MainWindow = window;
|
||||
|
||||
desktop.ShutdownRequested += async (_, _) =>
|
||||
{
|
||||
await bot.DisposeAsync();
|
||||
};
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue