diff --git a/Correlator/App.xaml b/Correlator/App.xaml index e655880..9efeee8 100644 --- a/Correlator/App.xaml +++ b/Correlator/App.xaml @@ -18,6 +18,7 @@ + diff --git a/Correlator/App.xaml b/Correlator/App.xaml index e655880..9efeee8 100644 --- a/Correlator/App.xaml +++ b/Correlator/App.xaml @@ -18,6 +18,7 @@ + diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index e340ccd..a33ee5d 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -324,6 +324,7 @@ Designer MSBuild:Compile + Designer MSBuild:Compile diff --git a/Correlator/App.xaml b/Correlator/App.xaml index e655880..9efeee8 100644 --- a/Correlator/App.xaml +++ b/Correlator/App.xaml @@ -18,6 +18,7 @@ + diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index e340ccd..a33ee5d 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -324,6 +324,7 @@ Designer MSBuild:Compile + Designer MSBuild:Compile diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index 8acf006..1a81bb0 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -59,7 +59,6 @@ Margin="0,0,20,0" VerticalAlignment="Center" FontSize="18" - FontWeight="Bold" Text="{Binding Title}" /> diff --git a/Correlator/App.xaml b/Correlator/App.xaml index e655880..9efeee8 100644 --- a/Correlator/App.xaml +++ b/Correlator/App.xaml @@ -18,6 +18,7 @@ + diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index e340ccd..a33ee5d 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -324,6 +324,7 @@ Designer MSBuild:Compile + Designer MSBuild:Compile diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index 8acf006..1a81bb0 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -59,7 +59,6 @@ Margin="0,0,20,0" VerticalAlignment="Center" FontSize="18" - FontWeight="Bold" Text="{Binding Title}" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index cde5250..5d75932 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -59,7 +59,6 @@ Margin="0,0,20,0" VerticalAlignment="Center" FontSize="18" - FontWeight="Bold" Text="{Binding Title}" /> diff --git a/Correlator/App.xaml b/Correlator/App.xaml index e655880..9efeee8 100644 --- a/Correlator/App.xaml +++ b/Correlator/App.xaml @@ -18,6 +18,7 @@ + diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index e340ccd..a33ee5d 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -324,6 +324,7 @@ Designer MSBuild:Compile + Designer MSBuild:Compile diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index 8acf006..1a81bb0 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -59,7 +59,6 @@ Margin="0,0,20,0" VerticalAlignment="Center" FontSize="18" - FontWeight="Bold" Text="{Binding Title}" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index cde5250..5d75932 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -59,7 +59,6 @@ Margin="0,0,20,0" VerticalAlignment="Center" FontSize="18" - FontWeight="Bold" Text="{Binding Title}" /> diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index 5da4e1e..cf89d9b 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/App.xaml b/Correlator/App.xaml index e655880..9efeee8 100644 --- a/Correlator/App.xaml +++ b/Correlator/App.xaml @@ -18,6 +18,7 @@ + diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index e340ccd..a33ee5d 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -324,6 +324,7 @@ Designer MSBuild:Compile + Designer MSBuild:Compile diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index 8acf006..1a81bb0 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -59,7 +59,6 @@ Margin="0,0,20,0" VerticalAlignment="Center" FontSize="18" - FontWeight="Bold" Text="{Binding Title}" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index cde5250..5d75932 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -59,7 +59,6 @@ Margin="0,0,20,0" VerticalAlignment="Center" FontSize="18" - FontWeight="Bold" Text="{Binding Title}" /> diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index 5da4e1e..cf89d9b 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Style/MainMenuButtonStyle.xaml b/Correlator/Style/MainMenuButtonStyle.xaml new file mode 100644 index 0000000..5109055 --- /dev/null +++ b/Correlator/Style/MainMenuButtonStyle.xaml @@ -0,0 +1,31 @@ + + + \ No newline at end of file diff --git a/Correlator/App.xaml b/Correlator/App.xaml index e655880..9efeee8 100644 --- a/Correlator/App.xaml +++ b/Correlator/App.xaml @@ -18,6 +18,7 @@ + diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index e340ccd..a33ee5d 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -324,6 +324,7 @@ Designer MSBuild:Compile + Designer MSBuild:Compile diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index 8acf006..1a81bb0 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -59,7 +59,6 @@ Margin="0,0,20,0" VerticalAlignment="Center" FontSize="18" - FontWeight="Bold" Text="{Binding Title}" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index cde5250..5d75932 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -59,7 +59,6 @@ Margin="0,0,20,0" VerticalAlignment="Center" FontSize="18" - FontWeight="Bold" Text="{Binding Title}" /> diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index 5da4e1e..cf89d9b 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Style/MainMenuButtonStyle.xaml b/Correlator/Style/MainMenuButtonStyle.xaml new file mode 100644 index 0000000..5109055 --- /dev/null +++ b/Correlator/Style/MainMenuButtonStyle.xaml @@ -0,0 +1,31 @@ + + + \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 5df53e7..50ec02b 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -460,6 +460,7 @@ public DelegateCommand OpenListenAudioCommand { private set; get; } public DelegateCommand OpenNumericKeypadCommand { private set; get; } public DelegateCommand PipeItemSelectedCommand { set; get; } + public DelegateCommand DetectNoiseCommand { private set; get; } public DelegateCommand SoundSettingsCommand { private set; get; } public DelegateCommand ImportDataCommand { private set; get; } public DelegateCommand SaveAudioCommand { private set; get; } @@ -533,27 +534,13 @@ { if (result.Result == ButtonResult.Cancel) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "数据未校验,无法进行计算" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "数据未校验,无法进行计算"); return; } if (result.Result == ButtonResult.Abort) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "数据校验被终止,无法进行计算" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "数据校验被终止,无法进行计算"); return; } @@ -762,16 +749,7 @@ if (_runningSeconds >= 120) { _runningTimer.Stop(); - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, - { "Title", "温馨提示" }, - { "Message", "接收不到数据,请点击复位并重新开始采集数据" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "接收不到数据,请点击复位并重新开始采集数据"); } }; @@ -864,39 +842,31 @@ { if (!_serialPortService.Sp.IsOpen) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "串口状态异常,无法操作" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Error, "操作错误", "串口状态异常,无法打开听音功能"); return; } _dialogService.Show("SimplyAuditionDialog", null, delegate { }); }); + //噪声探测 + DetectNoiseCommand = new DelegateCommand(delegate { }); + //声速设置 SoundSettingsCommand = new DelegateCommand(delegate { if (string.IsNullOrEmpty(_materialName)) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "请选择管道材料" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "请选择管道材料"); return; } - _dialogService.Show("SoundSpeedDialog", - new DialogParameters { { "MaterialName", _materialName } }, - delegate { }); + _dialogService.Show("SoundSpeedDialog", new DialogParameters + { + { "MaterialName", _materialName } + }, + delegate { } + ); }); //导入数据 @@ -908,14 +878,7 @@ { if (result.Result == ButtonResult.Cancel) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "用户取消导入数据" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "用户取消导入数据"); return; } @@ -942,14 +905,7 @@ } else { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "仅支持水听器模式导入数据" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Error, "操作错误", "仅支持水听器模式导入数据"); } }); @@ -982,14 +938,7 @@ } else { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "还未开始采集数据,无法保存音频" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Error, "操作错误", "还未开始采集数据,无法保存音频"); } }); @@ -1012,14 +961,7 @@ { if (!_serialPortService.Sp.IsOpen) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "串口状态异常,无法操作" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "串口状态异常,无法操作"); return; } @@ -1071,6 +1013,7 @@ RedTransmitterDistance = 0; ElapseTime = "0"; BlueTransmitterDistance = 0; + CorrelatorData = new CorrelatorDataModel(); _runningSeconds = 0; _runningTimer.Stop(); @@ -1093,53 +1036,25 @@ { if (string.IsNullOrEmpty(_materialName)) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "请选择管道材料" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "请选择管道材料"); return false; } if (string.IsNullOrEmpty(_pipeDiameter)) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "请输入管道直径" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "请输入管道直径"); return false; } if (string.IsNullOrEmpty(_pipeLength)) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "请输入管道长度" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "请输入管道长度"); return false; } if (string.IsNullOrEmpty(_lowFrequency) || string.IsNullOrEmpty(_highFrequency)) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "请输入完整的干扰频段" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "请输入完整的计算频段"); return false; } @@ -1150,15 +1065,7 @@ { if (low < 10 || low > 300 || high < 10 || high > 300 || low >= high) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, - { "Message", "频段范围10 ~ 300Hz,请重新输入" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "频段范围10 ~ 300Hz,请重新输入"); return false; } @@ -1176,15 +1083,7 @@ { if (low < 100 || low > 3000 || high < 100 || high > 3000 || low >= high) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, - { "Message", "频段范围100 ~ 3000Hz,请重新输入" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "频段范围100 ~ 3000Hz,请重新输入"); return false; } } @@ -1233,5 +1132,18 @@ } }); } + + /// + /// 显示普通提示对话框 + /// + private void ShowAlertMessageDialog(AlertType type, string title, string message) + { + _dialogService.ShowDialog("AlertMessageDialog", new DialogParameters + { + { "AlertType", type }, { "Title", title }, { "Message", message } + }, + delegate { } + ); + } } } \ No newline at end of file diff --git a/Correlator/App.xaml b/Correlator/App.xaml index e655880..9efeee8 100644 --- a/Correlator/App.xaml +++ b/Correlator/App.xaml @@ -18,6 +18,7 @@ + diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index e340ccd..a33ee5d 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -324,6 +324,7 @@ Designer MSBuild:Compile + Designer MSBuild:Compile diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index 8acf006..1a81bb0 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -59,7 +59,6 @@ Margin="0,0,20,0" VerticalAlignment="Center" FontSize="18" - FontWeight="Bold" Text="{Binding Title}" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index cde5250..5d75932 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -59,7 +59,6 @@ Margin="0,0,20,0" VerticalAlignment="Center" FontSize="18" - FontWeight="Bold" Text="{Binding Title}" /> diff --git a/Correlator/Fonts/iconfont.ttf b/Correlator/Fonts/iconfont.ttf index 5da4e1e..cf89d9b 100644 --- a/Correlator/Fonts/iconfont.ttf +++ b/Correlator/Fonts/iconfont.ttf Binary files differ diff --git a/Correlator/Style/MainMenuButtonStyle.xaml b/Correlator/Style/MainMenuButtonStyle.xaml new file mode 100644 index 0000000..5109055 --- /dev/null +++ b/Correlator/Style/MainMenuButtonStyle.xaml @@ -0,0 +1,31 @@ + + + \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 5df53e7..50ec02b 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -460,6 +460,7 @@ public DelegateCommand OpenListenAudioCommand { private set; get; } public DelegateCommand OpenNumericKeypadCommand { private set; get; } public DelegateCommand PipeItemSelectedCommand { set; get; } + public DelegateCommand DetectNoiseCommand { private set; get; } public DelegateCommand SoundSettingsCommand { private set; get; } public DelegateCommand ImportDataCommand { private set; get; } public DelegateCommand SaveAudioCommand { private set; get; } @@ -533,27 +534,13 @@ { if (result.Result == ButtonResult.Cancel) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "数据未校验,无法进行计算" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "数据未校验,无法进行计算"); return; } if (result.Result == ButtonResult.Abort) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "数据校验被终止,无法进行计算" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "数据校验被终止,无法进行计算"); return; } @@ -762,16 +749,7 @@ if (_runningSeconds >= 120) { _runningTimer.Stop(); - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, - { "Title", "温馨提示" }, - { "Message", "接收不到数据,请点击复位并重新开始采集数据" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "接收不到数据,请点击复位并重新开始采集数据"); } }; @@ -864,39 +842,31 @@ { if (!_serialPortService.Sp.IsOpen) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "串口状态异常,无法操作" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Error, "操作错误", "串口状态异常,无法打开听音功能"); return; } _dialogService.Show("SimplyAuditionDialog", null, delegate { }); }); + //噪声探测 + DetectNoiseCommand = new DelegateCommand(delegate { }); + //声速设置 SoundSettingsCommand = new DelegateCommand(delegate { if (string.IsNullOrEmpty(_materialName)) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "请选择管道材料" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "请选择管道材料"); return; } - _dialogService.Show("SoundSpeedDialog", - new DialogParameters { { "MaterialName", _materialName } }, - delegate { }); + _dialogService.Show("SoundSpeedDialog", new DialogParameters + { + { "MaterialName", _materialName } + }, + delegate { } + ); }); //导入数据 @@ -908,14 +878,7 @@ { if (result.Result == ButtonResult.Cancel) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "用户取消导入数据" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "用户取消导入数据"); return; } @@ -942,14 +905,7 @@ } else { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "仅支持水听器模式导入数据" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Error, "操作错误", "仅支持水听器模式导入数据"); } }); @@ -982,14 +938,7 @@ } else { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "还未开始采集数据,无法保存音频" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Error, "操作错误", "还未开始采集数据,无法保存音频"); } }); @@ -1012,14 +961,7 @@ { if (!_serialPortService.Sp.IsOpen) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "串口状态异常,无法操作" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "串口状态异常,无法操作"); return; } @@ -1071,6 +1013,7 @@ RedTransmitterDistance = 0; ElapseTime = "0"; BlueTransmitterDistance = 0; + CorrelatorData = new CorrelatorDataModel(); _runningSeconds = 0; _runningTimer.Stop(); @@ -1093,53 +1036,25 @@ { if (string.IsNullOrEmpty(_materialName)) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "请选择管道材料" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "请选择管道材料"); return false; } if (string.IsNullOrEmpty(_pipeDiameter)) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "请输入管道直径" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "请输入管道直径"); return false; } if (string.IsNullOrEmpty(_pipeLength)) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "请输入管道长度" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "请输入管道长度"); return false; } if (string.IsNullOrEmpty(_lowFrequency) || string.IsNullOrEmpty(_highFrequency)) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "请输入完整的干扰频段" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "请输入完整的计算频段"); return false; } @@ -1150,15 +1065,7 @@ { if (low < 10 || low > 300 || high < 10 || high > 300 || low >= high) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, - { "Message", "频段范围10 ~ 300Hz,请重新输入" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "频段范围10 ~ 300Hz,请重新输入"); return false; } @@ -1176,15 +1083,7 @@ { if (low < 100 || low > 3000 || high < 100 || high > 3000 || low >= high) { - _dialogService.ShowDialog( - "AlertMessageDialog", - new DialogParameters - { - { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, - { "Message", "频段范围100 ~ 3000Hz,请重新输入" } - }, - delegate { } - ); + ShowAlertMessageDialog(AlertType.Warning, "温馨提示", "频段范围100 ~ 3000Hz,请重新输入"); return false; } } @@ -1233,5 +1132,18 @@ } }); } + + /// + /// 显示普通提示对话框 + /// + private void ShowAlertMessageDialog(AlertType type, string title, string message) + { + _dialogService.ShowDialog("AlertMessageDialog", new DialogParameters + { + { "AlertType", type }, { "Title", title }, { "Message", message } + }, + delegate { } + ); + } } } \ No newline at end of file diff --git a/Correlator/Views/MainWindow.xaml b/Correlator/Views/MainWindow.xaml index b4fd61f..f8a9441 100644 --- a/Correlator/Views/MainWindow.xaml +++ b/Correlator/Views/MainWindow.xaml @@ -47,34 +47,9 @@ - - - - - + + + +