diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index f48caec..f1d0c21 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -234,8 +234,10 @@
{
if (RuntimeCache.IsDetectNoise)
{
- var eventArgs = new CorrelatorDataEventArgs(_dataModel.LeftNoiseSumValue,
- _dataModel.RightNoiseSumValue);
+ var eventArgs = new CorrelatorDataEventArgs(
+ _dataModel.LeftNoiseSumValue, _dataModel.LeftDeviceDataArray,
+ _dataModel.RightNoiseSumValue, _dataModel.RightDeviceDataArray
+ );
DetectNoiseEvent?.Invoke(this, eventArgs);
}
else
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index f48caec..f1d0c21 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -234,8 +234,10 @@
{
if (RuntimeCache.IsDetectNoise)
{
- var eventArgs = new CorrelatorDataEventArgs(_dataModel.LeftNoiseSumValue,
- _dataModel.RightNoiseSumValue);
+ var eventArgs = new CorrelatorDataEventArgs(
+ _dataModel.LeftNoiseSumValue, _dataModel.LeftDeviceDataArray,
+ _dataModel.RightNoiseSumValue, _dataModel.RightDeviceDataArray
+ );
DetectNoiseEvent?.Invoke(this, eventArgs);
}
else
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml b/Correlator/Dialog/DetectNoiseDialog.xaml
index e2226c3..0b9d5ad 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml
@@ -7,8 +7,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
xmlns:vm="clr-namespace:Correlator.ViewModels"
- Width="600"
- Height="300"
+ Width="800"
+ Height="635"
d:DataContext="{d:DesignInstance Type=vm:DetectNoiseDialogViewModel}"
Background="White"
mc:Ignorable="d">
@@ -33,60 +33,68 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
-
+
-
+
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
-
+
-
+
+
+
+
+
+
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index f48caec..f1d0c21 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -234,8 +234,10 @@
{
if (RuntimeCache.IsDetectNoise)
{
- var eventArgs = new CorrelatorDataEventArgs(_dataModel.LeftNoiseSumValue,
- _dataModel.RightNoiseSumValue);
+ var eventArgs = new CorrelatorDataEventArgs(
+ _dataModel.LeftNoiseSumValue, _dataModel.LeftDeviceDataArray,
+ _dataModel.RightNoiseSumValue, _dataModel.RightDeviceDataArray
+ );
DetectNoiseEvent?.Invoke(this, eventArgs);
}
else
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml b/Correlator/Dialog/DetectNoiseDialog.xaml
index e2226c3..0b9d5ad 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml
@@ -7,8 +7,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
xmlns:vm="clr-namespace:Correlator.ViewModels"
- Width="600"
- Height="300"
+ Width="800"
+ Height="635"
d:DataContext="{d:DesignInstance Type=vm:DetectNoiseDialogViewModel}"
Background="White"
mc:Ignorable="d">
@@ -33,60 +33,68 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
-
+
-
+
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
-
+
-
+
+
+
+
+
+
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml.cs b/Correlator/Dialog/DetectNoiseDialog.xaml.cs
index 138f787..c4042d1 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml.cs
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml.cs
@@ -1,12 +1,68 @@
-using System.Windows.Controls;
+using System.Drawing;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using Correlator.DataService;
+using Correlator.Events;
namespace Correlator.Dialog
{
public partial class DetectNoiseDialog : UserControl
{
- public DetectNoiseDialog()
+ public DetectNoiseDialog(ISerialPortService serialPortService)
{
InitializeComponent();
+
+ serialPortService.DetectNoiseEvent += Handle_DetectNoise;
+
+ //禁用XY缩放
+ RedScottplotView.Configuration.LockHorizontalAxis = true;
+ RedScottplotView.Configuration.LockVerticalAxis = true;
+ RedScottplotView.Configuration.ScrollWheelZoom = false;
+ RedScottplotView.Configuration.RightClickDragZoom = false;
+ //去掉网格线
+ RedScottplotView.Plot.Grid(false);
+ //四周边距
+ RedScottplotView.Plot.XAxis.Layout(-5);
+ RedScottplotView.Plot.YAxis.Layout(-5);
+
+ // ######################################################################################
+
+ //禁用XY缩放
+ BlueScottplotView.Configuration.LockHorizontalAxis = true;
+ BlueScottplotView.Configuration.LockVerticalAxis = true;
+ BlueScottplotView.Configuration.ScrollWheelZoom = false;
+ BlueScottplotView.Configuration.RightClickDragZoom = false;
+ //去掉网格线
+ BlueScottplotView.Plot.Grid(false);
+ //四周边距
+ BlueScottplotView.Plot.XAxis.Layout(-5);
+ BlueScottplotView.Plot.YAxis.Layout(-5);
+ }
+
+ private void Handle_DetectNoise(object sender, CorrelatorDataEventArgs args)
+ {
+ Application.Current.Dispatcher.Invoke(delegate
+ {
+ RedScottplotView.Plot.Clear();
+ RedScottplotView.Refresh();
+
+ var leftDeviceDataArray = args.LeftDeviceDataArray;
+ //渲染波形
+ RedScottplotView.Plot.SetAxisLimits(0, 3500, 0, leftDeviceDataArray.Max());
+ RedScottplotView.Plot.AddSignal(leftDeviceDataArray, color: Color.FromArgb(255, 49, 151, 36));
+ RedScottplotView.Plot.AxisAuto();
+ RedScottplotView.Refresh();
+
+ BlueScottplotView.Plot.Clear();
+ BlueScottplotView.Refresh();
+ var rightDeviceDataArray = args.RightDeviceDataArray;
+ //渲染波形
+ BlueScottplotView.Plot.SetAxisLimits(0, 3500, 0, rightDeviceDataArray.Max());
+ BlueScottplotView.Plot.AddSignal(rightDeviceDataArray, color: Color.FromArgb(255, 49, 151, 36));
+ BlueScottplotView.Plot.AxisAuto();
+ BlueScottplotView.Refresh();
+ });
}
}
}
\ No newline at end of file
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index f48caec..f1d0c21 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -234,8 +234,10 @@
{
if (RuntimeCache.IsDetectNoise)
{
- var eventArgs = new CorrelatorDataEventArgs(_dataModel.LeftNoiseSumValue,
- _dataModel.RightNoiseSumValue);
+ var eventArgs = new CorrelatorDataEventArgs(
+ _dataModel.LeftNoiseSumValue, _dataModel.LeftDeviceDataArray,
+ _dataModel.RightNoiseSumValue, _dataModel.RightDeviceDataArray
+ );
DetectNoiseEvent?.Invoke(this, eventArgs);
}
else
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml b/Correlator/Dialog/DetectNoiseDialog.xaml
index e2226c3..0b9d5ad 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml
@@ -7,8 +7,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
xmlns:vm="clr-namespace:Correlator.ViewModels"
- Width="600"
- Height="300"
+ Width="800"
+ Height="635"
d:DataContext="{d:DesignInstance Type=vm:DetectNoiseDialogViewModel}"
Background="White"
mc:Ignorable="d">
@@ -33,60 +33,68 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
-
+
-
+
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
-
+
-
+
+
+
+
+
+
diff --git a/Correlator/Dialog/DetectNoiseDialog.xaml.cs b/Correlator/Dialog/DetectNoiseDialog.xaml.cs
index 138f787..c4042d1 100644
--- a/Correlator/Dialog/DetectNoiseDialog.xaml.cs
+++ b/Correlator/Dialog/DetectNoiseDialog.xaml.cs
@@ -1,12 +1,68 @@
-using System.Windows.Controls;
+using System.Drawing;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using Correlator.DataService;
+using Correlator.Events;
namespace Correlator.Dialog
{
public partial class DetectNoiseDialog : UserControl
{
- public DetectNoiseDialog()
+ public DetectNoiseDialog(ISerialPortService serialPortService)
{
InitializeComponent();
+
+ serialPortService.DetectNoiseEvent += Handle_DetectNoise;
+
+ //禁用XY缩放
+ RedScottplotView.Configuration.LockHorizontalAxis = true;
+ RedScottplotView.Configuration.LockVerticalAxis = true;
+ RedScottplotView.Configuration.ScrollWheelZoom = false;
+ RedScottplotView.Configuration.RightClickDragZoom = false;
+ //去掉网格线
+ RedScottplotView.Plot.Grid(false);
+ //四周边距
+ RedScottplotView.Plot.XAxis.Layout(-5);
+ RedScottplotView.Plot.YAxis.Layout(-5);
+
+ // ######################################################################################
+
+ //禁用XY缩放
+ BlueScottplotView.Configuration.LockHorizontalAxis = true;
+ BlueScottplotView.Configuration.LockVerticalAxis = true;
+ BlueScottplotView.Configuration.ScrollWheelZoom = false;
+ BlueScottplotView.Configuration.RightClickDragZoom = false;
+ //去掉网格线
+ BlueScottplotView.Plot.Grid(false);
+ //四周边距
+ BlueScottplotView.Plot.XAxis.Layout(-5);
+ BlueScottplotView.Plot.YAxis.Layout(-5);
+ }
+
+ private void Handle_DetectNoise(object sender, CorrelatorDataEventArgs args)
+ {
+ Application.Current.Dispatcher.Invoke(delegate
+ {
+ RedScottplotView.Plot.Clear();
+ RedScottplotView.Refresh();
+
+ var leftDeviceDataArray = args.LeftDeviceDataArray;
+ //渲染波形
+ RedScottplotView.Plot.SetAxisLimits(0, 3500, 0, leftDeviceDataArray.Max());
+ RedScottplotView.Plot.AddSignal(leftDeviceDataArray, color: Color.FromArgb(255, 49, 151, 36));
+ RedScottplotView.Plot.AxisAuto();
+ RedScottplotView.Refresh();
+
+ BlueScottplotView.Plot.Clear();
+ BlueScottplotView.Refresh();
+ var rightDeviceDataArray = args.RightDeviceDataArray;
+ //渲染波形
+ BlueScottplotView.Plot.SetAxisLimits(0, 3500, 0, rightDeviceDataArray.Max());
+ BlueScottplotView.Plot.AddSignal(rightDeviceDataArray, color: Color.FromArgb(255, 49, 151, 36));
+ BlueScottplotView.Plot.AxisAuto();
+ BlueScottplotView.Refresh();
+ });
}
}
}
\ No newline at end of file
diff --git a/Correlator/Events/CorrelatorDataEventArgs.cs b/Correlator/Events/CorrelatorDataEventArgs.cs
index 17e43d9..3f533f1 100644
--- a/Correlator/Events/CorrelatorDataEventArgs.cs
+++ b/Correlator/Events/CorrelatorDataEventArgs.cs
@@ -5,12 +5,17 @@
public class CorrelatorDataEventArgs : EventArgs
{
public double LeftNoiseSumValue { get; }
+ public double[] LeftDeviceDataArray { get; set; }
public double RightNoiseSumValue { get; }
+ public double[] RightDeviceDataArray { get; set; }
- public CorrelatorDataEventArgs(double leftNoiseSumValue, double rightNoiseSumValue)
+ public CorrelatorDataEventArgs(
+ double leftNoiseSumValue, double[] leftArray, double rightNoiseSumValue, double[] rightArray)
{
LeftNoiseSumValue = leftNoiseSumValue;
+ LeftDeviceDataArray = leftArray;
RightNoiseSumValue = rightNoiseSumValue;
+ RightDeviceDataArray = rightArray;
}
}
}
\ No newline at end of file