diff --git a/Correlator/Dialog/EditFilterDialog.xaml b/Correlator/Dialog/EditFilterDialog.xaml index aa429ac..304f2d0 100644 --- a/Correlator/Dialog/EditFilterDialog.xaml +++ b/Correlator/Dialog/EditFilterDialog.xaml @@ -76,12 +76,10 @@ - + - + VerticalAlignment="Center" + FontSize="14" + Foreground="#666666" + Text="{Binding FrequencyRange, StringFormat=频率范围:{0:C}}" /> + + - + - + VerticalAlignment="Center" + FontSize="14" + Foreground="#666666" + Text="{Binding FrequencyRange, StringFormat=频率范围:{0:C}}" /> + + - + diff --git a/Correlator/Dialog/EditFilterDialog.xaml b/Correlator/Dialog/EditFilterDialog.xaml index aa429ac..304f2d0 100644 --- a/Correlator/Dialog/EditFilterDialog.xaml +++ b/Correlator/Dialog/EditFilterDialog.xaml @@ -76,12 +76,10 @@ - + - + VerticalAlignment="Center" + FontSize="14" + Foreground="#666666" + Text="{Binding FrequencyRange, StringFormat=频率范围:{0:C}}" /> + + - + diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs index 461a5ea..7ca7fcc 100644 --- a/Correlator/Util/FlowStatus.cs +++ b/Correlator/Util/FlowStatus.cs @@ -45,5 +45,8 @@ //采集到的音频数据 public static CorrelatorDataModel CorrelatorData; + + //加速度模式、水听器模式 + public static bool IsAccelerometer = true; } } \ No newline at end of file diff --git a/Correlator/Dialog/EditFilterDialog.xaml b/Correlator/Dialog/EditFilterDialog.xaml index aa429ac..304f2d0 100644 --- a/Correlator/Dialog/EditFilterDialog.xaml +++ b/Correlator/Dialog/EditFilterDialog.xaml @@ -76,12 +76,10 @@ - + - + VerticalAlignment="Center" + FontSize="14" + Foreground="#666666" + Text="{Binding FrequencyRange, StringFormat=频率范围:{0:C}}" /> + + - + diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs index 461a5ea..7ca7fcc 100644 --- a/Correlator/Util/FlowStatus.cs +++ b/Correlator/Util/FlowStatus.cs @@ -45,5 +45,8 @@ //采集到的音频数据 public static CorrelatorDataModel CorrelatorData; + + //加速度模式、水听器模式 + public static bool IsAccelerometer = true; } } \ No newline at end of file diff --git a/Correlator/View/HomePageWindow.xaml b/Correlator/View/HomePageWindow.xaml index feff2cf..fba8c87 100644 --- a/Correlator/View/HomePageWindow.xaml +++ b/Correlator/View/HomePageWindow.xaml @@ -158,7 +158,8 @@ - + + @@ -466,12 +467,25 @@ - + + + + + + + - @@ -480,7 +494,7 @@ @@ -512,7 +526,7 @@ diff --git a/Correlator/Dialog/EditFilterDialog.xaml b/Correlator/Dialog/EditFilterDialog.xaml index aa429ac..304f2d0 100644 --- a/Correlator/Dialog/EditFilterDialog.xaml +++ b/Correlator/Dialog/EditFilterDialog.xaml @@ -76,12 +76,10 @@ - + - + VerticalAlignment="Center" + FontSize="14" + Foreground="#666666" + Text="{Binding FrequencyRange, StringFormat=频率范围:{0:C}}" /> + + - + diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs index 461a5ea..7ca7fcc 100644 --- a/Correlator/Util/FlowStatus.cs +++ b/Correlator/Util/FlowStatus.cs @@ -45,5 +45,8 @@ //采集到的音频数据 public static CorrelatorDataModel CorrelatorData; + + //加速度模式、水听器模式 + public static bool IsAccelerometer = true; } } \ No newline at end of file diff --git a/Correlator/View/HomePageWindow.xaml b/Correlator/View/HomePageWindow.xaml index feff2cf..fba8c87 100644 --- a/Correlator/View/HomePageWindow.xaml +++ b/Correlator/View/HomePageWindow.xaml @@ -158,7 +158,8 @@ - + + @@ -466,12 +467,25 @@ - + + + + + + + - @@ -480,7 +494,7 @@ @@ -512,7 +526,7 @@ diff --git a/Correlator/View/HomePageWindow.xaml.cs b/Correlator/View/HomePageWindow.xaml.cs index d5c91d0..5fa918f 100644 --- a/Correlator/View/HomePageWindow.xaml.cs +++ b/Correlator/View/HomePageWindow.xaml.cs @@ -51,6 +51,13 @@ ScottplotView.Refresh(); }); + AccelerometerButton.IsChecked = true; + AccelerometerButton.Checked += delegate { FlowStatus.IsAccelerometer = true; }; + AccelerometerButton.Unchecked += delegate { FlowStatus.IsAccelerometer = false; }; + + HydrophoneButton.Checked += delegate { FlowStatus.IsAccelerometer = false; }; + HydrophoneButton.Unchecked += delegate { FlowStatus.IsAccelerometer = false; }; + //频段过滤 // Messenger.Default.Register(this, MessengerToken.AddFilter, // s => { HomePageContentGrid.Children.Add(UserControlManager.UserControlMap["filterUserControl"]); }); diff --git a/Correlator/Dialog/EditFilterDialog.xaml b/Correlator/Dialog/EditFilterDialog.xaml index aa429ac..304f2d0 100644 --- a/Correlator/Dialog/EditFilterDialog.xaml +++ b/Correlator/Dialog/EditFilterDialog.xaml @@ -76,12 +76,10 @@ - + - + VerticalAlignment="Center" + FontSize="14" + Foreground="#666666" + Text="{Binding FrequencyRange, StringFormat=频率范围:{0:C}}" /> + + - + diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs index 461a5ea..7ca7fcc 100644 --- a/Correlator/Util/FlowStatus.cs +++ b/Correlator/Util/FlowStatus.cs @@ -45,5 +45,8 @@ //采集到的音频数据 public static CorrelatorDataModel CorrelatorData; + + //加速度模式、水听器模式 + public static bool IsAccelerometer = true; } } \ No newline at end of file diff --git a/Correlator/View/HomePageWindow.xaml b/Correlator/View/HomePageWindow.xaml index feff2cf..fba8c87 100644 --- a/Correlator/View/HomePageWindow.xaml +++ b/Correlator/View/HomePageWindow.xaml @@ -158,7 +158,8 @@ - + + @@ -466,12 +467,25 @@ - + + + + + + + - @@ -480,7 +494,7 @@ @@ -512,7 +526,7 @@ diff --git a/Correlator/View/HomePageWindow.xaml.cs b/Correlator/View/HomePageWindow.xaml.cs index d5c91d0..5fa918f 100644 --- a/Correlator/View/HomePageWindow.xaml.cs +++ b/Correlator/View/HomePageWindow.xaml.cs @@ -51,6 +51,13 @@ ScottplotView.Refresh(); }); + AccelerometerButton.IsChecked = true; + AccelerometerButton.Checked += delegate { FlowStatus.IsAccelerometer = true; }; + AccelerometerButton.Unchecked += delegate { FlowStatus.IsAccelerometer = false; }; + + HydrophoneButton.Checked += delegate { FlowStatus.IsAccelerometer = false; }; + HydrophoneButton.Unchecked += delegate { FlowStatus.IsAccelerometer = false; }; + //频段过滤 // Messenger.Default.Register(this, MessengerToken.AddFilter, // s => { HomePageContentGrid.Children.Add(UserControlManager.UserControlMap["filterUserControl"]); }); diff --git a/Correlator/ViewModel/EditFilterViewModel.cs b/Correlator/ViewModel/EditFilterViewModel.cs index ba98333..a3cf531 100644 --- a/Correlator/ViewModel/EditFilterViewModel.cs +++ b/Correlator/ViewModel/EditFilterViewModel.cs @@ -25,7 +25,7 @@ public string MaterialName { get => _materialName; - set + private set { _materialName = value; RaisePropertyChanged(() => MaterialName); @@ -37,7 +37,7 @@ public string PipeDiameter { get => _pipeDiameter; - set + private set { _pipeDiameter = value; RaisePropertyChanged(() => PipeDiameter); @@ -49,7 +49,7 @@ public string PipeLength { get => _pipeLength; - set + private set { _pipeLength = value; RaisePropertyChanged(() => PipeLength); @@ -80,11 +80,25 @@ } } + private string _frequencyRange; + + public string FrequencyRange + { + get => _frequencyRange; + set + { + _frequencyRange = value; + RaisePropertyChanged(() => FrequencyRange); + } + } + public EditFilterViewModel(ISoundSpeedDataService dataService) { _dataService = dataService; Messenger.Default.Register(this, MessengerToken.EditFilter, it => { + FrequencyRange = FlowStatus.IsAccelerometer ? "100Hz - 3000Hz" : "10Hz - 300Hz"; + MaterialName = it.ChineseMaterial; PipeDiameter = it.Diameter.ToString(CultureInfo.InvariantCulture); PipeLength = it.Length.ToString(CultureInfo.InvariantCulture); @@ -112,10 +126,21 @@ var low = Convert.ToInt32(_lowFrequency); var high = Convert.ToInt32(_highFrequency); - if (low < 100 || low > 3000 || high < 100 || high > 3000 || low >= high) + if (FlowStatus.IsAccelerometer) { - MessageBox.Show("频段范围100-3000Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; + if (low < 100 || low > 3000 || high < 100 || high > 3000 || low >= high) + { + MessageBox.Show("频段范围100-3000Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + return; + } + } + else + { + if (low < 10 || low > 300 || high < 10 || high > 300 || low >= high) + { + MessageBox.Show("频段范围10-300Hz,请重新输入", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + return; + } } //声速