Add button to reset chosen install location

This commit is contained in:
pizzaboxer 2023-07-15 11:01:14 +01:00
parent d8842cc0cc
commit 41ca47ad0b
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
2 changed files with 11 additions and 1 deletions

View File

@ -23,9 +23,11 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Margin="0,0,4,0" Text="{Binding InstallLocation, Mode=TwoWay}" />
<ui:Button Grid.Column="1" Margin="4,0,0,0" Height="35" Icon="Folder24" Content="Browse" Command="{Binding BrowseInstallLocationCommand}" />
<ui:Button Grid.Column="1" Margin="4,0,4,0" Height="35" Icon="Folder24" Content="Browse" Command="{Binding BrowseInstallLocationCommand}" />
<ui:Button Grid.Column="2" Margin="4,0,0,0" Height="35" Icon="ArrowUndo24" Content="Reset" Command="{Binding ResetInstallLocationCommand}" />
</Grid>
</ui:CardExpander>

View File

@ -11,7 +11,10 @@ namespace Bloxstrap.UI.ViewModels.Menu
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
private string _originalInstallLocation = App.BaseDirectory;
public ICommand BrowseInstallLocationCommand => new RelayCommand(BrowseInstallLocation);
public ICommand ResetInstallLocationCommand => new RelayCommand(ResetInstallLocation);
public ICommand OpenFolderCommand => new RelayCommand(OpenFolder);
private void BrowseInstallLocation()
@ -22,7 +25,12 @@ namespace Bloxstrap.UI.ViewModels.Menu
return;
InstallLocation = dialog.SelectedPath;
OnPropertyChanged(nameof(InstallLocation));
}
private void ResetInstallLocation()
{
InstallLocation = _originalInstallLocation;
OnPropertyChanged(nameof(InstallLocation));
}