2019-11-17 05:31:54 +00:00
|
|
|
|
using ReactiveUI;
|
2019-11-09 01:53:32 +00:00
|
|
|
|
using System.Linq;
|
2019-11-17 05:31:54 +00:00
|
|
|
|
using System.Reactive.Linq;
|
2019-11-09 01:53:32 +00:00
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for DetailImageView.xaml
|
|
|
|
|
/// </summary>
|
2019-11-17 05:31:54 +00:00
|
|
|
|
public partial class DetailImageView : UserControlRx
|
2019-11-09 01:53:32 +00:00
|
|
|
|
{
|
|
|
|
|
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),
|
2019-11-17 05:31:54 +00:00
|
|
|
|
new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, WireNotifyPropertyChanged));
|
2019-11-09 01:53:32 +00:00
|
|
|
|
|
|
|
|
|
public string Author
|
|
|
|
|
{
|
|
|
|
|
get => (string)GetValue(AuthorProperty);
|
|
|
|
|
set => SetValue(AuthorProperty, value);
|
|
|
|
|
}
|
|
|
|
|
public static readonly DependencyProperty AuthorProperty = DependencyProperty.Register(nameof(Author), typeof(string), typeof(DetailImageView),
|
2019-11-17 05:31:54 +00:00
|
|
|
|
new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, WireNotifyPropertyChanged));
|
2019-11-09 01:53:32 +00:00
|
|
|
|
|
|
|
|
|
public string Description
|
|
|
|
|
{
|
|
|
|
|
get => (string)GetValue(DescriptionProperty);
|
|
|
|
|
set => SetValue(DescriptionProperty, value);
|
|
|
|
|
}
|
|
|
|
|
public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register(nameof(Description), typeof(string), typeof(DetailImageView),
|
2019-11-17 05:31:54 +00:00
|
|
|
|
new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, WireNotifyPropertyChanged));
|
|
|
|
|
|
2019-11-21 15:45:00 +00:00
|
|
|
|
private readonly ObservableAsPropertyHelper<bool> _showAuthor;
|
|
|
|
|
public bool ShowAuthor => _showAuthor.Value;
|
2019-11-17 05:31:54 +00:00
|
|
|
|
|
2019-11-21 15:45:00 +00:00
|
|
|
|
private readonly ObservableAsPropertyHelper<bool> _showDescription;
|
|
|
|
|
public bool ShowDescription => _showDescription.Value;
|
2019-11-17 05:31:54 +00:00
|
|
|
|
|
2019-11-21 15:45:00 +00:00
|
|
|
|
private readonly ObservableAsPropertyHelper<bool> _showTitle;
|
|
|
|
|
public bool ShowTitle => _showTitle.Value;
|
2019-11-09 01:53:32 +00:00
|
|
|
|
|
|
|
|
|
public DetailImageView()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2019-11-17 05:31:54 +00:00
|
|
|
|
|
2019-11-21 15:45:00 +00:00
|
|
|
|
_showAuthor = this.WhenAny(x => x.Author)
|
2019-11-17 05:31:54 +00:00
|
|
|
|
.Select(x => !string.IsNullOrWhiteSpace(x))
|
2019-11-21 15:04:33 +00:00
|
|
|
|
.ToProperty(this, nameof(ShowAuthor));
|
2019-11-17 05:31:54 +00:00
|
|
|
|
|
2019-11-21 15:45:00 +00:00
|
|
|
|
_showDescription = this.WhenAny(x => x.Description)
|
2019-11-17 05:31:54 +00:00
|
|
|
|
.Select(x => !string.IsNullOrWhiteSpace(x))
|
2019-11-21 15:04:33 +00:00
|
|
|
|
.ToProperty(this, nameof(ShowDescription));
|
2019-11-17 05:31:54 +00:00
|
|
|
|
|
2019-11-21 15:45:00 +00:00
|
|
|
|
_showTitle = this.WhenAny(x => x.Title)
|
2019-11-17 05:31:54 +00:00
|
|
|
|
.Select(x => !string.IsNullOrWhiteSpace(x))
|
2019-11-21 15:04:33 +00:00
|
|
|
|
.ToProperty(this, nameof(ShowTitle));
|
2019-11-09 01:53:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|