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,13 +5,22 @@
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, *">
<Grid Grid.Row="0">
<Border Background="#35313d"
PointerPressed="WindowDrag">
<Grid ColumnDefinitions="*, 20">
<TextBlock Name="WindowTitle" FontSize="12" Text="Setup PS2 Manager" Padding="8,0,0,0" VerticalAlignment="Center"/>
</Grid>
</Border>
</Grid>
<Grid Grid.Row="1" Margin="20">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Name="InfoText1" Text="Welcome to PS2 Manager" HorizontalAlignment="Center"/> <TextBlock Name="InfoText1" Text="Welcome to PS2 Manager" HorizontalAlignment="Center"/>
<Separator/> <Separator/>
@ -20,4 +29,5 @@
Click="OpenLibraryButton_OnClick"/> Click="OpenLibraryButton_OnClick"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Grid>
</Window> </Window>

View file

@ -43,6 +43,8 @@ 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("");
while (String.IsNullOrEmpty(settings.library_path.GetValue<string>()))
{
var topLevel = TopLevel.GetTopLevel(this); var topLevel = TopLevel.GetTopLevel(this);
var path = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions var path = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{ {
@ -52,21 +54,18 @@ public partial class Setup : Window
try try
{ {
if (!String.IsNullOrEmpty(path[0].Path.LocalPath)) if (!String.IsNullOrEmpty(path[0].Path.LocalPath))
{
settings.library_path.SetValue(path[0].Path.LocalPath); settings.library_path.SetValue(path[0].Path.LocalPath);
FinishSetup();
}
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex.Message); Console.WriteLine(ex.Message);
} }
}
FinishSetup();
} }
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;
} }
} }