Skip to content

Commit

Permalink
Add button to reset chosen install location
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Jul 15, 2023
1 parent d8842cc commit 41ca47a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
8 changes: 8 additions & 0 deletions Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -22,7 +25,12 @@ private void BrowseInstallLocation()
return;

InstallLocation = dialog.SelectedPath;
OnPropertyChanged(nameof(InstallLocation));
}

private void ResetInstallLocation()
{
InstallLocation = _originalInstallLocation;
OnPropertyChanged(nameof(InstallLocation));
}

Expand Down

0 comments on commit 41ca47a

Please sign in to comment.