Simplifying the process of disabling gameType

This commit is contained in:
Khamûl 2020-05-10 13:18:55 -04:00
parent 99113507c4
commit 5e5c1bb384
2 changed files with 1 additions and 22 deletions

View File

@ -30,8 +30,6 @@ namespace Wabbajack
private const string ALL_GAME_TYPE = "All";
public ICommand OnlyInstalledCheckedCommand { get; }
[Reactive]
public IErrorResponse Error { get; set; }
@ -46,9 +44,6 @@ namespace Wabbajack
[Reactive]
public string GameType { get; set; }
[Reactive]
public bool GameTypeEnabled { get; set; }
public List<string> GameTypeEntries { get { return GetGameTypeEntries(); } }
@ -61,7 +56,6 @@ namespace Wabbajack
: base(mainWindowVM)
{
MWVM = mainWindowVM;
GameTypeEnabled = true;
// load persistent filter settings
settings = MWVM.Settings.Filters;
@ -70,8 +64,6 @@ namespace Wabbajack
GameType = !string.IsNullOrEmpty(settings.Game) ? settings.Game : ALL_GAME_TYPE;
ShowNSFW = settings.ShowNSFW;
OnlyInstalled = settings.OnlyInstalled;
if (OnlyInstalled)
GameTypeEnabled = false;
Search = settings.Search;
// subscribe to save signal
MWVM.Settings.SaveSignal
@ -88,7 +80,6 @@ namespace Wabbajack
ShowNSFW = false;
Search = string.Empty;
GameType = ALL_GAME_TYPE;
GameTypeEnabled = true;
});
var random = new Random();
@ -124,17 +115,6 @@ namespace Wabbajack
.Select(c => c > 0)
.ToProperty(this, nameof(Loaded));
OnlyInstalledCheckedCommand = ReactiveCommand.Create(() =>
{
if (OnlyInstalled)
{
GameType = ALL_GAME_TYPE;
GameTypeEnabled = false;
}
else
GameTypeEnabled = true;
});
// Convert to VM and bind to resulting list
sourceList
.ObserveOnGuiThread()

View File

@ -108,7 +108,7 @@
ItemsSource="{Binding Path=GameTypeEntries}"
SelectedItem="{Binding GameType, Mode=TwoWay}"
ToolTip="Select a game"
IsEnabled="{Binding GameTypeEnabled}"
IsEnabled="{Binding OnlyInstalled, Converter={StaticResource InverseBooleanConverter}}"
Width="130" />
<TextBlock
Margin="0,0,5,0"
@ -130,7 +130,6 @@
Margin="10,0,10,0"
VerticalAlignment="Center"
Content="Only Installed"
Command="{Binding OnlyInstalledCheckedCommand}"
Foreground="{StaticResource ForegroundBrush}" />
<Button
x:Name="ClearFiltersButton"