wabbajack/Wabbajack/Views/Common/TopProgressView.xaml.cs

68 lines
2.7 KiB
C#
Raw Normal View History

2019-11-29 05:52:23 +00:00
using System.Reactive.Linq;
using System.Windows;
2019-11-07 05:33:08 +00:00
using System.Windows.Controls;
2019-11-29 05:52:23 +00:00
using ReactiveUI;
2019-11-07 05:33:08 +00:00
namespace Wabbajack
{
/// <summary>
/// Interaction logic for TopProgressView.xaml
/// </summary>
2019-11-29 05:52:23 +00:00
public partial class TopProgressView : UserControlRx
2019-11-07 05:33:08 +00:00
{
2019-11-09 04:21:33 +00:00
public double ProgressPercent
{
get => (double)GetValue(ProgressPercentProperty);
set => SetValue(ProgressPercentProperty, value);
}
public static readonly DependencyProperty ProgressPercentProperty = DependencyProperty.Register(nameof(ProgressPercent), typeof(double), typeof(TopProgressView),
2019-11-29 05:52:23 +00:00
new FrameworkPropertyMetadata(default(double), WireNotifyPropertyChanged));
2019-11-09 04:21:33 +00:00
public string Title
{
get => (string)GetValue(TitleProperty);
set => SetValue(TitleProperty, value);
}
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(nameof(Title), typeof(string), typeof(TopProgressView),
new FrameworkPropertyMetadata(default(string)));
public string StatePrefixTitle
{
get => (string)GetValue(StatePrefixTitleProperty);
set => SetValue(StatePrefixTitleProperty, value);
}
public static readonly DependencyProperty StatePrefixTitleProperty = DependencyProperty.Register(nameof(StatePrefixTitle), typeof(string), typeof(TopProgressView),
new FrameworkPropertyMetadata(default(string)));
public bool OverhangShadow
{
get => (bool)GetValue(OverhangShadowProperty);
set => SetValue(OverhangShadowProperty, value);
}
public static readonly DependencyProperty OverhangShadowProperty = DependencyProperty.Register(nameof(OverhangShadow), typeof(bool), typeof(TopProgressView),
new FrameworkPropertyMetadata(true));
2019-11-30 09:08:04 +00:00
public bool ShadowMargin
{
get => (bool)GetValue(ShadowMarginProperty);
set => SetValue(ShadowMarginProperty, value);
}
public static readonly DependencyProperty ShadowMarginProperty = DependencyProperty.Register(nameof(ShadowMargin), typeof(bool), typeof(TopProgressView),
new FrameworkPropertyMetadata(true));
2019-11-29 05:52:23 +00:00
private readonly ObservableAsPropertyHelper<double> _ProgressOpacityPercent;
public double ProgressOpacityPercent => _ProgressOpacityPercent.Value;
2019-11-07 05:33:08 +00:00
public TopProgressView()
{
InitializeComponent();
2019-11-29 05:52:23 +00:00
_ProgressOpacityPercent = this.WhenAny(x => x.ProgressPercent)
.Select(x =>
{
return 0.3 + x * 0.7;
})
.ToProperty(this, nameof(ProgressOpacityPercent));
2019-11-07 05:33:08 +00:00
}
}
}