Compare commits

..

No commits in common. "e562d4a0ad4877febd3578d71f4b36876f87aa75" and "ecc4728e5e72f5c7e26540c9632f76ce538ceeea" have entirely different histories.

2 changed files with 36 additions and 27 deletions

View file

@ -5,19 +5,29 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="PS2_Manager.Setup" x:Class="PS2_Manager.Setup"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
Title="Setup PS2 Manager" SystemDecorations="None"
Title="Setup"
Height="349" Height="349"
Width="598" Width="598"
CanResize="False"
Background="#201c29" Background="#201c29"
Closing="Window_OnClosing"> Closing="Window_OnClosing">
<Grid Margin="20"> <Grid RowDefinitions="20, *">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <Grid Grid.Row="0">
<TextBlock Name="InfoText1" Text="Welcome to PS2 Manager" HorizontalAlignment="Center"/> <Border Background="#35313d"
<Separator/> PointerPressed="WindowDrag">
<TextBlock Name="InfoText2" Text="First of all please select the path to your PS2 Game Library" HorizontalAlignment="Center"/> <Grid ColumnDefinitions="*, 20">
<Button Name="OpenLibraryButton" Content="Select Folder" HorizontalAlignment="Center" Margin="0,10" <TextBlock Name="WindowTitle" FontSize="12" Text="Setup PS2 Manager" Padding="8,0,0,0" VerticalAlignment="Center"/>
Click="OpenLibraryButton_OnClick"/> </Grid>
</StackPanel> </Border>
</Grid>
<Grid Grid.Row="1" Margin="20">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Name="InfoText1" Text="Welcome to PS2 Manager" HorizontalAlignment="Center"/>
<Separator/>
<TextBlock Name="InfoText2" Text="First of all please select the path to your PS2 Game Library" HorizontalAlignment="Center"/>
<Button Name="OpenLibraryButton" Content="Select Folder" HorizontalAlignment="Center" Margin="0,10"
Click="OpenLibraryButton_OnClick"/>
</StackPanel>
</Grid>
</Grid> </Grid>
</Window> </Window>

View file

@ -43,30 +43,29 @@ public partial class Setup : Window
{ {
Console.Info("Open Library Button Clicked"); Console.Info("Open Library Button Clicked");
settings.library_path.SetValue(""); settings.library_path.SetValue("");
var topLevel = TopLevel.GetTopLevel(this); while (String.IsNullOrEmpty(settings.library_path.GetValue<string>()))
var path = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{ {
Title = "Open Game Library", var topLevel = TopLevel.GetTopLevel(this);
AllowMultiple = false var path = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
});
try
{
if (!String.IsNullOrEmpty(path[0].Path.LocalPath))
{ {
settings.library_path.SetValue(path[0].Path.LocalPath); Title = "Open Game Library",
FinishSetup(); AllowMultiple = false
});
try
{
if (!String.IsNullOrEmpty(path[0].Path.LocalPath))
settings.library_path.SetValue(path[0].Path.LocalPath);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
} }
} }
catch (Exception ex) FinishSetup();
{
Console.WriteLine(ex.Message);
}
} }
private void Window_OnClosing(object? sender, WindowClosingEventArgs e) private void Window_OnClosing(object? sender, WindowClosingEventArgs e)
{ {
if(!this.SetupFinished) Environment.Exit(0); if(!this.SetupFinished) e.Cancel = true;
} }
} }