diff --git a/BPASmartClient.CustomResource/UserControls/Bottle.xaml b/BPASmartClient.CustomResource/UserControls/Bottle.xaml new file mode 100644 index 00000000..15cf9288 --- /dev/null +++ b/BPASmartClient.CustomResource/UserControls/Bottle.xaml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.CustomResource/UserControls/Bottle.xaml.cs b/BPASmartClient.CustomResource/UserControls/Bottle.xaml.cs new file mode 100644 index 00000000..626d196f --- /dev/null +++ b/BPASmartClient.CustomResource/UserControls/Bottle.xaml.cs @@ -0,0 +1,56 @@ +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.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.CustomResource.UserControls +{ + /// + /// Bottle.xaml 的交互逻辑 + /// + public partial class Bottle : UserControl + { + public Bottle() + { + InitializeComponent(); + } + + private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + (d as Bottle)?.Refresh(); + } + + private void Refresh() + { + double height = LinearConvert(CurrentValue, 160F, 0F, 100F, 0F); + refile.Height = height; + } + + private double LinearConvert(double IntputValue, double OSH, double OSL, double ISH, double ISL) + { + if (IntputValue >= ISH) return OSH; + if (IntputValue <= ISL) return OSL; + return (IntputValue - ISL) * (OSH - OSL) / (ISH - ISL) + OSL; + } + + public double CurrentValue + { + get { return (double)GetValue(CurrentValueProperty); } + set { SetValue(CurrentValueProperty, value); } + } + public static readonly DependencyProperty CurrentValueProperty = + DependencyProperty.Register("CurrentValue", typeof(double), typeof(Bottle), + new PropertyMetadata(0.0, new PropertyChangedCallback(OnPropertyChanged))); + + } +} diff --git a/BPASmartClient.CustomResource/UserControls/ConveyorBelt.xaml b/BPASmartClient.CustomResource/UserControls/ConveyorBelt.xaml new file mode 100644 index 00000000..49ad364a --- /dev/null +++ b/BPASmartClient.CustomResource/UserControls/ConveyorBelt.xaml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.CustomResource/UserControls/ConveyorBelt.xaml.cs b/BPASmartClient.CustomResource/UserControls/ConveyorBelt.xaml.cs new file mode 100644 index 00000000..8da108ad --- /dev/null +++ b/BPASmartClient.CustomResource/UserControls/ConveyorBelt.xaml.cs @@ -0,0 +1,137 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +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 BPASmartClient.CustomResource.UserControls +{ + /// + /// ConveyorBelt.xaml 的交互逻辑 + /// + public partial class ConveyorBelt : UserControl + { + public ConveyorBelt() + { + InitializeComponent(); + this.SizeChanged += ConveyorBelt_SizeChanged; + } + + private void ConveyorBelt_SizeChanged(object sender, SizeChangedEventArgs e) + { + //传送带外边框绘制 + PathGeometry geometry = new PathGeometry(); + PathFigure pathFigure = new PathFigure(); + pathFigure.StartPoint = new Point(this.Height / 2, 0); + pathFigure.Segments.Add(new ArcSegment(new Point(this.Height / 2, this.Height), new Size(this.Height / 2, this.Height / 2), 0, false, SweepDirection.Counterclockwise, true)); + pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height), true)); + pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height - ConveyorBeltWidth), true)); + double innerCircle = (this.Height - (ConveyorBeltWidth * 2)) / 2;//内圆半径 + pathFigure.Segments.Add(new LineSegment(new Point(ConveyorBeltWidth + innerCircle, this.Height - ConveyorBeltWidth), true)); + pathFigure.Segments.Add(new ArcSegment(new Point(ConveyorBeltWidth + innerCircle, ConveyorBeltWidth), new Size(innerCircle, innerCircle), 0, false, SweepDirection.Clockwise, true)); + pathFigure.Segments.Add(new LineSegment(new Point(this.Width, ConveyorBeltWidth), true)); + pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 0), true)); + pathFigure.Segments.Add(new LineSegment(new Point(this.Height / 2, 0), true)); + geometry.Figures.Add(pathFigure); + this.cb.Data = geometry; + + //传送带内部皮带绘制 + PathGeometry geometry1 = new PathGeometry(); + PathFigure pathFigure1 = new PathFigure(); + pathFigure1.StartPoint = new Point(this.Width, ConveyorBeltWidth / 2); + double innerCircle1 = (this.Height - ConveyorBeltWidth) / 2;//内圆半径 + pathFigure1.Segments.Add(new LineSegment(new Point(innerCircle1 + ConveyorBeltWidth / 2, ConveyorBeltWidth / 2), true)); + pathFigure1.Segments.Add(new ArcSegment(new Point(innerCircle1 + ConveyorBeltWidth / 2, this.Height - ConveyorBeltWidth / 2), new Size(innerCircle1, innerCircle1), 0, false, SweepDirection.Counterclockwise, true)); + pathFigure1.Segments.Add(new LineSegment(new Point(this.Width, this.Height - ConveyorBeltWidth / 2), true)); + geometry1.Figures.Add(pathFigure1); + this.mp.Data = geometry1; + + } + + private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + (d as ConveyorBelt)?.Refursh(); + } + + private void Refursh() + { + if (Direction == 1) VisualStateManager.GoToState(this, "Left", false); + else if (Direction == 2) VisualStateManager.GoToState(this, "Right", false); + else VisualStateManager.GoToState(this, "Stop", false); + } + + + public DoubleCollection StrokeDashArray + { + get { return (DoubleCollection)GetValue(StrokeDashArrayProperty); } + set { SetValue(StrokeDashArrayProperty, value); } + } + public static readonly DependencyProperty StrokeDashArrayProperty = + DependencyProperty.Register("StrokeDashArray", typeof(DoubleCollection), typeof(ConveyorBelt), + new PropertyMetadata(default, new PropertyChangedCallback(OnPropertyChanged))); + + + public double ConveyorBeltWidth + { + get { return (double)GetValue(ConveyorBeltWidthProperty); } + set { SetValue(ConveyorBeltWidthProperty, value); } + } + public static readonly DependencyProperty ConveyorBeltWidthProperty = + DependencyProperty.Register("ConveyorBeltWidth", typeof(double), typeof(ConveyorBelt), + new PropertyMetadata(50.0, new PropertyChangedCallback(OnPropertyChanged))); + + + public Brush StrokeFillBrush + { + get { return (Brush)GetValue(StrokeFillBrushProperty); } + set { SetValue(StrokeFillBrushProperty, value); } + } + public static readonly DependencyProperty StrokeFillBrushProperty = + DependencyProperty.Register("StrokeFillBrush", typeof(Brush), typeof(ConveyorBelt), + new PropertyMetadata(Brushes.LightBlue, new PropertyChangedCallback(OnPropertyChanged))); + + + + public Brush StrokeBrush + { + get { return (Brush)GetValue(StrokeBrushProperty); } + set { SetValue(StrokeBrushProperty, value); } + } + public static readonly DependencyProperty StrokeBrushProperty = + DependencyProperty.Register("StrokeBrush", typeof(Brush), typeof(ConveyorBelt), + new PropertyMetadata(Brushes.LightBlue, new PropertyChangedCallback(OnPropertyChanged))); + + + public double StrokeThickness + { + get { return (double)GetValue(StrokeThicknessProperty); } + set { SetValue(StrokeThicknessProperty, value); } + } + public static readonly DependencyProperty StrokeThicknessProperty = + DependencyProperty.Register("StrokeThickness", typeof(double), typeof(ConveyorBelt), + new PropertyMetadata(1.0, new PropertyChangedCallback(OnPropertyChanged))); + + + public int Direction + { + get { return (int)GetValue(DirectionProperty); } + set { SetValue(DirectionProperty, value); } + } + public static readonly DependencyProperty DirectionProperty = + DependencyProperty.Register("Direction", typeof(int), typeof(ConveyorBelt), + new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged))); + + + } +} diff --git a/BPASmartClient.CustomResource/UserControls/DosingSystem.xaml b/BPASmartClient.CustomResource/UserControls/DosingSystem.xaml index 55f0ac3b..cf7d1b2f 100644 --- a/BPASmartClient.CustomResource/UserControls/DosingSystem.xaml +++ b/BPASmartClient.CustomResource/UserControls/DosingSystem.xaml @@ -10,1117 +10,1124 @@ mc:Ignorable="d"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + RenderTransformOrigin="0.5,0.5" + StrokeThickness="0"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.CustomResource/UserControls/MotorBottle.xaml b/BPASmartClient.CustomResource/UserControls/MotorBottle.xaml new file mode 100644 index 00000000..a510e216 --- /dev/null +++ b/BPASmartClient.CustomResource/UserControls/MotorBottle.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + diff --git a/BPASmartClient.CustomResource/UserControls/MotorBottle.xaml.cs b/BPASmartClient.CustomResource/UserControls/MotorBottle.xaml.cs new file mode 100644 index 00000000..cbbb5040 --- /dev/null +++ b/BPASmartClient.CustomResource/UserControls/MotorBottle.xaml.cs @@ -0,0 +1,28 @@ +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.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.CustomResource.UserControls +{ + /// + /// MotorBottle.xaml 的交互逻辑 + /// + public partial class MotorBottle : UserControl + { + public MotorBottle() + { + InitializeComponent(); + } + } +} diff --git a/BPASmartClient.CustomResource/UserControls/Pipeline.xaml b/BPASmartClient.CustomResource/UserControls/Pipeline.xaml new file mode 100644 index 00000000..01e7a69b --- /dev/null +++ b/BPASmartClient.CustomResource/UserControls/Pipeline.xaml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.CustomResource/UserControls/Pipeline.xaml.cs b/BPASmartClient.CustomResource/UserControls/Pipeline.xaml.cs new file mode 100644 index 00000000..b4ab924f --- /dev/null +++ b/BPASmartClient.CustomResource/UserControls/Pipeline.xaml.cs @@ -0,0 +1,59 @@ +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.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.CustomResource.UserControls +{ + /// + /// Pipeline.xaml 的交互逻辑 + /// + public partial class Pipeline : UserControl + { + public Pipeline() + { + InitializeComponent(); + } + + private int _direction = 1; + /// + /// 液体流向,接受1和2两个值 + /// + public int Direction + { + get { return _direction; } + set + { + _direction = value; + + VisualStateManager.GoToState(this, value == 1 ? "WEFlowState" : "EWFlowState", false); + } + } + + public Brush LiquidColor + { + get { return (Brush)GetValue(LiquidColorProperty); } + set { SetValue(LiquidColorProperty, value); } + } + public static readonly DependencyProperty LiquidColorProperty = + DependencyProperty.Register("LiquidColor", typeof(Brush), typeof(Pipeline), new PropertyMetadata(Brushes.Orange)); + + public int CapRadius + { + get { return (int)GetValue(CapRadiusProperty); } + set { SetValue(CapRadiusProperty, value); } + } + public static readonly DependencyProperty CapRadiusProperty = + DependencyProperty.Register("CapRadius", typeof(int), typeof(Pipeline), new PropertyMetadata(5)); + } +} diff --git a/DosingSystem/App.xaml.cs b/DosingSystem/App.xaml.cs index e8d78008..bc3b325b 100644 --- a/DosingSystem/App.xaml.cs +++ b/DosingSystem/App.xaml.cs @@ -27,12 +27,13 @@ namespace BPASmartClient.DosingSystem DataInit(); MainView mv = new MainView(); - LoginView lv = new LoginView(); - var res = lv.ShowDialog(); - if (res != null && res == true) - mv.Show(); - else - mv.Close(); + mv.Show(); + //LoginView lv = new LoginView(); + //var res = lv.ShowDialog(); + //if (res != null && res == true) + // mv.Show(); + //else + // mv.Close(); } diff --git a/DosingSystem/View/HardwareStatusView.xaml b/DosingSystem/View/HardwareStatusView.xaml index e7bab90e..9ff258be 100644 --- a/DosingSystem/View/HardwareStatusView.xaml +++ b/DosingSystem/View/HardwareStatusView.xaml @@ -8,8 +8,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" - d:DesignHeight="450" - d:DesignWidth="800" + d:DesignHeight="1080" + d:DesignWidth="1920" mc:Ignorable="d"> @@ -17,6 +17,218 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DosingSystem/View/RecipeControlView.xaml b/DosingSystem/View/RecipeControlView.xaml index d705a4bc..511d0061 100644 --- a/DosingSystem/View/RecipeControlView.xaml +++ b/DosingSystem/View/RecipeControlView.xaml @@ -44,13 +44,13 @@ - + - + - + - + @@ -86,6 +86,7 @@ Grid.Row="1" Width="80" Height="30" + Background="#00BEFA" HorizontalAlignment="Left" Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" CommandParameter="{Binding RecipeName}" diff --git a/DosingSystem/View/RecipeSettingsView.xaml b/DosingSystem/View/RecipeSettingsView.xaml index 9edbf3d4..1cf70d19 100644 --- a/DosingSystem/View/RecipeSettingsView.xaml +++ b/DosingSystem/View/RecipeSettingsView.xaml @@ -22,7 +22,7 @@