123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Controls;
- 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 System.Runtime.Serialization;
- using Aitex.Core.Util;
- using Aitex.Core.UI.ControlDataContext;
- namespace Aitex.Core.UI.Control
- {
- /// <summary>
- /// Interaction logic for MFC4Process.xaml
- /// </summary>
- public partial class MFC4Process : UserControl
- {
- public MFC4Process()
- {
- InitializeComponent();
- }
- MOSourceDataItem AirFlowMoLineData { get { return (this.DataContext as MOSourceDataItem); } }
- // public static readonly DependencyProperty SourceMFCProperty = DependencyProperty.Register(
- // "SourceMFC", typeof(AnalogDeviceDataItem), typeof(MFC4Process),
- // new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
- // public AnalogDeviceDataItem SourceMFC
- // {
- // get
- // {
- // return (AnalogDeviceDataItem)this.GetValue(SourceMFCProperty);
- // }
- // set
- // {
- // this.SetValue(SourceMFCProperty, value);
- // }
- // }
- // public static readonly DependencyProperty Source2MFCProperty = DependencyProperty.Register(
- // "Source2MFC", typeof(AnalogDeviceDataItem), typeof(MFC4Process),
- // new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
- // public AnalogDeviceDataItem Source2MFC
- // {
- // get
- // {
- // return (AnalogDeviceDataItem)this.GetValue(Source2MFCProperty);
- // }
- // set
- // {
- // this.SetValue(Source2MFCProperty, value);
- // }
- // }
- // public static readonly DependencyProperty InjectMFCProperty = DependencyProperty.Register(
- //"InjectMFC", typeof(AnalogDeviceDataItem), typeof(MFC4Process),
- //new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
- // public AnalogDeviceDataItem InjectMFC
- // {
- // get
- // {
- // return (AnalogDeviceDataItem)this.GetValue(InjectMFCProperty);
- // }
- // set
- // {
- // this.SetValue(InjectMFCProperty, value);
- // }
- // }
- // public static readonly DependencyProperty DiluteMFCProperty = DependencyProperty.Register(
- //"DiluteMFC", typeof(AnalogDeviceDataItem), typeof(MFC4Process),
- //new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
- // public AnalogDeviceDataItem DiluteMFC
- // {
- // get
- // {
- // return (AnalogDeviceDataItem)this.GetValue(DiluteMFCProperty);
- // }
- // set
- // {
- // this.SetValue(DiluteMFCProperty, value);
- // }
- // }
-
- // public bool IsMultiControlMFC{get;set;}
-
- // protected override void OnRender(DrawingContext drawingContext)
- // {
- // base.OnRender(drawingContext);
-
- // StringBuilder tooltip = new StringBuilder();
- // Brush borderBrush = Brushes.Black;
-
- // string content = "";
- // if (IsMultiControlMFC)
- // {
- // if (SourceMFC == null) return;
- // var source = SourceMFC.FeedBack;
- // var inject = InjectMFC.FeedBack;
- // var dilute = DiluteMFC.FeedBack;
- // var source2 = Source2MFC == null ? 0 : Source2MFC.FeedBack;
- // var flow = source + source2 + dilute;
- // if (flow == 0)
- // {
- // content = "0.00";
- // }
- // else
- // {
- // double val = ((source * inject) / flow);
- // content = val >= 10 ? val.ToString("0.0") : val.ToString("0.00");
- // }
- // if (SourceMFC.IsWarning) { borderBrush = Brushes.Red; tooltip.AppendLine(string.Format("mfc:{0},设备名:{1} 报警! 流量:{2}", SourceMFC.DeviceId, SourceMFC.DeviceName, SourceMFC.FeedBack.ToString("F1"))); }
- // if (InjectMFC.IsWarning) { borderBrush = Brushes.Red; tooltip.AppendLine(string.Format("mfc:{0},设备名:{1} 报警! 流量:{2}", InjectMFC.DeviceId, InjectMFC.DeviceName, InjectMFC.FeedBack.ToString("F1"))); }
- // if (DiluteMFC.IsWarning) { borderBrush = Brushes.Red; tooltip.AppendLine(string.Format("mfc:{0},设备名:{1} 报警! 流量:{2}", DiluteMFC.DeviceId, DiluteMFC.DeviceName, DiluteMFC.FeedBack.ToString("F1"))); }
- // }
- // else
- // {
- // if (SourceMFC != null && SourceMFC.IsWarning) { borderBrush = Brushes.Red; tooltip.AppendLine(string.Format("mfc:{0},设备名:{1} 报警! 流量:{2}", SourceMFC.DeviceId, SourceMFC.DeviceName, SourceMFC.FeedBack.ToString("F1"))); }
- // content = OptimizeFeedBack(SourceMFC);
- // }
- // btnLiuLiang.Foreground = borderBrush;
- // btnLiuLiang.BorderBrush = borderBrush;
-
- // btnLiuLiang.Content = content;
- // if (tooltip.Length > 0)
- // btnLiuLiang.ToolTip = tooltip.ToString();
- // else
- // btnLiuLiang.ToolTip = null;
- // }
- // string OptimizeFeedBack(AnalogDeviceDataItem mfc)
- // {
- // if (mfc == null) return "-";
- // if (mfc.FeedBack >= 10000)
- // return mfc.FeedBack.ToString("F0");
- // else if (mfc.FeedBack >= 10)
- // return mfc.FeedBack.ToString("0.0");
- // else
- // return mfc.FeedBack.ToString("0.00");
- // }
- }
- }
|