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

View file

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

View file

@ -4,12 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" mc:Ignorable="d"
x:Class="PS2_Manager.Welcome"> x:Class="PS2_Manager.Welcome">
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Center" Spacing="10"> <StackPanel >
<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> </UserControl>

View file

@ -12,13 +12,5 @@ public partial class Welcome : UserControl
{ {
InitializeComponent(); 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
});
}
} }