some refactoring

This commit is contained in:
Вячеслав 2026-01-01 22:58:33 +05:00
parent 89c3dcb424
commit bbf905495c
8 changed files with 160 additions and 106 deletions

View file

@ -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();
}
}