small ui updates

This commit is contained in:
Вячеслав 2026-01-02 17:19:36 +05:00
parent bbf905495c
commit 21fc25741b
3 changed files with 67 additions and 8 deletions

View file

@ -1,6 +1,10 @@
using System;
using System.Diagnostics;
using System.Reflection;
using Avalonia.Controls;
using Avalonia.Interactivity;
using MetaforceInstaller.Core.Intefaces;
using MetaforceInstaller.Core.Models;
using MetaforceInstaller.Core.Services;
using MetaforceInstaller.UI.ViewModels;
@ -18,6 +22,9 @@ public partial class MainWindow : Window
_viewModel = new MainWindowViewModel();
_storageService = new StorageService();
DataContext = _viewModel;
VersionLabel.Content = Assembly.GetExecutingAssembly()
.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version;
NewInstallationButton.Click += OnNewInstalltionClick;
@ -36,4 +43,41 @@ public partial class MainWindow : Window
await newInstallationDialog.ShowDialog<NewInstallationDialog>(this);
LoadInstallations();
}
public async void OnDeleteInstallationClick(object? sender, RoutedEventArgs e)
{
if (sender is Button button && button.DataContext is InstallationData installationData)
{
var name = installationData.Title;
Console.WriteLine($"Delete {name}");
}
}
public async void OnLaunchServerClick(object? sender, RoutedEventArgs e)
{
if (sender is Button button && button.DataContext is InstallationData installationData)
{
var exePath = installationData.Parts.WindowsServerPath;
var processInfo = new ProcessStartInfo
{
FileName = exePath,
UseShellExecute = false,
};
Process.Start(processInfo);
}
}
public async void OnLaunchAdminClick(object? sender, RoutedEventArgs e)
{
if (sender is Button button && button.DataContext is InstallationData installationData)
{
var exePath = installationData.Parts.WindowsAdminPath;
var processInfo = new ProcessStartInfo
{
FileName = exePath,
UseShellExecute = false,
};
Process.Start(processInfo);
}
}
}