Subcribe to settings SaveSignal

This commit is contained in:
Khamûl 2020-05-10 13:12:43 -04:00
parent 75a14bfaf2
commit 99113507c4

View File

@ -73,6 +73,10 @@ namespace Wabbajack
if (OnlyInstalled) if (OnlyInstalled)
GameTypeEnabled = false; GameTypeEnabled = false;
Search = settings.Search; Search = settings.Search;
// subscribe to save signal
MWVM.Settings.SaveSignal
.Subscribe(_ => UpdateFiltersSettings())
.DisposeWith(this.CompositeDisposable);
} }
else else
GameType = ALL_GAME_TYPE; GameType = ALL_GAME_TYPE;
@ -85,7 +89,6 @@ namespace Wabbajack
Search = string.Empty; Search = string.Empty;
GameType = ALL_GAME_TYPE; GameType = ALL_GAME_TYPE;
GameTypeEnabled = true; GameTypeEnabled = true;
UpdateFiltersSettings();
}); });
var random = new Random(); var random = new Random();
@ -141,7 +144,6 @@ namespace Wabbajack
.Filter(this.WhenAny(x => x.OnlyInstalled) .Filter(this.WhenAny(x => x.OnlyInstalled)
.Select<bool, Func<ModListMetadataVM, bool>>(onlyInstalled => (vm) => .Select<bool, Func<ModListMetadataVM, bool>>(onlyInstalled => (vm) =>
{ {
UpdateFiltersSettings();
if (!onlyInstalled) return true; if (!onlyInstalled) return true;
if (!GameRegistry.Games.TryGetValue(vm.Metadata.Game, out var gameMeta)) return false; if (!GameRegistry.Games.TryGetValue(vm.Metadata.Game, out var gameMeta)) return false;
return gameMeta.IsInstalled; return gameMeta.IsInstalled;
@ -152,13 +154,11 @@ namespace Wabbajack
.Select<string, Func<ModListMetadataVM, bool>>(search => (vm) => .Select<string, Func<ModListMetadataVM, bool>>(search => (vm) =>
{ {
if (string.IsNullOrWhiteSpace(search)) return true; if (string.IsNullOrWhiteSpace(search)) return true;
UpdateFiltersSettings();
return vm.Metadata.Title.ContainsCaseInsensitive(search); return vm.Metadata.Title.ContainsCaseInsensitive(search);
})) }))
.Filter(this.WhenAny(x => x.ShowNSFW) .Filter(this.WhenAny(x => x.ShowNSFW)
.Select<bool, Func<ModListMetadataVM, bool>>(showNSFW => vm => .Select<bool, Func<ModListMetadataVM, bool>>(showNSFW => vm =>
{ {
UpdateFiltersSettings();
if (!vm.Metadata.NSFW) return true; if (!vm.Metadata.NSFW) return true;
return vm.Metadata.NSFW && showNSFW; return vm.Metadata.NSFW && showNSFW;
})) }))
@ -172,14 +172,12 @@ namespace Wabbajack
if (string.IsNullOrEmpty(GameType)) if (string.IsNullOrEmpty(GameType))
return false; return false;
UpdateFiltersSettings();
return GameType == vm.Metadata.Game.GetDescription<Game>().ToString(); return GameType == vm.Metadata.Game.GetDescription<Game>().ToString();
})) }))
.Filter(this.WhenAny(x => x.ShowNSFW) .Filter(this.WhenAny(x => x.ShowNSFW)
.Select<bool, Func<ModListMetadataVM, bool>>(showNSFW => vm => .Select<bool, Func<ModListMetadataVM, bool>>(showNSFW => vm =>
{ {
UpdateFiltersSettings();
if (!vm.Metadata.NSFW) return true; if (!vm.Metadata.NSFW) return true;
return vm.Metadata.NSFW && showNSFW; return vm.Metadata.NSFW && showNSFW;
})) }))