From 41ca47ad0b3f587bbceda5ae56f34429c7b2a013 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sat, 15 Jul 2023 11:01:14 +0100 Subject: [PATCH] Add button to reset chosen install location --- Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml | 4 +++- Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml b/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml index b478e7b5..72764105 100644 --- a/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml +++ b/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml @@ -23,9 +23,11 @@ + - + + diff --git a/Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs index 5a659f73..6ad864b0 100644 --- a/Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs @@ -11,7 +11,10 @@ public class InstallationViewModel : INotifyPropertyChanged 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 @@ private void BrowseInstallLocation() return; InstallLocation = dialog.SelectedPath; + OnPropertyChanged(nameof(InstallLocation)); + } + private void ResetInstallLocation() + { + InstallLocation = _originalInstallLocation; OnPropertyChanged(nameof(InstallLocation)); }