ui(client): improvements

This commit is contained in:
Pascal
2025-11-07 10:45:55 +01:00
parent 05b94a3189
commit b899d2ee7d
11 changed files with 95 additions and 54 deletions

View File

@@ -4,7 +4,7 @@
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.Styles>
<FluentTheme />
</Application.Styles>
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lang="clr-namespace:ModpackUpdater.Apps.Client.Gui.LangRes"
xmlns:svg="clr-namespace:Avalonia.Svg;assembly=Avalonia.Svg"
xmlns:pilz="https://git.pilzinsel64.de/pilz-framework/pilz"
mc:Ignorable="d"
x:Class="ModpackUpdater.Apps.Client.Gui.MainForm"
SizeToContent="WidthAndHeight"
@@ -13,7 +13,7 @@
<Grid
RowDefinitions="Auto,Auto,Auto,Auto,Auto"
Margin="3, 3, 3, 3"
Margin="3"
RowSpacing="6"
ColumnSpacing="6"
HorizontalAlignment="Stretch"
@@ -27,10 +27,10 @@
</Grid.ColumnDefinitions>
<!-- Labels -->
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Content="{x:Static lang:GeneralLangRes.MinecraftProfile}:" />
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Content="{x:Static lang:GeneralLangRes.ModpackConfigUrl}:" />
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" IsVisible="false" x:Name="LabelInstallKey" Content="{x:Static lang:GeneralLangRes.InstallationKey}:" />
<Label Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Content="{x:Static lang:GeneralLangRes.Status}:" />
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Content="{x:Static lang:GeneralLangRes.MinecraftProfile}" />
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Content="{x:Static lang:GeneralLangRes.ModpackConfigUrl}" />
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" IsVisible="false" x:Name="LabelInstallKey" Content="{x:Static lang:GeneralLangRes.InstallationKey}" />
<Label Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Content="{x:Static lang:GeneralLangRes.Status}" />
<Label Grid.Row="3" Grid.Column="1" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal">
<Image Width="16" Height="16" x:Name="ImageStatus" />
@@ -72,56 +72,43 @@
/>
<!-- Button: SearchProfileFolder -->
<Button
<pilz:ImageButton
x:Name="ButtonSearchProfileFolder"
Grid.Row="0"
Grid.Column="2"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
Text="{x:Static lang:GeneralLangRes.Select}"
Click="ButtonSearchProfileFolder_Click"
>
<StackPanel Orientation="Horizontal">
<Image VerticalAlignment="Center" Width="16" Height="16" x:Name="ButtonImageSearchProfileFolder" />
<TextBlock VerticalAlignment="Center" Margin="3, 0, 0, 0" Text="{x:Static lang:GeneralLangRes.Select}" />
</StackPanel>
</Button>
/>
<!-- Button: CheckForUpdates -->
<Button
<pilz:ImageButton
x:Name="ButtonCheckForUpdates"
Grid.Row="4"
Grid.Column="1"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" x:Name="ButtonCheckForUpdates" Click="ButtonCheckForUpdates_Click"
>
<StackPanel Orientation="Horizontal">
<Image VerticalAlignment="Center" Width="16" Height="16" x:Name="ButtonImageCheckForUpdates" />
<TextBlock VerticalAlignment="Center" Margin="3, 0, 0, 0" Text="{x:Static lang:GeneralLangRes.CheckForUpdates}" />
</StackPanel>
</Button>
HorizontalAlignment="Stretch"
Text="{x:Static lang:GeneralLangRes.CheckForUpdates}"
Click="ButtonCheckForUpdates_Click"
/>
<!-- Button: Install -->
<SplitButton
<pilz:ImageSplitButton
x:Name="ButtonInstall"
Grid.Row="4"
Grid.Column="2"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
x:Name="ButtonInstall"
Text="{x:Static lang:GeneralLangRes.Install}"
Click="ButtonInstall_Click"
>
<StackPanel Orientation="Horizontal">
<Image VerticalAlignment="Center" Width="16" Height="16" x:Name="ButtonImageInstall" />
<TextBlock VerticalAlignment="Center" Margin="3, 0, 0, 0" Text="{x:Static lang:GeneralLangRes.Install}" />
</StackPanel>
<SplitButton.Flyout>
<MenuFlyout>
<MenuItem Header="{x:Static lang:GeneralLangRes.Repair}" Click="MenuItemRepair_Click">
<MenuItem.Icon>
<Image Width="16" Height="16" x:Name="MenuItemImageRepair" />
</MenuItem.Icon>
</MenuItem>
<MenuItem x:Name="MenuItemRepair" Header="{x:Static lang:GeneralLangRes.Repair}" Click="MenuItemRepair_Click" />
</MenuFlyout>
</SplitButton.Flyout>
</SplitButton>
</pilz:ImageSplitButton>
</Grid>
</Window>

View File

@@ -11,6 +11,7 @@ using Pilz.SymbolPacks.Sets;
using Pilz.UI.AvaloniaUI.Symbols;
using System.Diagnostics;
using System.Reflection;
using Pilz.UI.Symbols;
namespace ModpackUpdater.Apps.Client.Gui;
@@ -34,10 +35,10 @@ public partial class MainForm : Window
Closing += MainForm_Closing;
Loaded += MainForm_Loaded;
ButtonImageSearchProfileFolder.Source = Symbols.Fluent.GetImageSource(SymbolsFluent.opened_folder);
ButtonImageCheckForUpdates.Source = Symbols.Fluent.GetImageSource(SymbolsFluent.update);
ButtonImageInstall.Source = Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer);
MenuItemImageRepair.Source = Symbols.Fluent.GetImageSource(SymbolsFluent.wrench);
ButtonSearchProfileFolder.ImageSource = Symbols.Fluent.GetImageSource(SymbolsFluent.opened_folder);
ButtonCheckForUpdates.ImageSource = Symbols.Fluent.GetImageSource(SymbolsFluent.update);
ButtonInstall.ImageSource = Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer);
MenuItemRepair.Icon = Symbols.Fluent.GetImage(SymbolsFluent.wrench, SymbolSize.Small);
ClearStatus();
LoadProfileToUi();
@@ -115,7 +116,7 @@ public partial class MainForm : Window
ButtonInstall.IsEnabled = false;
return false;
}
else if (updateConfig == null || string.IsNullOrWhiteSpace(TextBoxModpackConfig.Text))
else if (string.IsNullOrWhiteSpace(TextBoxModpackConfig.Text))
{
SetStatus(GeneralLangRes.ConfigIncompleteOrNotLoaded, Symbols.Fluent.GetImageSource(SymbolsFluent.warning_shield));
ButtonCheckForUpdates.IsEnabled = false;
@@ -271,7 +272,6 @@ public partial class MainForm : Window
//Application.Restart(); // FIXME
return;
}
CheckStatusAndUpdate(true);
}
@@ -314,20 +314,20 @@ public partial class MainForm : Window
private async void ButtonInstall_Click(object? sender, RoutedEventArgs e)
{
if (!currentUpdating)
{
ClearStatus();
await ExecuteUpdate(true, false);
}
if (currentUpdating)
return;
ClearStatus();
await ExecuteUpdate(true, false);
}
private async void MenuItemRepair_Click(object? sender, RoutedEventArgs e)
{
if (!currentUpdating)
{
ClearStatus();
await ExecuteUpdate(true, true);
}
if (currentUpdating)
return;
ClearStatus();
await ExecuteUpdate(true, true);
}
#endregion

View File

@@ -10,6 +10,7 @@
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
@@ -61,7 +62,7 @@
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" />
<PackageReference Include="Pilz.IO" Version="2.1.0" />
<PackageReference Include="Pilz.SymbolPacks.Fluent" Version="1.0.12" />
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.0.0" />
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.1.3" />
<PackageReference Include="Pilz.UI.AvaloniaUI.Symbols" Version="1.0.0" />
<PackageReference Include="Avalonia" Version="11.3.8" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.8" />