using System.Windows; using UserControl = System.Windows.Controls.UserControl; namespace OperationControl.Controls { /// /// Interaction logic for RiskMeter.xaml /// public partial class RiskMeter : UserControl { public RiskMeter() { InitializeComponent(); //UpdateBrush(); } public string Label { get => (string)GetValue(LabelProperty); set => SetValue(LabelProperty, value); } public static readonly DependencyProperty LabelProperty = DependencyProperty.Register(nameof(Label), typeof(string), typeof(RiskMeter), new PropertyMetadata("Risco")); /*public double Value { get => (double)GetValue(ValueProperty); set => SetValue(ValueProperty, value); } public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(nameof(Value), typeof(double), typeof(RiskMeter), new PropertyMetadata(0d, OnAnyChange)); public string SecondaryText { get => (string)GetValue(SecondaryTextProperty); set => SetValue(SecondaryTextProperty, value); } public static readonly DependencyProperty SecondaryTextProperty = DependencyProperty.Register(nameof(SecondaryText), typeof(string), typeof(RiskMeter), new PropertyMetadata("")); public double WarnThreshold { get => (double)GetValue(WarnThresholdProperty); set => SetValue(WarnThresholdProperty, value); } public static readonly DependencyProperty WarnThresholdProperty = DependencyProperty.Register(nameof(WarnThreshold), typeof(double), typeof(RiskMeter), new PropertyMetadata(15d, OnAnyChange)); public double AlertThreshold { get => (double)GetValue(AlertThresholdProperty); set => SetValue(AlertThresholdProperty, value); } public static readonly DependencyProperty AlertThresholdProperty = DependencyProperty.Register(nameof(AlertThreshold), typeof(double), typeof(RiskMeter), new PropertyMetadata(30d, OnAnyChange)); public Brush OkBrush { get => (Brush)GetValue(OkBrushProperty); set => SetValue(OkBrushProperty, value); } public static readonly DependencyProperty OkBrushProperty = DependencyProperty.Register(nameof(OkBrush), typeof(Brush), typeof(RiskMeter), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(0x2E, 0xCC, 0x71)), OnAnyChange)); public Brush WarnBrush { get => (Brush)GetValue(WarnBrushProperty); set => SetValue(WarnBrushProperty, value); } public static readonly DependencyProperty WarnBrushProperty = DependencyProperty.Register(nameof(WarnBrush), typeof(Brush), typeof(RiskMeter), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(0xF1, 0xC4, 0x0F)), OnAnyChange)); public Brush AlertBrush { get => (Brush)GetValue(AlertBrushProperty); set => SetValue(AlertBrushProperty, value); } public static readonly DependencyProperty AlertBrushProperty = DependencyProperty.Register(nameof(AlertBrush), typeof(Brush), typeof(RiskMeter), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(0xE7, 0x4C, 0x3C)), OnAnyChange)); public Brush RiskBrush { get => (Brush)GetValue(RiskBrushProperty); private set => SetValue(RiskBrushKey, value); } private static readonly DependencyPropertyKey RiskBrushKey = DependencyProperty.RegisterReadOnly(nameof(RiskBrush), typeof(Brush), typeof(RiskMeter), new PropertyMetadata(Brushes.Gray)); public static readonly DependencyProperty RiskBrushProperty = RiskBrushKey.DependencyProperty;*/ } }