1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- namespace HistoryView.Controls.Configs;
- public partial class ChannelComparision : UserControl
- {
- public ChannelComparision()
- {
- InitializeComponent();
- }
- public TempConfigSubChannel Source
- {
- get { return (TempConfigSubChannel)GetValue(SourceProperty); }
- set { SetValue(SourceProperty, value); }
- }
- public static readonly DependencyProperty SourceProperty =
- DependencyProperty.Register("Source", typeof(TempConfigSubChannel), typeof(ChannelComparision), new PropertyMetadata(default, TempChangedCallback));
- public TempConfigSubChannel Target
- {
- get { return (TempConfigSubChannel)GetValue(TargetProperty); }
- set { SetValue(TargetProperty, value); }
- }
- public static readonly DependencyProperty TargetProperty =
- DependencyProperty.Register("Target", typeof(TempConfigSubChannel), typeof(ChannelComparision), new PropertyMetadata(default, TempChangedCallback));
- static void TempChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- if (d is not ChannelComparision act)
- return;
- if (act.Target is null || act.Source is null)
- return;
- Compare(act, act.Source, act.Target);
- }
- private static void Compare(ChannelComparision act, TempConfigSubChannel source, TempConfigSubChannel target)
- {
- act.Index.Background = new SolidColorBrush(Colors.Transparent);
- act.SetPoint.Background = new SolidColorBrush(Colors.Transparent);
- act.CapsWarning.Background = new SolidColorBrush(Colors.Transparent);
- act.FloorWarning.Background = new SolidColorBrush(Colors.Transparent);
- act.UpperLimit.Background = new SolidColorBrush(Colors.Transparent);
- act.LowerLimit.Background = new SolidColorBrush(Colors.Transparent);
- act.Running_P.Background = new SolidColorBrush(Colors.Transparent);
- act.Running_I.Background = new SolidColorBrush(Colors.Transparent);
- act.Running_D.Background = new SolidColorBrush(Colors.Transparent);
- act.SetpointUpRate.Background = new SolidColorBrush(Colors.Transparent);
- act.SetpointDownRate.Background = new SolidColorBrush(Colors.Transparent);
-
- if (source.SetPoint != target.SetPoint)
- act.SetPoint.Background = (Brush)App.Current.Resources["LightWarningColor"];
- if (source.CapsWarning != target.CapsWarning)
- act.CapsWarning.Background = (Brush)App.Current.Resources["LightWarningColor"];
- if (source.FloorWarning != target.FloorWarning)
- act.FloorWarning.Background = (Brush)App.Current.Resources["LightWarningColor"];
- if (source.Caps != target.Caps)
- act.UpperLimit.Background = (Brush)App.Current.Resources["LightWarningColor"];
- if (source.Floor != target.Floor)
- act.LowerLimit.Background = (Brush)App.Current.Resources["LightWarningColor"];
- if (source.Running_P != target.Running_P)
- act.Running_P.Background = (Brush)App.Current.Resources["LightWarningColor"];
- if (source.Running_I != target.Running_I)
- act.Running_I.Background = (Brush)App.Current.Resources["LightWarningColor"];
- if (source.Running_D != target.Running_D)
- act.Running_D.Background = (Brush)App.Current.Resources["LightWarningColor"];
- if (source.SetpointUpRate != target.SetpointUpRate)
- act.SetpointUpRate.Background = (Brush)App.Current.Resources["LightWarningColor"];
- if (source.SetpointDownRate != target.SetpointDownRate)
- act.SetpointDownRate.Background = (Brush)App.Current.Resources["LightWarningColor"];
- }
- }
|