diff --git a/Correlator/Dialog/LoadingDialog.xaml b/Correlator/Dialog/LoadingDialog.xaml index ec580ca..a3fba3b 100644 --- a/Correlator/Dialog/LoadingDialog.xaml +++ b/Correlator/Dialog/LoadingDialog.xaml @@ -12,7 +12,7 @@ WindowStyle="None" mc:Ignorable="d"> diff --git a/Correlator/Dialog/LoadingDialog.xaml b/Correlator/Dialog/LoadingDialog.xaml index ec580ca..a3fba3b 100644 --- a/Correlator/Dialog/LoadingDialog.xaml +++ b/Correlator/Dialog/LoadingDialog.xaml @@ -12,7 +12,7 @@ WindowStyle="None" mc:Ignorable="d"> diff --git a/Correlator/Util/SerialPortManager.cs b/Correlator/Util/SerialPortManager.cs index 0b5c5c0..ee73c36 100644 --- a/Correlator/Util/SerialPortManager.cs +++ b/Correlator/Util/SerialPortManager.cs @@ -39,7 +39,7 @@ private CorrelatorDataModel _dataModel = new CorrelatorDataModel(); /// - /// + /// 数据监听委托解注册 /// public void UnRegisterSerialPort() { diff --git a/Correlator/Dialog/LoadingDialog.xaml b/Correlator/Dialog/LoadingDialog.xaml index ec580ca..a3fba3b 100644 --- a/Correlator/Dialog/LoadingDialog.xaml +++ b/Correlator/Dialog/LoadingDialog.xaml @@ -12,7 +12,7 @@ WindowStyle="None" mc:Ignorable="d"> diff --git a/Correlator/Util/SerialPortManager.cs b/Correlator/Util/SerialPortManager.cs index 0b5c5c0..ee73c36 100644 --- a/Correlator/Util/SerialPortManager.cs +++ b/Correlator/Util/SerialPortManager.cs @@ -39,7 +39,7 @@ private CorrelatorDataModel _dataModel = new CorrelatorDataModel(); /// - /// + /// 数据监听委托解注册 /// public void UnRegisterSerialPort() { diff --git a/Correlator/ViewModel/HomePageViewModel.cs b/Correlator/ViewModel/HomePageViewModel.cs index 7306edd..0e2e8a2 100644 --- a/Correlator/ViewModel/HomePageViewModel.cs +++ b/Correlator/ViewModel/HomePageViewModel.cs @@ -1,7 +1,6 @@ using System; using System.Diagnostics; using System.Globalization; -using System.IO.Ports; using System.Linq; using System.Runtime.InteropServices; using System.Threading; @@ -479,37 +478,6 @@ _homePageWindow = it; }); - // FilterCommand = new RelayCommand(() => - // { - // if (!SerialPortManager.Instance.PortIsReady()) - // { - // MessageBox.Show("串口状态异常,无法操作", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - // return; - // } - // - // if (FlowStatus.SelectedMaterialModel == null || FlowStatus.CorrelatorData == null) - // { - // MessageBox.Show("还未采集数据,无法进行频段筛选", "错误", MessageBoxButton.OK, MessageBoxImage.Error); - // return; - // } - // - // var filterUserControl = new FilterUserControl(); - // UserControlManager.UserControlMap["filterUserControl"] = filterUserControl; - // Messenger.Default.Send("", MessengerToken.AddFilter); - // }); - // NoiseCommand = new RelayCommand(() => - // { - // if (!SerialPortManager.Instance.PortIsReady()) - // { - // MessageBox.Show("串口状态异常,无法操作", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - // return; - // } - // - // var noiseUserControl = new NoiseUserControl(); - // UserControlManager.UserControlMap["noiseUserControl"] = noiseUserControl; - // Messenger.Default.Send("", MessengerToken.AddNoise); - // }); - AudioCommand = new RelayCommand(delegate { if (!SerialPortManager.Get.Sp.IsOpen) @@ -541,7 +509,7 @@ StartCalculateCommand = new RelayCommand(delegate { - if (SerialPort.GetPortNames().Length == 0) + if (!SerialPortManager.Get.Sp.IsOpen) { MessageBox.Show("串口状态异常,无法操作", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); return; @@ -715,7 +683,6 @@ //计算 try { - DialogHub.Get.ShowLoadingDialog(_homePageWindow, "样品数据计算中,请稍后..."); var task = new Task(() => CalculateData(it)); task.Start(); @@ -731,7 +698,6 @@ if (task.Result) { - DialogHub.Get.DismissLoadingDialog(); _snapShotTimer.Start(); } @@ -753,22 +719,20 @@ /// private void ResetParam() { - if (FlowStatus.CanCollectData) - { - StartState = false; - FilterValue = "未设置"; - Snr = ""; - PipeLine = "未设置"; - SoundSpeed = "0"; - NoiseValue = "未设置"; - PassTime = "0"; - _runningSeconds = 0; - _runningTimer.Stop(); - TransmitterADistance = 0; - TransmitterBDistance = 0; - //清空波形图 - Messenger.Default.Send("", MessengerToken.ClearOscillogram); - } + StartState = false; + FlowStatus.CanCollectData = false; + FilterValue = "未设置"; + Snr = ""; + PipeLine = "未设置"; + SoundSpeed = "0"; + NoiseValue = "未设置"; + PassTime = "0"; + _runningSeconds = 0; + _runningTimer.Stop(); + TransmitterADistance = 0; + TransmitterBDistance = 0; + //清空波形图 + Messenger.Default.Send("", MessengerToken.ClearOscillogram); } /// @@ -856,6 +820,7 @@ /// 计算结果 private bool CalculateData(CorrelatorDataModel dataModel) { + DialogHub.Get.ShowLoadingDialog(_homePageWindow, "样品数据计算中,请稍后..."); var array = _correlator.locating(11, (MWNumericArray)dataModel.LeftDeviceDataArray, (MWNumericArray)dataModel.RightDeviceDataArray, Constant.SamplingRate, @@ -897,6 +862,7 @@ StartState = false; //开始计算就不收集收据了 FlowStatus.CanCollectData = false; + DialogHub.Get.DismissLoadingDialog(); return true; } }