UI improvements

This commit is contained in:
WeeXnes 2025-04-26 17:28:17 +02:00
parent 8d0cadbff0
commit 717fa6e111
4 changed files with 76 additions and 39 deletions

View file

@ -58,27 +58,57 @@
</Border>
<Border Grid.Column="2">
<Border Margin="2,0,0,0" Name="GameEdit">
<Grid RowDefinitions="*, 40, 10">
<ScrollViewer Grid.Row="0">
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Foreground="White" Text="Display Name:" HorizontalAlignment="Center" Padding="0,10"/>
<TextBox Foreground="White" Name="NameTextBox_Edit"/>
<Separator/>
<Button Foreground="White" Content="Calculate Checksums" Click="ChecksumButtonOnClick" HorizontalAlignment="Stretch"></Button>
<Border Background="#35313d" CornerRadius="5" Padding="10" Margin="0,5" IsVisible="False" Name="ChecksumArea">
<StackPanel>
<TextBlock Foreground="White" FontSize="10" Name="MD5TextBlock"/>
<TextBlock Foreground="White" FontSize="10" Name="SHATextBlock"/>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
<Grid Grid.Row="1" ColumnDefinitions="*,*">
<Button Foreground="White" Content="Undo" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center"
Click="Undo_OnClick"/>
<Button Foreground="White" Content="Save" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"
Click="Save_OnClick"/>
<Border Margin="2,0,0,0">
<Grid>
<StackPanel Name="WelcomePanel"
Orientation="Vertical"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Spacing="10">
<TextBlock Text="Welcome to the PS2 Games Manager"
HorizontalAlignment="Center"
TextAlignment="Center"
FontSize="18"
FontWeight="Bold"
TextWrapping="Wrap"/>
<Separator HorizontalAlignment="Center"/>
<TextBlock Text="by WeeXnes"
HorizontalAlignment="Center"
TextAlignment="Center"
FontStyle="Italic"
TextWrapping="Wrap"/>
<Separator HorizontalAlignment="Center"/>
<TextBlock Text="Check out the source code and contribute at:"
HorizontalAlignment="Center"
TextAlignment="Center"
Margin="10"
TextWrapping="Wrap"/>
<Button Content="PS2 Manager Repository"
HorizontalAlignment="Center"
Click="OnRepositoryLinkClicked"/>
</StackPanel>
<Grid RowDefinitions="*, 40, 10" Name="GameEdit" IsVisible="False">
<ScrollViewer Grid.Row="0">
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Foreground="White" Text="Display Name:" HorizontalAlignment="Center" Padding="0,10"/>
<TextBox Foreground="White" Name="NameTextBox_Edit"/>
<Separator/>
<Button Foreground="White" Content="Calculate Checksums" Click="ChecksumButtonOnClick" HorizontalAlignment="Stretch"></Button>
<Border Background="#35313d" CornerRadius="5" Padding="10" Margin="0,5" IsVisible="False" Name="ChecksumArea">
<StackPanel>
<TextBlock Foreground="White" FontSize="10" Name="MD5TextBlock"/>
<TextBlock Foreground="White" FontSize="10" Name="SHATextBlock"/>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
<Grid Grid.Row="1" ColumnDefinitions="*,*">
<Button Foreground="White" Content="Undo" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center"
Click="Undo_OnClick"/>
<Button Foreground="White" Content="Save" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"
Click="Save_OnClick"/>
</Grid>
</Grid>
</Grid>
</Border>

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Avalonia.Controls;
@ -52,9 +53,16 @@ public partial class MainWindow : Window
Console.Info("Selected " + selectedGame + " from ListView");
SetEditArea();
SetShowcaseArea();
SwitchView(false);
}
}
private void SwitchView(bool welcome)
{
GameEdit.IsVisible = !welcome;
WelcomePanel.IsVisible = welcome;
}
private void SetShowcaseArea()
{
if (GamesList.SelectedItem is Game selectedGame)
@ -75,6 +83,7 @@ public partial class MainWindow : Window
{
if (GamesList.SelectedItem is Game selectedGame)
{
ChecksumArea.IsVisible = false;
NameTextBox_Edit.Text = selectedGame.Name;
}
}
@ -124,6 +133,7 @@ public partial class MainWindow : Window
public void FetchGamesFromLibrary(object? sender = null, EventArgs? e = null)
{
SwitchView(true);
Console.Info("Fetching games from library...");
List<Game> Games = new List<Game>();
Util.CheckDir(Path.Combine(settings.library_path.GetValue<string>(), "DVD"));
@ -164,6 +174,16 @@ public partial class MainWindow : Window
//Game Edit Area/////////////////////////////////////////////////////////////
private void OnRepositoryLinkClicked(object sender, RoutedEventArgs e)
{
Console.Info("Repository Link Clicked");
Process.Start(new ProcessStartInfo
{
FileName = "https://git.weexnes.dev/WeeXnes/ps2_manager",
UseShellExecute = true
});
}
private void Save_OnClick(object? sender, RoutedEventArgs e)
{
if (GamesList.SelectedItem is Game selectedGame)
@ -193,8 +213,8 @@ public partial class MainWindow : Window
{
string filePath = selectedGame.GamePath;
MD5TextBlock.Text = "MD5: Loading...";
SHATextBlock.Text = "SHA1: Loading...";
this.MD5Hash.Value = "Loading...";
this.SHA1Hash.Value = "Loading...";
ChecksumArea.IsVisible = true;
BackgroundWorker md5Worker = new BackgroundWorker();

View file

@ -4,12 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="PS2_Manager.Welcome">
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Center" Spacing="10">
<TextBlock Text="Welcome to the PS2 Games Manager" HorizontalAlignment="Center" FontSize="18" FontWeight="Bold"/>
<Separator HorizontalAlignment="Center"/>
<TextBlock Text="by WeeXnes" HorizontalAlignment="Center" FontStyle="Italic"/>
<Separator HorizontalAlignment="Center"/>
<TextBlock Text="Check out the source code and contribute at:" HorizontalAlignment="Center" Margin="10"/>
<Button Content="PS2 Manager Repository" HorizontalAlignment="Center" Click="OnRepositoryLinkClicked"/>
<StackPanel >
</StackPanel>
</UserControl>

View file

@ -12,13 +12,5 @@ public partial class Welcome : UserControl
{
InitializeComponent();
}
private void OnRepositoryLinkClicked(object sender, RoutedEventArgs e)
{
Console.Info("Repository Link Clicked");
Process.Start(new ProcessStartInfo
{
FileName = "https://git.weexnes.dev/WeeXnes/ps2_manager",
UseShellExecute = true
});
}
}