39 lines
No EOL
1.1 KiB
C#
39 lines
No EOL
1.1 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using MetaforceInstaller.Core.Intefaces;
|
|
using MetaforceInstaller.Core.Services;
|
|
using MetaforceInstaller.UI.ViewModels;
|
|
|
|
namespace MetaforceInstaller.UI.Windows;
|
|
|
|
public partial class MainWindow : Window
|
|
{
|
|
private MainWindowViewModel _viewModel;
|
|
private IStorageService _storageService;
|
|
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
|
|
_viewModel = new MainWindowViewModel();
|
|
_storageService = new StorageService();
|
|
DataContext = _viewModel;
|
|
|
|
NewInstallationButton.Click += OnNewInstalltionClick;
|
|
|
|
LoadInstallations();
|
|
}
|
|
|
|
private void LoadInstallations()
|
|
{
|
|
var appData = _storageService.Load();
|
|
_viewModel.LoadInstallations(appData.Installations);
|
|
}
|
|
|
|
public async void OnNewInstalltionClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
var newInstallationDialog = new NewInstallationDialog(_storageService);
|
|
await newInstallationDialog.ShowDialog<NewInstallationDialog>(this);
|
|
LoadInstallations();
|
|
}
|
|
} |