Skip to content

Commit

Permalink
Detection if we can modify or not the settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
SteezCram committed Jun 23, 2021
1 parent 96da73a commit 5bc5b1c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
40 changes: 39 additions & 1 deletion src/PboViewer GUI/ViewModels/SettingsWindowViewModel.cs
Expand Up @@ -57,7 +57,33 @@ public bool IntegrationChecked
}
}


public bool CanModify
{
get => _canModify;
set
{
if (value != _canModify)
{
_canModify = value;
OnPropertyChanged();
}
}
}

public bool CannotModify
{
get => _cannotModify;
set
{
if (value != _cannotModify)
{
_canModify = value;
OnPropertyChanged();
}
}
}


public ICommand CheckKeyboardNavigation { get; set; }
public ICommand CheckPacked { get; set; }
public ICommand CheckIntegration { get; set; }
Expand All @@ -66,10 +92,22 @@ public bool IntegrationChecked
private bool _keyboardNavigationChecked;
private bool _packedChecked;
private bool _integrationChecked;
private bool _canModify;
private bool _cannotModify;


public SettingsWindowViewModel()
{
try {
Settings.SaveSettings();
CanModify = true;
CannotModify = false;
}
catch {
CanModify = false;
CannotModify = true;
}

KeyboardNavigationChecked = Settings.PboViewerSettings.KeyboardNavigation;
PackedChecked = Settings.PboViewerSettings.OpenPackedPboInFileExplorer;
IntegrationChecked = Settings.PboViewerSettings.OSIntegration;
Expand Down
6 changes: 5 additions & 1 deletion src/PboViewer GUI/Windows/SettingsWindow.xaml
Expand Up @@ -23,14 +23,18 @@
<TextBlock Name="Title" Margin="7" Text="PBO Viewer" FontSize="14" FontWeight="Light"/>
</ExperimentalAcrylicBorder>

<StackPanel Margin="10,40,10,10">
<StackPanel Margin="10,40,10,10" IsVisible="{Binding CanModify}">
<TextBlock Text="Behavior settings:" FontSize="18" Margin="0,0,0,10"/>
<CheckBox Content="Keyboard navigation (experimental)" IsChecked="{Binding KeyboardNavigationChecked}" Command="{Binding CheckKeyboardNavigation}" Margin="0,0,0,30"/>

<TextBlock Text="Operating system settings:" FontSize="18" Margin="0,0,0,10"/>
<CheckBox Content="Open packed PBO in file explorer" IsChecked="{Binding PackedChecked}" Command="{Binding CheckPacked}"/>
<CheckBox Content="Operating system integration" IsVisible="{Binding HasSystemIntegration}" IsChecked="{Binding IntegrationChecked}" Command="{Binding CheckIntegration}"/>
</StackPanel>

<StackPanel Margin="10,40,10,10" IsVisible="{Binding CannotModify}">
<TextBlock Text="Please launch PBO Viewer with the administrator right to modify the settings."/>
</StackPanel>
</Grid>

</FluentWindow>

0 comments on commit 5bc5b1c

Please sign in to comment.