2020-02-08 04:35:08 +00:00
|
|
|
using System.Reactive.Linq;
|
2019-11-29 05:52:23 +00:00
|
|
|
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;
|
2020-01-17 00:28:52 +00:00
|
|
|
using System;
|
|
|
|
using ReactiveUI.Fody.Helpers;
|
|
|
|
using Wabbajack.Lib;
|
|
|
|
using System.Reactive.Disposables;
|
2019-11-07 05:33:08 +00:00
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Interaction logic for TopProgressView.xaml
|
|
|
|
/// </summary>
|
2020-01-17 00:28:52 +00:00
|
|
|
public partial class TopProgressView : UserControlRx<ViewModel>
|
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),
|
2020-02-08 04:35:08 +00:00
|
|
|
new FrameworkPropertyMetadata(default(string), WireNotifyPropertyChanged));
|
2019-11-09 04:21:33 +00:00
|
|
|
|
|
|
|
public string StatePrefixTitle
|
|
|
|
{
|
|
|
|
get => (string)GetValue(StatePrefixTitleProperty);
|
|
|
|
set => SetValue(StatePrefixTitleProperty, value);
|
|
|
|
}
|
|
|
|
public static readonly DependencyProperty StatePrefixTitleProperty = DependencyProperty.Register(nameof(StatePrefixTitle), typeof(string), typeof(TopProgressView),
|
2020-02-08 04:35:08 +00:00
|
|
|
new FrameworkPropertyMetadata(default(string), WireNotifyPropertyChanged));
|
2019-11-09 04:21:33 +00:00
|
|
|
|
|
|
|
public bool OverhangShadow
|
|
|
|
{
|
|
|
|
get => (bool)GetValue(OverhangShadowProperty);
|
|
|
|
set => SetValue(OverhangShadowProperty, value);
|
|
|
|
}
|
|
|
|
public static readonly DependencyProperty OverhangShadowProperty = DependencyProperty.Register(nameof(OverhangShadow), typeof(bool), typeof(TopProgressView),
|
2020-02-08 04:35:08 +00:00
|
|
|
new FrameworkPropertyMetadata(true, WireNotifyPropertyChanged));
|
2019-11-09 04:21:33 +00:00
|
|
|
|
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),
|
2020-02-08 04:35:08 +00:00
|
|
|
new FrameworkPropertyMetadata(true, WireNotifyPropertyChanged));
|
2019-11-29 05:52:23 +00:00
|
|
|
|
2019-11-07 05:33:08 +00:00
|
|
|
public TopProgressView()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
2020-01-17 00:28:52 +00:00
|
|
|
this.WhenActivated(dispose =>
|
|
|
|
{
|
|
|
|
this.WhenAny(x => x.ProgressPercent)
|
2020-02-08 04:35:08 +00:00
|
|
|
.Select(x => 0.3 + x * 0.7)
|
|
|
|
.BindToStrict(this, x => x.LargeProgressBar.Opacity)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
this.WhenAny(x => x.ProgressPercent)
|
|
|
|
.BindToStrict(this, x => x.LargeProgressBar.Value)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
this.WhenAny(x => x.ProgressPercent)
|
|
|
|
.BindToStrict(this, x => x.BottomProgressBarDarkGlow.Value)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
this.WhenAny(x => x.ProgressPercent)
|
|
|
|
.BindToStrict(this, x => x.LargeProgressBarTopGlow.Value)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
this.WhenAny(x => x.ProgressPercent)
|
|
|
|
.BindToStrict(this, x => x.BottomProgressBarBrightGlow1.Value)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
this.WhenAny(x => x.ProgressPercent)
|
|
|
|
.BindToStrict(this, x => x.BottomProgressBarBrightGlow2.Value)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
this.WhenAny(x => x.ProgressPercent)
|
|
|
|
.BindToStrict(this, x => x.BottomProgressBar.Value)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
this.WhenAny(x => x.ProgressPercent)
|
|
|
|
.BindToStrict(this, x => x.BottomProgressBarHighlight.Value)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
|
|
|
|
this.WhenAny(x => x.OverhangShadow)
|
|
|
|
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
|
|
|
|
.BindToStrict(this, x => x.OverhangShadowRect.Visibility)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
this.WhenAny(x => x.ShadowMargin)
|
|
|
|
.DistinctUntilChanged()
|
|
|
|
.Select(x => x ? new Thickness(6, 0, 6, 0) : new Thickness(0))
|
|
|
|
.BindToStrict(this, x => x.OverhangShadowRect.Margin)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
this.WhenAny(x => x.Title)
|
|
|
|
.BindToStrict(this, x => x.TitleText.Text)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
this.WhenAny(x => x.StatePrefixTitle)
|
|
|
|
.Select(x => x == null ? Visibility.Visible : Visibility.Collapsed)
|
|
|
|
.BindToStrict(this, x => x.PrefixSpacerRect.Visibility)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
this.WhenAny(x => x.StatePrefixTitle)
|
|
|
|
.Select(x => x == null ? Visibility.Collapsed : Visibility.Visible)
|
|
|
|
.BindToStrict(this, x => x.StatePrefixText.Visibility)
|
|
|
|
.DisposeWith(dispose);
|
|
|
|
this.WhenAny(x => x.StatePrefixTitle)
|
|
|
|
.BindToStrict(this, x => x.StatePrefixText.Text)
|
2020-01-17 00:28:52 +00:00
|
|
|
.DisposeWith(dispose);
|
|
|
|
});
|
2019-11-07 05:33:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|