wabbajack/Wabbajack/Views/ModListTileView.xaml.cs

69 lines
2.9 KiB
C#
Raw Normal View History

2020-01-14 04:12:24 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ReactiveUI;
using Wabbajack.Common;
2020-01-14 04:12:24 +00:00
namespace Wabbajack
{
/// <summary>
/// Interaction logic for ModListTileView.xaml
/// </summary>
public partial class ModListTileView : ReactiveUserControl<ModListMetadataVM>
{
public ModListTileView()
{
InitializeComponent();
this.WhenActivated(dispose =>
{
this.MarkAsNeeded<ModListTileView, ModListMetadataVM, bool>(this.ViewModel, x => x.IsBroken);
this.MarkAsNeeded<ModListTileView, ModListMetadataVM, bool>(this.ViewModel, x => x.Exists);
this.MarkAsNeeded<ModListTileView, ModListMetadataVM, string>(this.ViewModel, x => x.Metadata.Links.ImageUri);
2020-02-29 00:00:23 +00:00
this.WhenAny(x => x.ViewModel.ProgressPercent)
.Select(p => p.Value)
.BindToStrict(this, x => x.DownloadProgressBar.Value)
.DisposeWith(dispose);
2020-01-14 04:12:24 +00:00
this.WhenAny(x => x.ViewModel.Metadata.Title)
.BindToStrict(this, x => x.DescriptionTextShadow.Text)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.Metadata.Title)
.BindToStrict(this, x => x.ModListTitleShadow.Text)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.IsBroken)
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, x => x.Overlay.Visibility)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.Metadata.Description)
.BindToStrict(this, x => x.MetadataDescription.Text)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.OpenWebsiteCommand)
.BindToStrict(this, x => x.OpenWebsiteButton.Command)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.ExecuteCommand)
.BindToStrict(this, x => x.ExecuteButton.Command)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.Image)
.BindToStrict(this, x => x.ModListImage.Source)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.LoadingImage)
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, x => x.LoadingProgress.Visibility)
.DisposeWith(dispose);
2020-01-14 04:12:24 +00:00
});
}
}
}