diff --git a/Correlator/Model/ParamConfigModel.cs b/Correlator/Model/ParamConfigModel.cs index 67041fd..d43498e 100644 --- a/Correlator/Model/ParamConfigModel.cs +++ b/Correlator/Model/ParamConfigModel.cs @@ -1,7 +1,7 @@ namespace Correlator.Model { /// - /// 用户选择的管材等参数 + /// 用户选择的管材等参数(仅水听器模式) /// public class ParamConfigModel { @@ -21,11 +21,6 @@ public string PipeLength { get; set; } /// - /// 工作模式 - /// - public string WorkMode { get; set; } - - /// /// 低频 /// public string MinFrequency { get; set; } diff --git a/Correlator/Model/ParamConfigModel.cs b/Correlator/Model/ParamConfigModel.cs index 67041fd..d43498e 100644 --- a/Correlator/Model/ParamConfigModel.cs +++ b/Correlator/Model/ParamConfigModel.cs @@ -1,7 +1,7 @@ namespace Correlator.Model { /// - /// 用户选择的管材等参数 + /// 用户选择的管材等参数(仅水听器模式) /// public class ParamConfigModel { @@ -21,11 +21,6 @@ public string PipeLength { get; set; } /// - /// 工作模式 - /// - public string WorkMode { get; set; } - - /// /// 低频 /// public string MinFrequency { get; set; } diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs index cf5f936..6481428 100644 --- a/Correlator/Util/FlowStatus.cs +++ b/Correlator/Util/FlowStatus.cs @@ -9,47 +9,73 @@ /// public class FlowStatus { - //是否可以收集数据 + /// + /// 是否可以收集数据 + /// public static bool CanCollectData = false; - //红色传感器是否正常 + /// + /// 红色传感器是否正常 + /// public static bool RedSensorIsEnable = false; - //蓝色传感器是否正常 + /// + /// 蓝色传感器是否正常 + /// public static bool BlueSensorIsEnable = false; - //采集到的数据 + /// + /// 采集到的数据 + /// public static CorrelatorDataModel CorrelatorData; - //水听器模式 + /// + /// 水听器模式 + /// public static bool IsHydrophone = false; - //点名对话框是否已显示 + /// + /// 点名对话框是否已显示 + /// public static bool IsShowing = false; - //数据包index + /// + /// 数据包index + /// public static readonly List SeqCaches = new List(); - //水听器下发唤醒指令时间戳 + /// + /// 水听器下发唤醒指令时间戳 + /// public static byte[] HydrophoneWakeUpTimeBytes = new byte[6]; - //水听器红色信号接收器原始数据 + /// + /// 水听器红色信号接收器原始数据 + /// public static readonly Dictionary RedSensorOriginalResp = new Dictionary(); - //水听器红色信号接收器解析之后的Tags + /// + /// 水听器红色信号接收器解析之后的Tags + /// public static readonly Dictionary> RedSensorResponseTags = new Dictionary>(); - //水听器红色信号接收器原始数据 + /// + /// 水听器红色信号接收器原始数据 + /// public static readonly Dictionary BlueSensorOriginalResp = new Dictionary(); - //水听器蓝色信号接收器解析之后的Tags + /// + /// 水听器蓝色信号接收器解析之后的Tags + /// public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>(); //听音数据 public static readonly List RedSoundCaches = new List(); public static readonly List BlueSoundCaches = new List(); - - //正在听音的设备编号 + + /// + /// 正在听音的设备编号 + /// public static string CurrentListenSoundDevCode = DevCode.Dev1; } } \ No newline at end of file diff --git a/Correlator/Model/ParamConfigModel.cs b/Correlator/Model/ParamConfigModel.cs index 67041fd..d43498e 100644 --- a/Correlator/Model/ParamConfigModel.cs +++ b/Correlator/Model/ParamConfigModel.cs @@ -1,7 +1,7 @@ namespace Correlator.Model { /// - /// 用户选择的管材等参数 + /// 用户选择的管材等参数(仅水听器模式) /// public class ParamConfigModel { @@ -21,11 +21,6 @@ public string PipeLength { get; set; } /// - /// 工作模式 - /// - public string WorkMode { get; set; } - - /// /// 低频 /// public string MinFrequency { get; set; } diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs index cf5f936..6481428 100644 --- a/Correlator/Util/FlowStatus.cs +++ b/Correlator/Util/FlowStatus.cs @@ -9,47 +9,73 @@ /// public class FlowStatus { - //是否可以收集数据 + /// + /// 是否可以收集数据 + /// public static bool CanCollectData = false; - //红色传感器是否正常 + /// + /// 红色传感器是否正常 + /// public static bool RedSensorIsEnable = false; - //蓝色传感器是否正常 + /// + /// 蓝色传感器是否正常 + /// public static bool BlueSensorIsEnable = false; - //采集到的数据 + /// + /// 采集到的数据 + /// public static CorrelatorDataModel CorrelatorData; - //水听器模式 + /// + /// 水听器模式 + /// public static bool IsHydrophone = false; - //点名对话框是否已显示 + /// + /// 点名对话框是否已显示 + /// public static bool IsShowing = false; - //数据包index + /// + /// 数据包index + /// public static readonly List SeqCaches = new List(); - //水听器下发唤醒指令时间戳 + /// + /// 水听器下发唤醒指令时间戳 + /// public static byte[] HydrophoneWakeUpTimeBytes = new byte[6]; - //水听器红色信号接收器原始数据 + /// + /// 水听器红色信号接收器原始数据 + /// public static readonly Dictionary RedSensorOriginalResp = new Dictionary(); - //水听器红色信号接收器解析之后的Tags + /// + /// 水听器红色信号接收器解析之后的Tags + /// public static readonly Dictionary> RedSensorResponseTags = new Dictionary>(); - //水听器红色信号接收器原始数据 + /// + /// 水听器红色信号接收器原始数据 + /// public static readonly Dictionary BlueSensorOriginalResp = new Dictionary(); - //水听器蓝色信号接收器解析之后的Tags + /// + /// 水听器蓝色信号接收器解析之后的Tags + /// public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>(); //听音数据 public static readonly List RedSoundCaches = new List(); public static readonly List BlueSoundCaches = new List(); - - //正在听音的设备编号 + + /// + /// 正在听音的设备编号 + /// public static string CurrentListenSoundDevCode = DevCode.Dev1; } } \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 539a18c..145a3e2 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -614,10 +614,13 @@ _eventAggregator.GetEvent().Publish(array); var time = DateTime.Now.ToString("HHmmss"); - //保存参数 - var paramConfigFileName = $"{_locateDataDir}\\参数配置.{_locateTimes}.{time}.json"; - File.AppendAllText(paramConfigFileName, JsonConvert.SerializeObject(_paramConfig)); - + if (FlowStatus.IsHydrophone) + { + //保存参数 + var paramConfigFile = $"{_locateDataDir}\\参数配置.{_locateTimes}.{time}.json"; + File.AppendAllText(paramConfigFile, JsonConvert.SerializeObject(_paramConfig)); + } + //保存数据 var fileName = $"{_locateDataDir}\\测试数据.{_locateTimes}.{time}.txt"; fileName.SaveLocateData(dataModel); @@ -823,17 +826,24 @@ //导入数据 ImportDataCommand = new DelegateCommand(delegate { - _dialogService.ShowDialog("ImportResponseDialog", null, delegate(IDialogResult result) + if (FlowStatus.IsHydrophone) { - if (result.Result == ButtonResult.Cancel) + _dialogService.ShowDialog("ImportResponseDialog", null, delegate(IDialogResult result) { - MessageBox.Show("取消导入数据", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Information); - return; - } + if (result.Result == ButtonResult.Cancel) + { + MessageBox.Show("取消导入数据", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Information); + return; + } - //导入数据完成,可以计算数据 - StartCalculateData(); - }); + //导入数据完成,可以计算数据 + StartCalculateData(); + }); + } + else + { + MessageBox.Show("只能在水听器模式导入数据", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + } }); //管道材料选择 @@ -990,19 +1000,26 @@ var low = Convert.ToInt32(_lowFrequency); var high = Convert.ToInt32(_highFrequency); - string workMode; if (FlowStatus.IsHydrophone) { - workMode = "水听器模式"; if (low < 10 || low > 300 || high < 10 || high > 300 || low >= high) { MessageBox.Show("频段范围10 ~ 300Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); return false; } + + //缓存计算参数 + _paramConfig = new ParamConfigModel + { + PipeMaterial = _materialName, + PipeDiameter = _pipeDiameter, + PipeLength = _pipeLength, + MinFrequency = _lowFrequency, + MaxFrequency = _highFrequency + }; } else { - workMode = "加速度计模式"; if (low < 100 || low > 3000 || high < 100 || high > 3000 || low >= high) { MessageBox.Show("频段范围100 ~ 3000Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); @@ -1014,17 +1031,6 @@ //声速 var soundVelocity = _soundSpeedDataService.GetSoundVelocity(_materialName, Convert.ToInt32(_pipeDiameter)); SoundSpeed = soundVelocity.ToString(); - - //缓存计算参数 - _paramConfig = new ParamConfigModel - { - PipeMaterial = _materialName, - PipeDiameter = _pipeDiameter, - PipeLength = _pipeLength, - WorkMode = workMode, - MinFrequency = _lowFrequency, - MaxFrequency = _highFrequency - }; return true; } }