some refactoring
This commit is contained in:
parent
89c3dcb424
commit
bbf905495c
8 changed files with 160 additions and 106 deletions
|
|
@ -1,40 +0,0 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using MetaforceInstaller.Core.Intefaces;
|
||||
using MetaforceInstaller.Core.Services;
|
||||
using MetaforceInstaller.UI.ViewModels;
|
||||
|
||||
namespace MetaforceInstaller.UI;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private MainWindowViewModel _viewModel;
|
||||
private IStorageService _storageService;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_viewModel = new MainWindowViewModel();
|
||||
DataContext = _viewModel;
|
||||
|
||||
_storageService = new StorageService();
|
||||
|
||||
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();
|
||||
await newInstallationDialog.ShowDialog<NewInstallationDialog>(this);
|
||||
LoadInstallations();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue