small ui updates
This commit is contained in:
parent
bbf905495c
commit
21fc25741b
3 changed files with 67 additions and 8 deletions
|
|
@ -8,7 +8,7 @@
|
|||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
<FileVersion>1.2.1</FileVersion>
|
||||
<FileVersion>2.0.0-b1</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="96" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="24" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Grid.Row="0"
|
||||
|
|
@ -50,17 +51,31 @@
|
|||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Expander Header="{Binding Title}" Margin="16, 8" HorizontalAlignment="Stretch">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Name="LaunchServerButton">Launch server</Button>
|
||||
<Button Name="LaunchPcAdminButton">Launch PC admin</Button>
|
||||
<Button Name="InstallVrClientButton">Install VR client</Button>
|
||||
<Button Name="InstallAndroidAdminButton">Install Android admin</Button>
|
||||
<Button Name="DeleteButton">Delete</Button>
|
||||
</StackPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Vertical">
|
||||
<Label Content="{Binding Id, StringFormat='ID: {0}'}" />
|
||||
<Label Content="{Binding InstalledAt, StringFormat='Installed: {0}'}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Vertical">
|
||||
<Button Name="LaunchServerButton" Click="OnLaunchServerClick">Launch server</Button>
|
||||
<Button Name="LaunchPcAdminButton" Click="OnLaunchAdminClick">Launch PC admin</Button>
|
||||
<Button Name="InstallVrClientButton">Install VR client</Button>
|
||||
<Button Name="InstallAndroidAdminButton">Install Android admin</Button>
|
||||
<Button Name="DeleteButton" Click="OnDeleteInstallationClick">Delete</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Expander>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
|
||||
<DockPanel Grid.Row="2">
|
||||
<Label Name="VersionLabel" HorizontalAlignment="Right" />
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
@ -19,6 +23,9 @@ public partial class MainWindow : Window
|
|||
_storageService = new StorageService();
|
||||
DataContext = _viewModel;
|
||||
|
||||
VersionLabel.Content = Assembly.GetExecutingAssembly()
|
||||
.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version;
|
||||
|
||||
NewInstallationButton.Click += OnNewInstalltionClick;
|
||||
|
||||
LoadInstallations();
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue