From c18533e3117511fc70573758dac89a91b852ddb1 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 8 Nov 2019 19:53:32 -0600 Subject: [PATCH] DetailImageView --- Wabbajack/View Models/InstallerVM.cs | 6 +- Wabbajack/Views/DetailImageView.xaml | 196 ++++++++++ Wabbajack/Views/DetailImageView.xaml.cs | 68 ++++ Wabbajack/Views/InstallationView.xaml | 451 ++++++++---------------- Wabbajack/Wabbajack.csproj | 7 + 5 files changed, 413 insertions(+), 315 deletions(-) create mode 100644 Wabbajack/Views/DetailImageView.xaml create mode 100644 Wabbajack/Views/DetailImageView.xaml.cs diff --git a/Wabbajack/View Models/InstallerVM.cs b/Wabbajack/View Models/InstallerVM.cs index 2398d48b..2dd58746 100644 --- a/Wabbajack/View Models/InstallerVM.cs +++ b/Wabbajack/View Models/InstallerVM.cs @@ -14,6 +14,7 @@ using System.Windows.Media.Imaging; using Wabbajack.Common; using Wabbajack.Lib; using ReactiveUI.Fody.Helpers; +using System.Windows.Media; namespace Wabbajack { @@ -64,8 +65,8 @@ namespace Wabbajack private readonly ObservableAsPropertyHelper _ProgressPercent; public float ProgressPercent => _ProgressPercent.Value; - private readonly ObservableAsPropertyHelper _Image; - public BitmapImage Image => _Image.Value; + private readonly ObservableAsPropertyHelper _Image; + public ImageSource Image => _Image.Value; private readonly ObservableAsPropertyHelper _TitleText; public string TitleText => _TitleText.Value; @@ -169,6 +170,7 @@ namespace Wabbajack .StartWith(default(BitmapImage)), this.WhenAny(x => x.Installing), resultSelector: (modList, slideshow, installing) => installing ? slideshow : modList) + .Select(x => x) .ToProperty(this, nameof(this.Image)); this._TitleText = Observable.CombineLatest( this.WhenAny(x => x.ModList.Name), diff --git a/Wabbajack/Views/DetailImageView.xaml b/Wabbajack/Views/DetailImageView.xaml new file mode 100644 index 00000000..ca9f592a --- /dev/null +++ b/Wabbajack/Views/DetailImageView.xaml @@ -0,0 +1,196 @@ + + + #92000000 + + #DF000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Wabbajack/Views/DetailImageView.xaml.cs b/Wabbajack/Views/DetailImageView.xaml.cs new file mode 100644 index 00000000..e1094ede --- /dev/null +++ b/Wabbajack/Views/DetailImageView.xaml.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.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; + +namespace Wabbajack +{ + /// + /// Interaction logic for DetailImageView.xaml + /// + public partial class DetailImageView : UserControl + { + public ImageSource Image + { + get => (ImageSource)GetValue(ImageProperty); + set => SetValue(ImageProperty, value); + } + public static readonly DependencyProperty ImageProperty = DependencyProperty.Register(nameof(Image), typeof(ImageSource), typeof(DetailImageView), + new FrameworkPropertyMetadata(default(ImageSource))); + + public ImageSource Badge + { + get => (ImageSource)GetValue(BadgeProperty); + set => SetValue(BadgeProperty, value); + } + public static readonly DependencyProperty BadgeProperty = DependencyProperty.Register(nameof(Badge), typeof(ImageSource), typeof(DetailImageView), + new FrameworkPropertyMetadata(default(ImageSource))); + + public string Title + { + get => (string)GetValue(TitleProperty); + set => SetValue(TitleProperty, value); + } + public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(nameof(Title), typeof(string), typeof(DetailImageView), + new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + + public string Author + { + get => (string)GetValue(AuthorProperty); + set => SetValue(AuthorProperty, value); + } + public static readonly DependencyProperty AuthorProperty = DependencyProperty.Register(nameof(Author), typeof(string), typeof(DetailImageView), + new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + + public string Description + { + get => (string)GetValue(DescriptionProperty); + set => SetValue(DescriptionProperty, value); + } + public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register(nameof(Description), typeof(string), typeof(DetailImageView), + new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + + public DetailImageView() + { + InitializeComponent(); + } + } +} diff --git a/Wabbajack/Views/InstallationView.xaml b/Wabbajack/Views/InstallationView.xaml index a975b6d3..b33fabd6 100644 --- a/Wabbajack/Views/InstallationView.xaml +++ b/Wabbajack/Views/InstallationView.xaml @@ -7,45 +7,11 @@ xmlns:local="clr-namespace:Wabbajack" xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + d:DataContext="{d:DesignInstance local:InstallerVM}" d:DesignHeight="500" d:DesignWidth="800" mc:Ignorable="d"> - #92000000 - - #DF000000 - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + Background="{StaticResource BackgroundBrush}" + IsChecked="{Binding Slideshow.ShowNSFW}" + ToolTip="Show NSFW mods"> + + + + + + + + - + @@ -564,12 +387,14 @@ + Fill="{StaticResource DarkBackgroundBrush}" + SnapsToDevicePixels="True" /> Designer + + DetailImageView.xaml + TopProgressView.xaml @@ -201,6 +204,10 @@ TextViewer.xaml + + Designer + MSBuild:Compile + Designer MSBuild:Compile