2022-03-13 22:47:30 +00:00
|
|
|
|
using System.Reactive.Disposables;
|
|
|
|
|
using System.Reactive.Linq;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using ReactiveUI;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
|
{
|
|
|
|
|
public partial class ModListGalleryView : ReactiveUserControl<ModListGalleryVM>
|
|
|
|
|
{
|
|
|
|
|
public ModListGalleryView()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
this.WhenActivated(dispose =>
|
|
|
|
|
{
|
|
|
|
|
this.WhenAny(x => x.ViewModel.BackCommand)
|
|
|
|
|
.BindToStrict(this, x => x.BackButton.Command)
|
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
|
this.WhenAny(x => x.ViewModel.ModLists)
|
|
|
|
|
.BindToStrict(this, x => x.ModListGalleryControl.ItemsSource)
|
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
|
|
|
|
|
|
this.WhenAny(x => x.ViewModel.LoadingLock.IsLoading)
|
|
|
|
|
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
|
|
|
|
|
.StartWith(Visibility.Collapsed)
|
|
|
|
|
.BindTo(this, x => x.LoadingRing.Visibility)
|
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
|
|
|
|
|
|
this.WhenAny(x => x.ViewModel.LoadingLock.ErrorState)
|
|
|
|
|
.Select(e => (e?.Succeeded ?? true) ? Visibility.Collapsed : Visibility.Visible)
|
|
|
|
|
.StartWith(Visibility.Collapsed)
|
|
|
|
|
.BindToStrict(this, x => x.ErrorIcon.Visibility)
|
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
|
|
|
|
|
|
this.WhenAny(x => x.ViewModel.ModLists.Count)
|
|
|
|
|
.CombineLatest(this.WhenAnyValue(x => x.ViewModel.LoadingLock.IsLoading))
|
|
|
|
|
.Select(x => x.First == 0 && !x.Second)
|
|
|
|
|
.DistinctUntilChanged()
|
|
|
|
|
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
|
|
|
|
|
.StartWith(Visibility.Collapsed)
|
|
|
|
|
.BindToStrict(this, x => x.NoneFound.Visibility)
|
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.BindStrict(ViewModel, vm => vm.Search, x => x.SearchBox.Text)
|
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
|
|
|
|
|
|
this.BindStrict(ViewModel, vm => vm.OnlyInstalled, x => x.OnlyInstalledCheckbox.IsChecked)
|
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
|
this.BindStrict(ViewModel, vm => vm.ShowNSFW, x => x.ShowNSFW.IsChecked)
|
|
|
|
|
.DisposeWith(dispose);
|
2022-05-15 20:17:36 +00:00
|
|
|
|
this.BindStrict(ViewModel, vm => vm.ShowUnofficialLists, x => x.ShowUnofficialLists.IsChecked)
|
2022-03-13 22:47:30 +00:00
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
|
|
|
|
|
|
this.WhenAny(x => x.ViewModel.ClearFiltersCommand)
|
|
|
|
|
.BindToStrict(this, x => x.ClearFiltersButton.Command)
|
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|