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

68 lines
2.3 KiB
C#
Raw Normal View History

2019-12-08 22:30:49 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
2019-12-08 22:30:49 +00:00
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
2019-12-08 22:30:49 +00:00
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 ReactiveUI.Fody.Helpers;
using Wabbajack.Lib;
using System.Windows.Controls.Primitives;
using System.Reactive.Linq;
2020-02-08 04:35:08 +00:00
using Wabbajack.Common;
2019-11-07 05:33:08 +00:00
namespace Wabbajack
{
/// <summary>
2019-12-08 22:30:49 +00:00
/// Interaction logic for CpuView.xaml
2019-11-07 05:33:08 +00:00
/// </summary>
public partial class CpuView : UserControlRx<ICpuStatusVM>
2019-11-07 05:33:08 +00:00
{
2020-02-08 04:35:08 +00:00
public Percent ProgressPercent
{
2020-02-08 04:35:08 +00:00
get => (Percent)GetValue(ProgressPercentProperty);
set => SetValue(ProgressPercentProperty, value);
}
2020-02-08 04:35:08 +00:00
public static readonly DependencyProperty ProgressPercentProperty = DependencyProperty.Register(nameof(ProgressPercent), typeof(Percent), typeof(CpuView),
new FrameworkPropertyMetadata(default(Percent), WireNotifyPropertyChanged));
public MainSettings SettingsHook
{
get => (MainSettings)GetValue(SettingsHookProperty);
set => SetValue(SettingsHookProperty, value);
}
public static readonly DependencyProperty SettingsHookProperty = DependencyProperty.Register(nameof(SettingsHook), typeof(MainSettings), typeof(CpuView),
2020-01-20 21:59:26 +00:00
new FrameworkPropertyMetadata(default(SettingsVM), WireNotifyPropertyChanged));
private bool _ShowingSettings;
public bool ShowingSettings { get => _ShowingSettings; set => this.RaiseAndSetIfChanged(ref _ShowingSettings, value); }
2019-12-08 22:30:49 +00:00
public CpuView()
2019-11-07 05:33:08 +00:00
{
InitializeComponent();
this.WhenActivated(disposable =>
{
2020-09-12 20:23:03 +00:00
2020-02-08 04:35:08 +00:00
this.WhenAny(x => x.ViewModel.StatusList)
.BindToStrict(this, x => x.CpuListControl.ItemsSource)
.DisposeWith(disposable);
2020-02-08 04:35:08 +00:00
// Progress
this.WhenAny(x => x.ProgressPercent)
.Select(p => p.Value)
.BindToStrict(this, x => x.HeatedBorderRect.Opacity)
.DisposeWith(disposable);
});
2019-11-07 05:33:08 +00:00
}
}
}