Settings overhaul

This commit is contained in:
Max Chaev 2025-02-26 16:32:14 +03:00
parent 7a8d262aed
commit 6bd8cab129
3 changed files with 34 additions and 28 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -19,47 +19,51 @@
Background="#353535" Background="#353535"
> >
<Grid> <Window.Background>
<Grid.RowDefinitions> <ImageBrush Source="/Assets/Sprites/toml-paper.png" Stretch="UniformToFill"/>
<RowDefinition Height="*" /> </Window.Background>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" /> <StackPanel Margin="5">
</Grid.RowDefinitions>
<Grid.ColumnDefinitions> <StackPanel HorizontalAlignment="Center">
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.ColumnSpan="2">
<TextBlock <TextBlock
HorizontalAlignment="Center"
Text="All tweaks can be found in TOML near executable." Text="All tweaks can be found in TOML near executable."
FontFamily="{StaticResource QuicksandFont}" FontFamily="{StaticResource QuicksandFont}"
/> />
<TextBlock <TextBlock
HorizontalAlignment="Center"
x:Name="tweaksVersion" x:Name="tweaksVersion"
FontFamily="{StaticResource QuicksandFont}" FontFamily="{StaticResource QuicksandFont}"
/> />
</StackPanel> </StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0"> <StackPanel Margin="20">
<StackPanel>
<TextBlock
x:Name="currentDir"
FontFamily="{StaticResource QuicksandFont}"
/>
<Button <Button
Margin="5" Margin="5"
Content="Select minecraft folder" Content="Select minecraft folder"
Click="OnFilePickerClick" Click="OnFilePickerClick"
HorizontalAlignment="Center"
/> />
</StackPanel> </StackPanel>
<StackPanel Grid.Row="2" Grid.Column="1"> </StackPanel>
<!-- <StackPanel Grid.Row="2" Grid.Column="1">
<Image Source="/Assets/Sprites/toml-paper.png" Stretch="Uniform" /> <Image Source="/Assets/Sprites/toml-paper.png" Stretch="Uniform" />
</StackPanel> </StackPanel> -->
</Grid> </StackPanel>
</Window> </Window>

View File

@ -15,6 +15,7 @@ public partial class SettingsWindow : Window
InitializeComponent(); InitializeComponent();
_mainWindowVM = mainWindowVM; _mainWindowVM = mainWindowVM;
tweaksVersion.Text = $"Current tweaks version: {_mainWindowVM.TweaksVersion}"; tweaksVersion.Text = $"Current tweaks version: {_mainWindowVM.TweaksVersion}";
currentDir.Text = $"Current saving directory: {_mainWindowVM.RuntimeLocation}";
} }
private async void OnFilePickerClick(object sender, RoutedEventArgs args) private async void OnFilePickerClick(object sender, RoutedEventArgs args)
@ -36,6 +37,7 @@ public partial class SettingsWindow : Window
if (location is null) throw new NullReferenceException("Invalid location selected!"); if (location is null) throw new NullReferenceException("Invalid location selected!");
_mainWindowVM.RuntimeLocation = location; _mainWindowVM.RuntimeLocation = location;
System.Console.WriteLine($"Selected {_mainWindowVM.RuntimeLocation}."); System.Console.WriteLine($"Selected {_mainWindowVM.RuntimeLocation}.");
currentDir.Text = $"Current saving directory: {_mainWindowVM.RuntimeLocation}";
ConfigManager.WriteInConfig("runtime-path", location); ConfigManager.WriteInConfig("runtime-path", location);
} }
} }