| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 | 
							- using DocumentFormat.OpenXml.InkML;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- 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.Animation;
 
- using System.Windows.Media.Imaging;
 
- using System.Windows.Navigation;
 
- using System.Windows.Shapes;
 
- namespace MECF.Framework.UI.Client.IndustrialControl
 
- {
 
-     /// <summary>
 
-     /// HslPipeLineThree.xaml 的交互逻辑
 
-     /// </summary>
 
-     public partial class PipeLineThree : UserControl
 
-     {
 
-         public PipeLineThree()
 
-         {
 
-             InitializeComponent();
 
-         }
 
-         protected override void OnInitialized(EventArgs e)
 
-         {
 
-             base.OnInitialized(e);
 
-             PipeWidthUpdate();
 
-         }
 
-         /// <summary>
 
-         /// 获取或设置管道控件的边缘颜色
 
-         /// </summary>
 
-         public Color EdgeColor
 
-         {
 
-             get { return (Color)GetValue(EdgeColorProperty); }
 
-             set { SetValue(EdgeColorProperty, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for EdgeColor.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty EdgeColorProperty =
 
-             DependencyProperty.Register("EdgeColor", typeof(Color), typeof(PipeLineThree), new PropertyMetadata(Colors.DimGray));
 
-         /// <summary>
 
-         /// 管道的中心颜色
 
-         /// </summary>
 
-         public Color CenterColor
 
-         {
 
-             get { return (Color)GetValue(CenterColorProperty); }
 
-             set { SetValue(CenterColorProperty, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for CenterColor.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty CenterColorProperty =
 
-             DependencyProperty.Register("CenterColor", typeof(Color), typeof(PipeLineThree), new PropertyMetadata(Colors.LightGray));
 
-         /// <summary>
 
-         /// 获取或设置管道1号线是否激活液体显示
 
-         /// </summary>
 
-         public bool PipeLineActive1
 
-         {
 
-             get { return (bool)GetValue(PipeLineActive1Property); }
 
-             set { SetValue(PipeLineActive1Property, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for PipeLineActive1.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty PipeLineActive1Property =
 
-             DependencyProperty.Register("PipeLineActive1", typeof(bool), typeof(PipeLineThree), new PropertyMetadata(false));
 
-         /// <summary>
 
-         /// 获取或设置管道2号线是否激活液体显示
 
-         /// </summary>
 
-         public bool PipeLineActive2
 
-         {
 
-             get { return (bool)GetValue(PipeLineActive2Property); }
 
-             set { SetValue(PipeLineActive2Property, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for PipeLineActive2.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty PipeLineActive2Property =
 
-             DependencyProperty.Register("PipeLineActive2", typeof(bool), typeof(PipeLineThree), new PropertyMetadata(false));
 
-         /// <summary>
 
-         /// 获取或设置管道3号线是否激活液体显示
 
-         /// </summary>
 
-         public bool PipeLineActive3
 
-         {
 
-             get { return (bool)GetValue(PipeLineActive3Property); }
 
-             set { SetValue(PipeLineActive3Property, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for PipeLineActive3.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty PipeLineActive3Property =
 
-             DependencyProperty.Register("PipeLineActive3", typeof(bool), typeof(PipeLineThree), new PropertyMetadata(false));
 
-         /// <summary>
 
-         /// 获取或设置管道1号线液体流动的速度,0为静止,正数为正向流动,负数为反向流动
 
-         /// </summary>
 
-         public double MoveSpeed1
 
-         {
 
-             get { return (double)GetValue(MoveSpeed1Property); }
 
-             set { SetValue(MoveSpeed1Property, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for MoveSpeed1.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty MoveSpeed1Property =
 
-             DependencyProperty.Register("MoveSpeed1", typeof(double), typeof(PipeLineThree),
 
-                 new PropertyMetadata(0d, new PropertyChangedCallback(MoveSpeed1PropertyChangedCallback)));
 
-         public static void MoveSpeed1PropertyChangedCallback(DependencyObject dependency, DependencyPropertyChangedEventArgs e)
 
-         {
 
-             PipeLineThree pipeLine = (PipeLineThree)dependency;
 
-             pipeLine.UpdateMoveSpeed1();
 
-         }
 
-         private DoubleAnimation offect1DoubleAnimation = null;
 
-         public void UpdateMoveSpeed1()
 
-         {
 
-             return;
 
-             if (MoveSpeed1 > 0)
 
-             {
 
-                 UpdatePathDataSG1();
 
-                 path1.Visibility = Visibility.Visible;
 
-                 offect1DoubleAnimation = new DoubleAnimation(0d, 10d, TimeSpan.FromMilliseconds(300 / MoveSpeed1), FillBehavior.Stop);
 
-                 offect1DoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
 
-                 BeginAnimation(LineOffect1Property, offect1DoubleAnimation);
 
-             }
 
-             else if (MoveSpeed1 < 0)
 
-             {
 
-                 UpdatePathDataSG1();
 
-                 path1.Visibility = Visibility.Visible;
 
-                 offect1DoubleAnimation = new DoubleAnimation(10d, 0d, TimeSpan.FromMilliseconds(300 / Math.Abs(MoveSpeed1)), FillBehavior.Stop);
 
-                 offect1DoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
 
-                 BeginAnimation(LineOffect1Property, offect1DoubleAnimation);
 
-             }
 
-             else
 
-             {
 
-                 path1.Data = null;
 
-                 if (offect1DoubleAnimation != null)
 
-                 {
 
-                     offect1DoubleAnimation.FillBehavior = FillBehavior.Stop;
 
-                     offect1DoubleAnimation = null;
 
-                 }
 
-                 path1.Visibility = Visibility.Hidden;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 获取或设置管道2号线液体流动的速度,0为静止,正数为正向流动,负数为反向流动
 
-         /// </summary>
 
-         public double MoveSpeed2
 
-         {
 
-             get { return (double)GetValue(MoveSpeed2Property); }
 
-             set { SetValue(MoveSpeed2Property, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for MoveSpeed2.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty MoveSpeed2Property =
 
-             DependencyProperty.Register("MoveSpeed2", typeof(double), typeof(PipeLineThree),
 
-                 new PropertyMetadata(0d, new PropertyChangedCallback(MoveSpeed2PropertyChangedCallback)));
 
-         public static void MoveSpeed2PropertyChangedCallback(DependencyObject dependency, DependencyPropertyChangedEventArgs e)
 
-         {
 
-             PipeLineThree pipeLine = (PipeLineThree)dependency;
 
-             pipeLine.UpdateMoveSpeed2();
 
-         }
 
-         private DoubleAnimation offect2DoubleAnimation = null;
 
-         public void UpdateMoveSpeed2()
 
-         {
 
-             return;
 
-             if (MoveSpeed2 > 0)
 
-             {
 
-                 UpdatePathDataSG2();
 
-                 path2.Visibility = Visibility.Visible;
 
-                 offect2DoubleAnimation = new DoubleAnimation(0d, 10d, TimeSpan.FromMilliseconds(300 / MoveSpeed2), FillBehavior.Stop);
 
-                 offect2DoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
 
-                 BeginAnimation(LineOffect2Property, offect2DoubleAnimation);
 
-             }
 
-             else if (MoveSpeed2 < 0)
 
-             {
 
-                 UpdatePathDataSG2();
 
-                 path2.Visibility = Visibility.Visible;
 
-                 offect2DoubleAnimation = new DoubleAnimation(10d, 0d, TimeSpan.FromMilliseconds(300 / Math.Abs(MoveSpeed2)), FillBehavior.Stop);
 
-                 offect2DoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
 
-                 BeginAnimation(LineOffect2Property, offect2DoubleAnimation);
 
-             }
 
-             else
 
-             {
 
-                 path2.Data = null;
 
-                 if (offect2DoubleAnimation != null)
 
-                 {
 
-                     offect2DoubleAnimation.FillBehavior = FillBehavior.Stop;
 
-                     offect2DoubleAnimation = null;
 
-                 }
 
-                 path2.Visibility = Visibility.Hidden;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 获取或设置管道3号线液体流动的速度,0为静止,正数为正向流动,负数为反向流动
 
-         /// </summary>
 
-         public double MoveSpeed3
 
-         {
 
-             get { return (double)GetValue(MoveSpeed3Property); }
 
-             set { SetValue(MoveSpeed3Property, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for MoveSpeed3.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty MoveSpeed3Property =
 
-             DependencyProperty.Register("MoveSpeed3", typeof(double), typeof(PipeLineThree),
 
-                 new PropertyMetadata(0d, new PropertyChangedCallback(MoveSpeed3PropertyChangedCallback)));
 
-         public static void MoveSpeed3PropertyChangedCallback(DependencyObject dependency, DependencyPropertyChangedEventArgs e)
 
-         {
 
-             PipeLineThree pipeLine = (PipeLineThree)dependency;
 
-             pipeLine.UpdateMoveSpeed3();
 
-         }
 
-         private DoubleAnimation offect3DoubleAnimation = null;
 
-         public void UpdateMoveSpeed3()
 
-         {
 
-             return;
 
-             if (MoveSpeed3 > 0)
 
-             {
 
-                 UpdatePathDataSG3();
 
-                 path3.Visibility = Visibility.Visible;
 
-                 offect3DoubleAnimation = new DoubleAnimation(0d, 10d, TimeSpan.FromMilliseconds(300 / MoveSpeed3), FillBehavior.Stop);
 
-                 offect3DoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
 
-                 BeginAnimation(LineOffect3Property, offect3DoubleAnimation);
 
-             }
 
-             else if (MoveSpeed3 < 0)
 
-             {
 
-                 UpdatePathDataSG3();
 
-                 path3.Visibility = Visibility.Visible;
 
-                 offect3DoubleAnimation = new DoubleAnimation(10d, 0d, TimeSpan.FromMilliseconds(300 / Math.Abs(MoveSpeed3)), FillBehavior.Stop);
 
-                 offect3DoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
 
-                 BeginAnimation(LineOffect3Property, offect3DoubleAnimation);
 
-             }
 
-             else
 
-             {
 
-                 path3.Data = null;
 
-                 if (offect3DoubleAnimation != null)
 
-                 {
 
-                     offect3DoubleAnimation.FillBehavior = FillBehavior.Stop;
 
-                     offect3DoubleAnimation = null;
 
-                 }
 
-                 path3.Visibility = Visibility.Hidden;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 管道1的偏移
 
-         /// </summary>
 
-         public double LineOffect1
 
-         {
 
-             get { return (double)GetValue(LineOffect1Property); }
 
-             set { SetValue(LineOffect1Property, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for LineOffect1.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty LineOffect1Property =
 
-             DependencyProperty.Register("LineOffect1", typeof(double), typeof(PipeLineThree), new PropertyMetadata(0d));
 
-         /// <summary>
 
-         /// 管道2的偏移
 
-         /// </summary>
 
-         public double LineOffect2
 
-         {
 
-             get { return (double)GetValue(LineOffect2Property); }
 
-             set { SetValue(LineOffect2Property, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for LineOffect2.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty LineOffect2Property =
 
-             DependencyProperty.Register("LineOffect2", typeof(double), typeof(PipeLineThree), new PropertyMetadata(0d));
 
-         /// <summary>
 
-         /// 管道3的偏移
 
-         /// </summary>
 
-         public double LineOffect3
 
-         {
 
-             get { return (double)GetValue(LineOffect3Property); }
 
-             set { SetValue(LineOffect3Property, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for LineOffect3.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty LineOffect3Property =
 
-             DependencyProperty.Register("LineOffect3", typeof(double), typeof(PipeLineThree), new PropertyMetadata(0d));
 
-         /// <summary>
 
-         /// 获取或设置中间管道线的宽度信息,默认为3
 
-         /// </summary>
 
-         public int PipeLineWidth
 
-         {
 
-             get { return (int)GetValue(PipeLineWidthProperty); }
 
-             set { SetValue(PipeLineWidthProperty, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for PipeLineWidth.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty PipeLineWidthProperty =
 
-             DependencyProperty.Register("PipeLineWidth", typeof(int), typeof(PipeLineThree), new PropertyMetadata(2));
 
-         /// <summary>
 
-         /// 获取或设置流动状态时管道控件的中心颜色
 
-         /// </summary>
 
-         public Color ActiveLineCenterColor
 
-         {
 
-             get { return (Color)GetValue(ActiveLineCenterColorProperty); }
 
-             set { SetValue(ActiveLineCenterColorProperty, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for ActiveLineCenterColor.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty ActiveLineCenterColorProperty =
 
-             DependencyProperty.Register("ActiveLineCenterColor", typeof(Color), typeof(PipeLineThree), new PropertyMetadata(Colors.DodgerBlue));
 
-         /// <summary>
 
-         /// 获取或设置管道的宽度,默认为30
 
-         /// </summary>
 
-         public int PipeWidth
 
-         {
 
-             get { return (int)GetValue(PipeWidthProperty); }
 
-             set { SetValue(PipeWidthProperty, value); }
 
-         }
 
-         // Using a DependencyProperty as the backing store for PipeWidth.  This enables animation, styling, binding, etc...
 
-         public static readonly DependencyProperty PipeWidthProperty =
 
-             DependencyProperty.Register("PipeWidth", typeof(int), typeof(PipeLineThree),
 
-                 new PropertyMetadata(30, new PropertyChangedCallback(PipeWidthPropertyChangedCallback)));
 
-        
 
-         public static void PipeWidthPropertyChangedCallback(DependencyObject dependency, DependencyPropertyChangedEventArgs e)
 
-         {
 
-             PipeLineThree pipeLine = (PipeLineThree)dependency;
 
-             pipeLine.PipeWidthUpdate();
 
-         }
 
-         public void PipeWidthUpdate()
 
-         {
 
-             UpdatePath();
 
-         }
 
-         public double RouWidth
 
-         {
 
-             get
 
-             {
 
-                 return canvas1.ActualWidth / 2;
 
-             }
 
-         }
 
-         protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
 
-         {
 
-             
 
-             UpdatePath();
 
-             base.OnRenderSizeChanged(sizeInfo);
 
-             UpdateMoveSpeed1();
 
-             UpdateMoveSpeed2();
 
-             UpdateMoveSpeed3();
 
-         }
 
-         StreamGeometry sg1 = new StreamGeometry();
 
-         public void UpdatePathDataSG1()
 
-         {
 
-            
 
-             using (StreamGeometryContext context = sg1.Open())
 
-             {
 
-                 context.BeginFigure(new Point(0, PipeWidth * 0.5), false, false);
 
-                 context.LineTo(new Point(ActualWidth, PipeWidth * 0.5), true, false);
 
-             }
 
-             path1.Data = sg1;
 
-         }
 
-         StreamGeometry sg2 = new StreamGeometry();
 
-         public void UpdatePathDataSG2()
 
-         {
 
-             
 
-             using (StreamGeometryContext context = sg2.Open())
 
-             {
 
-                 context.BeginFigure(new Point(0, PipeWidth * 0.5), false, false);
 
-                 context.LineTo(new Point(ActualWidth * 0.5 - PipeWidth * 0.5, PipeWidth * 0.5), true, false);
 
-                 context.ArcTo(new Point(ActualWidth * 0.5, PipeWidth), new Size(PipeWidth * 0.5, PipeWidth * 0.5), 0, false, SweepDirection.Clockwise, true, false);
 
-                 context.LineTo(new Point(ActualWidth * 0.5, ActualHeight), true, false);
 
-             }
 
-             path2.Data = sg2;
 
-         }
 
-         StreamGeometry sg3 = new StreamGeometry();
 
-         public void UpdatePathDataSG3()
 
-         {
 
-             using (StreamGeometryContext context = sg3.Open())
 
-             {
 
-                 context.BeginFigure(new Point(ActualWidth, PipeWidth * 0.5), false, false);
 
-                 context.LineTo(new Point(ActualWidth * 0.5 + PipeWidth * 0.5, PipeWidth * 0.5), true, false);
 
-                 context.ArcTo(new Point(ActualWidth * 0.5, PipeWidth), new Size(PipeWidth * 0.5, PipeWidth * 0.5), 0, false, SweepDirection.Counterclockwise, true, false);
 
-                 context.LineTo(new Point(ActualWidth * 0.5, ActualHeight), true, false);
 
-             }
 
-             path3.Data = sg3;
 
-         }
 
-         public void UpdatePath()
 
-         {
 
-              
 
-         
 
-         polygon1.Points = new PointCollection(new Point[]
 
-             {
 
-                 new Point(ActualWidth * 0.5 - PipeWidth *0.5, PipeWidth),
 
-                 new Point(ActualWidth * 0.5, PipeWidth *0.5),
 
-                 new Point(ActualWidth * 0.5 + PipeWidth *0.5, PipeWidth),
 
-                 new Point(ActualWidth * 0.5 + PipeWidth *0.5, ActualHeight),
 
-                 new Point(ActualWidth * 0.5 - PipeWidth *0.5, ActualHeight),
 
-                 new Point(ActualWidth * 0.5 - PipeWidth *0.5, PipeWidth),
 
-             });
 
-           
 
-         }
 
-     }
 
- }
 
 
  |