diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index 42d7d11..d3fa780 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -105,7 +105,6 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index 42d7d11..d3fa780 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -105,7 +105,6 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 2f891ca..2b94b22 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -265,12 +265,8 @@ - - - ApplicationLogView.xaml - NoiseWaveView.xaml @@ -357,7 +353,6 @@ Designer MSBuild:Compile - Designer diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index 42d7d11..d3fa780 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -105,7 +105,6 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 2f891ca..2b94b22 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -265,12 +265,8 @@ - - - ApplicationLogView.xaml - NoiseWaveView.xaml @@ -357,7 +353,6 @@ Designer MSBuild:Compile - Designer diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs deleted file mode 100644 index 2e5af80..0000000 --- a/Correlator/ViewModels/ApplicationLogViewModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.IO; -using Prism.Mvvm; -using Prism.Services.Dialogs; - -namespace Correlator.ViewModels -{ - public class ApplicationLogViewModel : BindableBase, IDialogAware - { - /// - /// 空实现 - /// - public event Action RequestClose - { - add { } - remove { } - } - - #region VM - - public string Title => "相关仪运行日志"; - - private string _contentText = string.Empty; - - public string ContentText - { - get => _contentText; - set - { - _contentText = value; - RaisePropertyChanged(); - } - } - - #endregion - - public bool CanCloseDialog() - { - return true; - } - - public void OnDialogClosed() - { - } - - public void OnDialogOpened(IDialogParameters parameters) - { - var logFullName = parameters.GetValue("LogFullName"); - ContentText = File.ReadAllText(logFullName); - } - } -} \ No newline at end of file diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index 42d7d11..d3fa780 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -105,7 +105,6 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 2f891ca..2b94b22 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -265,12 +265,8 @@ - - - ApplicationLogView.xaml - NoiseWaveView.xaml @@ -357,7 +353,6 @@ Designer MSBuild:Compile - Designer diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs deleted file mode 100644 index 2e5af80..0000000 --- a/Correlator/ViewModels/ApplicationLogViewModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.IO; -using Prism.Mvvm; -using Prism.Services.Dialogs; - -namespace Correlator.ViewModels -{ - public class ApplicationLogViewModel : BindableBase, IDialogAware - { - /// - /// 空实现 - /// - public event Action RequestClose - { - add { } - remove { } - } - - #region VM - - public string Title => "相关仪运行日志"; - - private string _contentText = string.Empty; - - public string ContentText - { - get => _contentText; - set - { - _contentText = value; - RaisePropertyChanged(); - } - } - - #endregion - - public bool CanCloseDialog() - { - return true; - } - - public void OnDialogClosed() - { - } - - public void OnDialogOpened(IDialogParameters parameters) - { - var logFullName = parameters.GetValue("LogFullName"); - ContentText = File.ReadAllText(logFullName); - } - } -} \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 82c630d..703b8aa 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Ports; @@ -101,7 +102,7 @@ public string CurrentTime { get => _currentTime; - private set + set { _currentTime = value; RaisePropertyChanged(); @@ -116,7 +117,7 @@ public int RedTransmitterSignal { get => _redTransmitterSignal; - private set + set { _redTransmitterSignal = value; RaisePropertyChanged(); @@ -131,7 +132,7 @@ public int BlueTransmitterSignal { get => _blueTransmitterSignal; - private set + set { _blueTransmitterSignal = value; RaisePropertyChanged(); @@ -146,7 +147,7 @@ public string InterferenceFrequency { get => _interferenceFrequency; - private set + set { _interferenceFrequency = value; RaisePropertyChanged(); @@ -161,7 +162,7 @@ public string Snr { get => _snr; - private set + set { _snr = value; RaisePropertyChanged(); @@ -176,7 +177,7 @@ public string FilterValue { get => _filterValue; - private set + set { _filterValue = value; RaisePropertyChanged(); @@ -191,7 +192,7 @@ public string SoundSpeed { get => _soundSpeed; - private set + set { _soundSpeed = value; RaisePropertyChanged(); @@ -206,7 +207,7 @@ public int SoundSampleRate { get => _soundSampleRate; - private set + set { _soundSampleRate = value; RaisePropertyChanged(); @@ -236,7 +237,7 @@ public bool BlueTransmitterState { get => _blueTransmitterState; - private set + set { _blueTransmitterState = value; RaisePropertyChanged(); @@ -251,7 +252,7 @@ public double RedTransmitterDistance { get => _redTransmitterDistance; - private set + set { _redTransmitterDistance = value; RaisePropertyChanged(); @@ -266,7 +267,7 @@ public double BlueTransmitterDistance { get => _blueTransmitterDistance; - private set + set { _blueTransmitterDistance = value; RaisePropertyChanged(); @@ -326,7 +327,7 @@ public string ElapseTime { get => _elapseTime; - private set + set { _elapseTime = value; RaisePropertyChanged(); @@ -338,7 +339,7 @@ public string ConnectColorBrush { get => _connectColorBrush; - private set + set { _connectColorBrush = value; RaisePropertyChanged(); @@ -393,18 +394,6 @@ } } - private string _frequencyInterval = "100 ~ 3000Hz"; - - public string FrequencyInterval - { - get => _frequencyInterval; - private set - { - _frequencyInterval = value; - RaisePropertyChanged(); - } - } - private string _lowFrequency = string.Empty; public string LowFrequency @@ -435,7 +424,7 @@ public bool StartButtonEnabled { get => _startButtonIsEnabled; - private set + set { _startButtonIsEnabled = value; RaisePropertyChanged(); @@ -621,17 +610,9 @@ { _mainWindow = window; "MainWindowViewModel".WriteLog("加载"); - window.AccelerationRadioButton.Checked += delegate - { - RuntimeCache.IsHydrophone = false; - FrequencyInterval = "100 ~ 3000Hz"; - }; + window.AccelerationRadioButton.Checked += delegate { RuntimeCache.IsHydrophone = false; }; - window.HydrophonesRadioButton.Checked += delegate - { - RuntimeCache.IsHydrophone = true; - FrequencyInterval = "10 ~ 300Hz"; - }; + window.HydrophonesRadioButton.Checked += delegate { RuntimeCache.IsHydrophone = true; }; } private void CloseWindow(MainWindow window) @@ -777,12 +758,7 @@ return; } - _dialogService.Show("ApplicationLogView", new DialogParameters - { - { "LogFullName", file.FullName } - }, - delegate { } - ); + Process.Start(file.FullName); popup.IsOpen = false; } catch (DirectoryNotFoundException e) @@ -1139,33 +1115,17 @@ var low = Convert.ToInt32(_lowFrequency); var high = Convert.ToInt32(_highFrequency); - //TODO 方便测试,去掉滤波区间限制 - // if (RuntimeCache.IsHydrophone) - // { - // if (low < 10 || low > 300 || high < 10 || high > 300 || low >= high) - // { - // MessageBox.Show("频段范围10 ~ 300Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); - // return false; - // } - // - // //缓存计算参数 - // _paramConfig = new ParamConfigModel - // { - // PipeMaterial = _materialName, - // PipeDiameter = _pipeDiameter, - // PipeLength = _pipeLength, - // MinFrequency = _lowFrequency, - // MaxFrequency = _highFrequency - // }; - // } - // else - // { - // if (low < 100 || low > 3000 || high < 100 || high > 3000 || low >= high) - // { - // MessageBox.Show("频段范围100 ~ 3000Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); - // return false; - // } - // } + if (low >= high) + { + MessageBox.Show("低频输入错误,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); + return false; + } + + if (high > _soundSampleRate >> 1) + { + MessageBox.Show("高频输入错误,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); + return false; + } //缓存计算参数 _paramConfig = new ParamConfigModel diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index 42d7d11..d3fa780 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -105,7 +105,6 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 2f891ca..2b94b22 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -265,12 +265,8 @@ - - - ApplicationLogView.xaml - NoiseWaveView.xaml @@ -357,7 +353,6 @@ Designer MSBuild:Compile - Designer diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs deleted file mode 100644 index 2e5af80..0000000 --- a/Correlator/ViewModels/ApplicationLogViewModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.IO; -using Prism.Mvvm; -using Prism.Services.Dialogs; - -namespace Correlator.ViewModels -{ - public class ApplicationLogViewModel : BindableBase, IDialogAware - { - /// - /// 空实现 - /// - public event Action RequestClose - { - add { } - remove { } - } - - #region VM - - public string Title => "相关仪运行日志"; - - private string _contentText = string.Empty; - - public string ContentText - { - get => _contentText; - set - { - _contentText = value; - RaisePropertyChanged(); - } - } - - #endregion - - public bool CanCloseDialog() - { - return true; - } - - public void OnDialogClosed() - { - } - - public void OnDialogOpened(IDialogParameters parameters) - { - var logFullName = parameters.GetValue("LogFullName"); - ContentText = File.ReadAllText(logFullName); - } - } -} \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 82c630d..703b8aa 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Ports; @@ -101,7 +102,7 @@ public string CurrentTime { get => _currentTime; - private set + set { _currentTime = value; RaisePropertyChanged(); @@ -116,7 +117,7 @@ public int RedTransmitterSignal { get => _redTransmitterSignal; - private set + set { _redTransmitterSignal = value; RaisePropertyChanged(); @@ -131,7 +132,7 @@ public int BlueTransmitterSignal { get => _blueTransmitterSignal; - private set + set { _blueTransmitterSignal = value; RaisePropertyChanged(); @@ -146,7 +147,7 @@ public string InterferenceFrequency { get => _interferenceFrequency; - private set + set { _interferenceFrequency = value; RaisePropertyChanged(); @@ -161,7 +162,7 @@ public string Snr { get => _snr; - private set + set { _snr = value; RaisePropertyChanged(); @@ -176,7 +177,7 @@ public string FilterValue { get => _filterValue; - private set + set { _filterValue = value; RaisePropertyChanged(); @@ -191,7 +192,7 @@ public string SoundSpeed { get => _soundSpeed; - private set + set { _soundSpeed = value; RaisePropertyChanged(); @@ -206,7 +207,7 @@ public int SoundSampleRate { get => _soundSampleRate; - private set + set { _soundSampleRate = value; RaisePropertyChanged(); @@ -236,7 +237,7 @@ public bool BlueTransmitterState { get => _blueTransmitterState; - private set + set { _blueTransmitterState = value; RaisePropertyChanged(); @@ -251,7 +252,7 @@ public double RedTransmitterDistance { get => _redTransmitterDistance; - private set + set { _redTransmitterDistance = value; RaisePropertyChanged(); @@ -266,7 +267,7 @@ public double BlueTransmitterDistance { get => _blueTransmitterDistance; - private set + set { _blueTransmitterDistance = value; RaisePropertyChanged(); @@ -326,7 +327,7 @@ public string ElapseTime { get => _elapseTime; - private set + set { _elapseTime = value; RaisePropertyChanged(); @@ -338,7 +339,7 @@ public string ConnectColorBrush { get => _connectColorBrush; - private set + set { _connectColorBrush = value; RaisePropertyChanged(); @@ -393,18 +394,6 @@ } } - private string _frequencyInterval = "100 ~ 3000Hz"; - - public string FrequencyInterval - { - get => _frequencyInterval; - private set - { - _frequencyInterval = value; - RaisePropertyChanged(); - } - } - private string _lowFrequency = string.Empty; public string LowFrequency @@ -435,7 +424,7 @@ public bool StartButtonEnabled { get => _startButtonIsEnabled; - private set + set { _startButtonIsEnabled = value; RaisePropertyChanged(); @@ -621,17 +610,9 @@ { _mainWindow = window; "MainWindowViewModel".WriteLog("加载"); - window.AccelerationRadioButton.Checked += delegate - { - RuntimeCache.IsHydrophone = false; - FrequencyInterval = "100 ~ 3000Hz"; - }; + window.AccelerationRadioButton.Checked += delegate { RuntimeCache.IsHydrophone = false; }; - window.HydrophonesRadioButton.Checked += delegate - { - RuntimeCache.IsHydrophone = true; - FrequencyInterval = "10 ~ 300Hz"; - }; + window.HydrophonesRadioButton.Checked += delegate { RuntimeCache.IsHydrophone = true; }; } private void CloseWindow(MainWindow window) @@ -777,12 +758,7 @@ return; } - _dialogService.Show("ApplicationLogView", new DialogParameters - { - { "LogFullName", file.FullName } - }, - delegate { } - ); + Process.Start(file.FullName); popup.IsOpen = false; } catch (DirectoryNotFoundException e) @@ -1139,33 +1115,17 @@ var low = Convert.ToInt32(_lowFrequency); var high = Convert.ToInt32(_highFrequency); - //TODO 方便测试,去掉滤波区间限制 - // if (RuntimeCache.IsHydrophone) - // { - // if (low < 10 || low > 300 || high < 10 || high > 300 || low >= high) - // { - // MessageBox.Show("频段范围10 ~ 300Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); - // return false; - // } - // - // //缓存计算参数 - // _paramConfig = new ParamConfigModel - // { - // PipeMaterial = _materialName, - // PipeDiameter = _pipeDiameter, - // PipeLength = _pipeLength, - // MinFrequency = _lowFrequency, - // MaxFrequency = _highFrequency - // }; - // } - // else - // { - // if (low < 100 || low > 3000 || high < 100 || high > 3000 || low >= high) - // { - // MessageBox.Show("频段范围100 ~ 3000Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); - // return false; - // } - // } + if (low >= high) + { + MessageBox.Show("低频输入错误,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); + return false; + } + + if (high > _soundSampleRate >> 1) + { + MessageBox.Show("高频输入错误,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); + return false; + } //缓存计算参数 _paramConfig = new ParamConfigModel diff --git a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs index 7196bbf..4bf6859 100644 --- a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs +++ b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs @@ -159,7 +159,7 @@ public void OnDialogOpened(IDialogParameters parameters) { - WorkMode = RuntimeCache.IsHydrophone ? "水听器模式(10~300Hz)" : "加速度计模式(100~3000Hz)"; + WorkMode = RuntimeCache.IsHydrophone ? "水听器模式" : "加速度计模式"; } } } \ No newline at end of file diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index 42d7d11..d3fa780 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -105,7 +105,6 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 2f891ca..2b94b22 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -265,12 +265,8 @@ - - - ApplicationLogView.xaml - NoiseWaveView.xaml @@ -357,7 +353,6 @@ Designer MSBuild:Compile - Designer diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs deleted file mode 100644 index 2e5af80..0000000 --- a/Correlator/ViewModels/ApplicationLogViewModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.IO; -using Prism.Mvvm; -using Prism.Services.Dialogs; - -namespace Correlator.ViewModels -{ - public class ApplicationLogViewModel : BindableBase, IDialogAware - { - /// - /// 空实现 - /// - public event Action RequestClose - { - add { } - remove { } - } - - #region VM - - public string Title => "相关仪运行日志"; - - private string _contentText = string.Empty; - - public string ContentText - { - get => _contentText; - set - { - _contentText = value; - RaisePropertyChanged(); - } - } - - #endregion - - public bool CanCloseDialog() - { - return true; - } - - public void OnDialogClosed() - { - } - - public void OnDialogOpened(IDialogParameters parameters) - { - var logFullName = parameters.GetValue("LogFullName"); - ContentText = File.ReadAllText(logFullName); - } - } -} \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 82c630d..703b8aa 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Ports; @@ -101,7 +102,7 @@ public string CurrentTime { get => _currentTime; - private set + set { _currentTime = value; RaisePropertyChanged(); @@ -116,7 +117,7 @@ public int RedTransmitterSignal { get => _redTransmitterSignal; - private set + set { _redTransmitterSignal = value; RaisePropertyChanged(); @@ -131,7 +132,7 @@ public int BlueTransmitterSignal { get => _blueTransmitterSignal; - private set + set { _blueTransmitterSignal = value; RaisePropertyChanged(); @@ -146,7 +147,7 @@ public string InterferenceFrequency { get => _interferenceFrequency; - private set + set { _interferenceFrequency = value; RaisePropertyChanged(); @@ -161,7 +162,7 @@ public string Snr { get => _snr; - private set + set { _snr = value; RaisePropertyChanged(); @@ -176,7 +177,7 @@ public string FilterValue { get => _filterValue; - private set + set { _filterValue = value; RaisePropertyChanged(); @@ -191,7 +192,7 @@ public string SoundSpeed { get => _soundSpeed; - private set + set { _soundSpeed = value; RaisePropertyChanged(); @@ -206,7 +207,7 @@ public int SoundSampleRate { get => _soundSampleRate; - private set + set { _soundSampleRate = value; RaisePropertyChanged(); @@ -236,7 +237,7 @@ public bool BlueTransmitterState { get => _blueTransmitterState; - private set + set { _blueTransmitterState = value; RaisePropertyChanged(); @@ -251,7 +252,7 @@ public double RedTransmitterDistance { get => _redTransmitterDistance; - private set + set { _redTransmitterDistance = value; RaisePropertyChanged(); @@ -266,7 +267,7 @@ public double BlueTransmitterDistance { get => _blueTransmitterDistance; - private set + set { _blueTransmitterDistance = value; RaisePropertyChanged(); @@ -326,7 +327,7 @@ public string ElapseTime { get => _elapseTime; - private set + set { _elapseTime = value; RaisePropertyChanged(); @@ -338,7 +339,7 @@ public string ConnectColorBrush { get => _connectColorBrush; - private set + set { _connectColorBrush = value; RaisePropertyChanged(); @@ -393,18 +394,6 @@ } } - private string _frequencyInterval = "100 ~ 3000Hz"; - - public string FrequencyInterval - { - get => _frequencyInterval; - private set - { - _frequencyInterval = value; - RaisePropertyChanged(); - } - } - private string _lowFrequency = string.Empty; public string LowFrequency @@ -435,7 +424,7 @@ public bool StartButtonEnabled { get => _startButtonIsEnabled; - private set + set { _startButtonIsEnabled = value; RaisePropertyChanged(); @@ -621,17 +610,9 @@ { _mainWindow = window; "MainWindowViewModel".WriteLog("加载"); - window.AccelerationRadioButton.Checked += delegate - { - RuntimeCache.IsHydrophone = false; - FrequencyInterval = "100 ~ 3000Hz"; - }; + window.AccelerationRadioButton.Checked += delegate { RuntimeCache.IsHydrophone = false; }; - window.HydrophonesRadioButton.Checked += delegate - { - RuntimeCache.IsHydrophone = true; - FrequencyInterval = "10 ~ 300Hz"; - }; + window.HydrophonesRadioButton.Checked += delegate { RuntimeCache.IsHydrophone = true; }; } private void CloseWindow(MainWindow window) @@ -777,12 +758,7 @@ return; } - _dialogService.Show("ApplicationLogView", new DialogParameters - { - { "LogFullName", file.FullName } - }, - delegate { } - ); + Process.Start(file.FullName); popup.IsOpen = false; } catch (DirectoryNotFoundException e) @@ -1139,33 +1115,17 @@ var low = Convert.ToInt32(_lowFrequency); var high = Convert.ToInt32(_highFrequency); - //TODO 方便测试,去掉滤波区间限制 - // if (RuntimeCache.IsHydrophone) - // { - // if (low < 10 || low > 300 || high < 10 || high > 300 || low >= high) - // { - // MessageBox.Show("频段范围10 ~ 300Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); - // return false; - // } - // - // //缓存计算参数 - // _paramConfig = new ParamConfigModel - // { - // PipeMaterial = _materialName, - // PipeDiameter = _pipeDiameter, - // PipeLength = _pipeLength, - // MinFrequency = _lowFrequency, - // MaxFrequency = _highFrequency - // }; - // } - // else - // { - // if (low < 100 || low > 3000 || high < 100 || high > 3000 || low >= high) - // { - // MessageBox.Show("频段范围100 ~ 3000Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); - // return false; - // } - // } + if (low >= high) + { + MessageBox.Show("低频输入错误,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); + return false; + } + + if (high > _soundSampleRate >> 1) + { + MessageBox.Show("高频输入错误,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); + return false; + } //缓存计算参数 _paramConfig = new ParamConfigModel diff --git a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs index 7196bbf..4bf6859 100644 --- a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs +++ b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs @@ -159,7 +159,7 @@ public void OnDialogOpened(IDialogParameters parameters) { - WorkMode = RuntimeCache.IsHydrophone ? "水听器模式(10~300Hz)" : "加速度计模式(100~3000Hz)"; + WorkMode = RuntimeCache.IsHydrophone ? "水听器模式" : "加速度计模式"; } } } \ No newline at end of file diff --git a/Correlator/Views/ApplicationLogView.xaml b/Correlator/Views/ApplicationLogView.xaml deleted file mode 100644 index a286d86..0000000 --- a/Correlator/Views/ApplicationLogView.xaml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index 42d7d11..d3fa780 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -105,7 +105,6 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 2f891ca..2b94b22 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -265,12 +265,8 @@ - - - ApplicationLogView.xaml - NoiseWaveView.xaml @@ -357,7 +353,6 @@ Designer MSBuild:Compile - Designer diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs deleted file mode 100644 index 2e5af80..0000000 --- a/Correlator/ViewModels/ApplicationLogViewModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.IO; -using Prism.Mvvm; -using Prism.Services.Dialogs; - -namespace Correlator.ViewModels -{ - public class ApplicationLogViewModel : BindableBase, IDialogAware - { - /// - /// 空实现 - /// - public event Action RequestClose - { - add { } - remove { } - } - - #region VM - - public string Title => "相关仪运行日志"; - - private string _contentText = string.Empty; - - public string ContentText - { - get => _contentText; - set - { - _contentText = value; - RaisePropertyChanged(); - } - } - - #endregion - - public bool CanCloseDialog() - { - return true; - } - - public void OnDialogClosed() - { - } - - public void OnDialogOpened(IDialogParameters parameters) - { - var logFullName = parameters.GetValue("LogFullName"); - ContentText = File.ReadAllText(logFullName); - } - } -} \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 82c630d..703b8aa 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Ports; @@ -101,7 +102,7 @@ public string CurrentTime { get => _currentTime; - private set + set { _currentTime = value; RaisePropertyChanged(); @@ -116,7 +117,7 @@ public int RedTransmitterSignal { get => _redTransmitterSignal; - private set + set { _redTransmitterSignal = value; RaisePropertyChanged(); @@ -131,7 +132,7 @@ public int BlueTransmitterSignal { get => _blueTransmitterSignal; - private set + set { _blueTransmitterSignal = value; RaisePropertyChanged(); @@ -146,7 +147,7 @@ public string InterferenceFrequency { get => _interferenceFrequency; - private set + set { _interferenceFrequency = value; RaisePropertyChanged(); @@ -161,7 +162,7 @@ public string Snr { get => _snr; - private set + set { _snr = value; RaisePropertyChanged(); @@ -176,7 +177,7 @@ public string FilterValue { get => _filterValue; - private set + set { _filterValue = value; RaisePropertyChanged(); @@ -191,7 +192,7 @@ public string SoundSpeed { get => _soundSpeed; - private set + set { _soundSpeed = value; RaisePropertyChanged(); @@ -206,7 +207,7 @@ public int SoundSampleRate { get => _soundSampleRate; - private set + set { _soundSampleRate = value; RaisePropertyChanged(); @@ -236,7 +237,7 @@ public bool BlueTransmitterState { get => _blueTransmitterState; - private set + set { _blueTransmitterState = value; RaisePropertyChanged(); @@ -251,7 +252,7 @@ public double RedTransmitterDistance { get => _redTransmitterDistance; - private set + set { _redTransmitterDistance = value; RaisePropertyChanged(); @@ -266,7 +267,7 @@ public double BlueTransmitterDistance { get => _blueTransmitterDistance; - private set + set { _blueTransmitterDistance = value; RaisePropertyChanged(); @@ -326,7 +327,7 @@ public string ElapseTime { get => _elapseTime; - private set + set { _elapseTime = value; RaisePropertyChanged(); @@ -338,7 +339,7 @@ public string ConnectColorBrush { get => _connectColorBrush; - private set + set { _connectColorBrush = value; RaisePropertyChanged(); @@ -393,18 +394,6 @@ } } - private string _frequencyInterval = "100 ~ 3000Hz"; - - public string FrequencyInterval - { - get => _frequencyInterval; - private set - { - _frequencyInterval = value; - RaisePropertyChanged(); - } - } - private string _lowFrequency = string.Empty; public string LowFrequency @@ -435,7 +424,7 @@ public bool StartButtonEnabled { get => _startButtonIsEnabled; - private set + set { _startButtonIsEnabled = value; RaisePropertyChanged(); @@ -621,17 +610,9 @@ { _mainWindow = window; "MainWindowViewModel".WriteLog("加载"); - window.AccelerationRadioButton.Checked += delegate - { - RuntimeCache.IsHydrophone = false; - FrequencyInterval = "100 ~ 3000Hz"; - }; + window.AccelerationRadioButton.Checked += delegate { RuntimeCache.IsHydrophone = false; }; - window.HydrophonesRadioButton.Checked += delegate - { - RuntimeCache.IsHydrophone = true; - FrequencyInterval = "10 ~ 300Hz"; - }; + window.HydrophonesRadioButton.Checked += delegate { RuntimeCache.IsHydrophone = true; }; } private void CloseWindow(MainWindow window) @@ -777,12 +758,7 @@ return; } - _dialogService.Show("ApplicationLogView", new DialogParameters - { - { "LogFullName", file.FullName } - }, - delegate { } - ); + Process.Start(file.FullName); popup.IsOpen = false; } catch (DirectoryNotFoundException e) @@ -1139,33 +1115,17 @@ var low = Convert.ToInt32(_lowFrequency); var high = Convert.ToInt32(_highFrequency); - //TODO 方便测试,去掉滤波区间限制 - // if (RuntimeCache.IsHydrophone) - // { - // if (low < 10 || low > 300 || high < 10 || high > 300 || low >= high) - // { - // MessageBox.Show("频段范围10 ~ 300Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); - // return false; - // } - // - // //缓存计算参数 - // _paramConfig = new ParamConfigModel - // { - // PipeMaterial = _materialName, - // PipeDiameter = _pipeDiameter, - // PipeLength = _pipeLength, - // MinFrequency = _lowFrequency, - // MaxFrequency = _highFrequency - // }; - // } - // else - // { - // if (low < 100 || low > 3000 || high < 100 || high > 3000 || low >= high) - // { - // MessageBox.Show("频段范围100 ~ 3000Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); - // return false; - // } - // } + if (low >= high) + { + MessageBox.Show("低频输入错误,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); + return false; + } + + if (high > _soundSampleRate >> 1) + { + MessageBox.Show("高频输入错误,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); + return false; + } //缓存计算参数 _paramConfig = new ParamConfigModel diff --git a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs index 7196bbf..4bf6859 100644 --- a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs +++ b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs @@ -159,7 +159,7 @@ public void OnDialogOpened(IDialogParameters parameters) { - WorkMode = RuntimeCache.IsHydrophone ? "水听器模式(10~300Hz)" : "加速度计模式(100~3000Hz)"; + WorkMode = RuntimeCache.IsHydrophone ? "水听器模式" : "加速度计模式"; } } } \ No newline at end of file diff --git a/Correlator/Views/ApplicationLogView.xaml b/Correlator/Views/ApplicationLogView.xaml deleted file mode 100644 index a286d86..0000000 --- a/Correlator/Views/ApplicationLogView.xaml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - diff --git a/Correlator/Views/ApplicationLogView.xaml.cs b/Correlator/Views/ApplicationLogView.xaml.cs deleted file mode 100644 index c23b9d9..0000000 --- a/Correlator/Views/ApplicationLogView.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Windows.Controls; - -namespace Correlator.Views -{ - public partial class ApplicationLogView : UserControl - { - public ApplicationLogView() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/Correlator/App.xaml.cs b/Correlator/App.xaml.cs index 42d7d11..d3fa780 100644 --- a/Correlator/App.xaml.cs +++ b/Correlator/App.xaml.cs @@ -105,7 +105,6 @@ containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); - containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); containerRegistry.RegisterDialog(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 2f891ca..2b94b22 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -265,12 +265,8 @@ - - - ApplicationLogView.xaml - NoiseWaveView.xaml @@ -357,7 +353,6 @@ Designer MSBuild:Compile - Designer diff --git a/Correlator/ViewModels/ApplicationLogViewModel.cs b/Correlator/ViewModels/ApplicationLogViewModel.cs deleted file mode 100644 index 2e5af80..0000000 --- a/Correlator/ViewModels/ApplicationLogViewModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.IO; -using Prism.Mvvm; -using Prism.Services.Dialogs; - -namespace Correlator.ViewModels -{ - public class ApplicationLogViewModel : BindableBase, IDialogAware - { - /// - /// 空实现 - /// - public event Action RequestClose - { - add { } - remove { } - } - - #region VM - - public string Title => "相关仪运行日志"; - - private string _contentText = string.Empty; - - public string ContentText - { - get => _contentText; - set - { - _contentText = value; - RaisePropertyChanged(); - } - } - - #endregion - - public bool CanCloseDialog() - { - return true; - } - - public void OnDialogClosed() - { - } - - public void OnDialogOpened(IDialogParameters parameters) - { - var logFullName = parameters.GetValue("LogFullName"); - ContentText = File.ReadAllText(logFullName); - } - } -} \ No newline at end of file diff --git a/Correlator/ViewModels/MainWindowViewModel.cs b/Correlator/ViewModels/MainWindowViewModel.cs index 82c630d..703b8aa 100644 --- a/Correlator/ViewModels/MainWindowViewModel.cs +++ b/Correlator/ViewModels/MainWindowViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Ports; @@ -101,7 +102,7 @@ public string CurrentTime { get => _currentTime; - private set + set { _currentTime = value; RaisePropertyChanged(); @@ -116,7 +117,7 @@ public int RedTransmitterSignal { get => _redTransmitterSignal; - private set + set { _redTransmitterSignal = value; RaisePropertyChanged(); @@ -131,7 +132,7 @@ public int BlueTransmitterSignal { get => _blueTransmitterSignal; - private set + set { _blueTransmitterSignal = value; RaisePropertyChanged(); @@ -146,7 +147,7 @@ public string InterferenceFrequency { get => _interferenceFrequency; - private set + set { _interferenceFrequency = value; RaisePropertyChanged(); @@ -161,7 +162,7 @@ public string Snr { get => _snr; - private set + set { _snr = value; RaisePropertyChanged(); @@ -176,7 +177,7 @@ public string FilterValue { get => _filterValue; - private set + set { _filterValue = value; RaisePropertyChanged(); @@ -191,7 +192,7 @@ public string SoundSpeed { get => _soundSpeed; - private set + set { _soundSpeed = value; RaisePropertyChanged(); @@ -206,7 +207,7 @@ public int SoundSampleRate { get => _soundSampleRate; - private set + set { _soundSampleRate = value; RaisePropertyChanged(); @@ -236,7 +237,7 @@ public bool BlueTransmitterState { get => _blueTransmitterState; - private set + set { _blueTransmitterState = value; RaisePropertyChanged(); @@ -251,7 +252,7 @@ public double RedTransmitterDistance { get => _redTransmitterDistance; - private set + set { _redTransmitterDistance = value; RaisePropertyChanged(); @@ -266,7 +267,7 @@ public double BlueTransmitterDistance { get => _blueTransmitterDistance; - private set + set { _blueTransmitterDistance = value; RaisePropertyChanged(); @@ -326,7 +327,7 @@ public string ElapseTime { get => _elapseTime; - private set + set { _elapseTime = value; RaisePropertyChanged(); @@ -338,7 +339,7 @@ public string ConnectColorBrush { get => _connectColorBrush; - private set + set { _connectColorBrush = value; RaisePropertyChanged(); @@ -393,18 +394,6 @@ } } - private string _frequencyInterval = "100 ~ 3000Hz"; - - public string FrequencyInterval - { - get => _frequencyInterval; - private set - { - _frequencyInterval = value; - RaisePropertyChanged(); - } - } - private string _lowFrequency = string.Empty; public string LowFrequency @@ -435,7 +424,7 @@ public bool StartButtonEnabled { get => _startButtonIsEnabled; - private set + set { _startButtonIsEnabled = value; RaisePropertyChanged(); @@ -621,17 +610,9 @@ { _mainWindow = window; "MainWindowViewModel".WriteLog("加载"); - window.AccelerationRadioButton.Checked += delegate - { - RuntimeCache.IsHydrophone = false; - FrequencyInterval = "100 ~ 3000Hz"; - }; + window.AccelerationRadioButton.Checked += delegate { RuntimeCache.IsHydrophone = false; }; - window.HydrophonesRadioButton.Checked += delegate - { - RuntimeCache.IsHydrophone = true; - FrequencyInterval = "10 ~ 300Hz"; - }; + window.HydrophonesRadioButton.Checked += delegate { RuntimeCache.IsHydrophone = true; }; } private void CloseWindow(MainWindow window) @@ -777,12 +758,7 @@ return; } - _dialogService.Show("ApplicationLogView", new DialogParameters - { - { "LogFullName", file.FullName } - }, - delegate { } - ); + Process.Start(file.FullName); popup.IsOpen = false; } catch (DirectoryNotFoundException e) @@ -1139,33 +1115,17 @@ var low = Convert.ToInt32(_lowFrequency); var high = Convert.ToInt32(_highFrequency); - //TODO 方便测试,去掉滤波区间限制 - // if (RuntimeCache.IsHydrophone) - // { - // if (low < 10 || low > 300 || high < 10 || high > 300 || low >= high) - // { - // MessageBox.Show("频段范围10 ~ 300Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); - // return false; - // } - // - // //缓存计算参数 - // _paramConfig = new ParamConfigModel - // { - // PipeMaterial = _materialName, - // PipeDiameter = _pipeDiameter, - // PipeLength = _pipeLength, - // MinFrequency = _lowFrequency, - // MaxFrequency = _highFrequency - // }; - // } - // else - // { - // if (low < 100 || low > 3000 || high < 100 || high > 3000 || low >= high) - // { - // MessageBox.Show("频段范围100 ~ 3000Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); - // return false; - // } - // } + if (low >= high) + { + MessageBox.Show("低频输入错误,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); + return false; + } + + if (high > _soundSampleRate >> 1) + { + MessageBox.Show("高频输入错误,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Stop); + return false; + } //缓存计算参数 _paramConfig = new ParamConfigModel diff --git a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs index 7196bbf..4bf6859 100644 --- a/Correlator/ViewModels/NumericKeypadDialogViewModel.cs +++ b/Correlator/ViewModels/NumericKeypadDialogViewModel.cs @@ -159,7 +159,7 @@ public void OnDialogOpened(IDialogParameters parameters) { - WorkMode = RuntimeCache.IsHydrophone ? "水听器模式(10~300Hz)" : "加速度计模式(100~3000Hz)"; + WorkMode = RuntimeCache.IsHydrophone ? "水听器模式" : "加速度计模式"; } } } \ No newline at end of file diff --git a/Correlator/Views/ApplicationLogView.xaml b/Correlator/Views/ApplicationLogView.xaml deleted file mode 100644 index a286d86..0000000 --- a/Correlator/Views/ApplicationLogView.xaml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - diff --git a/Correlator/Views/ApplicationLogView.xaml.cs b/Correlator/Views/ApplicationLogView.xaml.cs deleted file mode 100644 index c23b9d9..0000000 --- a/Correlator/Views/ApplicationLogView.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Windows.Controls; - -namespace Correlator.Views -{ - public partial class ApplicationLogView : UserControl - { - public ApplicationLogView() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/Correlator/Views/MainWindow.xaml b/Correlator/Views/MainWindow.xaml index 611299e..dd0a4d4 100644 --- a/Correlator/Views/MainWindow.xaml +++ b/Correlator/Views/MainWindow.xaml @@ -931,7 +931,6 @@ - @@ -1133,11 +1132,6 @@ FontSize="16" Foreground="{StaticResource MainThemeBrush}" Text="频段区间" /> - @@ -1259,9 +1253,10 @@ - + @@ -1367,8 +1362,6 @@ - -