diff --git a/Correlator/Converter/MultiBindingValueConverter.cs b/Correlator/Converter/MultiBindingValueConverter.cs new file mode 100644 index 0000000..d38105e --- /dev/null +++ b/Correlator/Converter/MultiBindingValueConverter.cs @@ -0,0 +1,26 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Correlator.Converter +{ + public class MultiBindingValueConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + return values[0] + ",管径:" + values[1] + "mm,管段长度:" + values[2] + "m"; + } + catch (Exception) + { + return null; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Correlator/Converter/MultiBindingValueConverter.cs b/Correlator/Converter/MultiBindingValueConverter.cs new file mode 100644 index 0000000..d38105e --- /dev/null +++ b/Correlator/Converter/MultiBindingValueConverter.cs @@ -0,0 +1,26 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Correlator.Converter +{ + public class MultiBindingValueConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + return values[0] + ",管径:" + values[1] + "mm,管段长度:" + values[2] + "m"; + } + catch (Exception) + { + return null; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 42d8da2..9ea28f6 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -174,6 +174,7 @@ + diff --git a/Correlator/Converter/MultiBindingValueConverter.cs b/Correlator/Converter/MultiBindingValueConverter.cs new file mode 100644 index 0000000..d38105e --- /dev/null +++ b/Correlator/Converter/MultiBindingValueConverter.cs @@ -0,0 +1,26 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Correlator.Converter +{ + public class MultiBindingValueConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + return values[0] + ",管径:" + values[1] + "mm,管段长度:" + values[2] + "m"; + } + catch (Exception) + { + return null; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 42d8da2..9ea28f6 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -174,6 +174,7 @@ + diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs index d7e43e5..8592462 100644 --- a/Correlator/Util/FlowStatus.cs +++ b/Correlator/Util/FlowStatus.cs @@ -17,16 +17,16 @@ public static bool CanCollectData = false; //红色传感器信号 - public static int SensorASignalIntensity = 0; + public static int RedSensorSignalIntensity = 0; //蓝色传感器信号 - public static int SensorBSignalIntensity = 0; + public static int BlueSensorSignalIntensity = 0; //红色传感器是否正常 - public static bool SensorAIsEnable = false; + public static bool RedSensorIsEnable = false; //蓝色传感器是否正常 - public static bool SensorBIsEnable = false; + public static bool BlueSensorIsEnable = false; //用户设置的管材 public static PipeMaterialModel SelectedMaterialModel; diff --git a/Correlator/Converter/MultiBindingValueConverter.cs b/Correlator/Converter/MultiBindingValueConverter.cs new file mode 100644 index 0000000..d38105e --- /dev/null +++ b/Correlator/Converter/MultiBindingValueConverter.cs @@ -0,0 +1,26 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Correlator.Converter +{ + public class MultiBindingValueConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + return values[0] + ",管径:" + values[1] + "mm,管段长度:" + values[2] + "m"; + } + catch (Exception) + { + return null; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 42d8da2..9ea28f6 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -174,6 +174,7 @@ + diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs index d7e43e5..8592462 100644 --- a/Correlator/Util/FlowStatus.cs +++ b/Correlator/Util/FlowStatus.cs @@ -17,16 +17,16 @@ public static bool CanCollectData = false; //红色传感器信号 - public static int SensorASignalIntensity = 0; + public static int RedSensorSignalIntensity = 0; //蓝色传感器信号 - public static int SensorBSignalIntensity = 0; + public static int BlueSensorSignalIntensity = 0; //红色传感器是否正常 - public static bool SensorAIsEnable = false; + public static bool RedSensorIsEnable = false; //蓝色传感器是否正常 - public static bool SensorBIsEnable = false; + public static bool BlueSensorIsEnable = false; //用户设置的管材 public static PipeMaterialModel SelectedMaterialModel; diff --git a/Correlator/View/HomePageProWindow.xaml b/Correlator/View/HomePageProWindow.xaml index 4387eb6..67fe0d5 100644 --- a/Correlator/View/HomePageProWindow.xaml +++ b/Correlator/View/HomePageProWindow.xaml @@ -33,6 +33,7 @@ + @@ -456,9 +457,8 @@ - - - + + + Foreground="{StaticResource MainThemeColor}"> + + + + + + + + - - - - - + - + + + + + + diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs index d7e43e5..8592462 100644 --- a/Correlator/Util/FlowStatus.cs +++ b/Correlator/Util/FlowStatus.cs @@ -17,16 +17,16 @@ public static bool CanCollectData = false; //红色传感器信号 - public static int SensorASignalIntensity = 0; + public static int RedSensorSignalIntensity = 0; //蓝色传感器信号 - public static int SensorBSignalIntensity = 0; + public static int BlueSensorSignalIntensity = 0; //红色传感器是否正常 - public static bool SensorAIsEnable = false; + public static bool RedSensorIsEnable = false; //蓝色传感器是否正常 - public static bool SensorBIsEnable = false; + public static bool BlueSensorIsEnable = false; //用户设置的管材 public static PipeMaterialModel SelectedMaterialModel; diff --git a/Correlator/View/HomePageProWindow.xaml b/Correlator/View/HomePageProWindow.xaml index 4387eb6..67fe0d5 100644 --- a/Correlator/View/HomePageProWindow.xaml +++ b/Correlator/View/HomePageProWindow.xaml @@ -33,6 +33,7 @@ + @@ -456,9 +457,8 @@ - - - + + + Foreground="{StaticResource MainThemeColor}"> + + + + + + + + - - - - - + - + + + + + + diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs index d7e43e5..8592462 100644 --- a/Correlator/Util/FlowStatus.cs +++ b/Correlator/Util/FlowStatus.cs @@ -17,16 +17,16 @@ public static bool CanCollectData = false; //红色传感器信号 - public static int SensorASignalIntensity = 0; + public static int RedSensorSignalIntensity = 0; //蓝色传感器信号 - public static int SensorBSignalIntensity = 0; + public static int BlueSensorSignalIntensity = 0; //红色传感器是否正常 - public static bool SensorAIsEnable = false; + public static bool RedSensorIsEnable = false; //蓝色传感器是否正常 - public static bool SensorBIsEnable = false; + public static bool BlueSensorIsEnable = false; //用户设置的管材 public static PipeMaterialModel SelectedMaterialModel; diff --git a/Correlator/View/HomePageProWindow.xaml b/Correlator/View/HomePageProWindow.xaml index 4387eb6..67fe0d5 100644 --- a/Correlator/View/HomePageProWindow.xaml +++ b/Correlator/View/HomePageProWindow.xaml @@ -33,6 +33,7 @@ + @@ -456,9 +457,8 @@ - - - + + + Foreground="{StaticResource MainThemeColor}"> + + + + + + + + - - - - - + - + + + + + - /// 绑定管道值 - /// - private string _pipeline = "无"; - - public string PipeLine - { - get => _pipeline; - private set - { - _pipeline = value; - RaisePropertyChanged(); - } - } - - /// /// 绑定声速值 /// private string _soundSpeed = "0"; @@ -305,7 +290,7 @@ } } - private string _pipeName; + private string _pipeName = string.Empty; public string PipeName { @@ -329,7 +314,7 @@ } } - private string _pipeDiameter; + private string _pipeDiameter = string.Empty; public string PipeDiameter { @@ -341,7 +326,7 @@ } } - private string _pipeLength; + private string _pipeLength = string.Empty; public string PipeLength { @@ -412,7 +397,7 @@ public HomePageProViewModel(IPipeMaterialDataService dataService) { RegisterMessage(); - + TimerTick(); _pipeMaterialsArray = new ObservableCollection(); @@ -442,8 +427,8 @@ var sensorStatus = dev.Status == "1"; RedTransmitterState = sensorStatus; //将信号A数据缓存到FlowStatus - FlowStatus.SensorASignalIntensity = signalIntensity; - FlowStatus.SensorAIsEnable = sensorStatus; + FlowStatus.RedSensorSignalIntensity = signalIntensity; + FlowStatus.RedSensorIsEnable = sensorStatus; }); Messenger.Default.Register(this, MessengerToken.BlueSensorStatus, dev => @@ -456,11 +441,11 @@ var sensorStatus = dev.Status == "1"; BlueTransmitterState = sensorStatus; //将信号B数据缓存到FlowStatus - FlowStatus.SensorBSignalIntensity = signalIntensity; - FlowStatus.SensorBIsEnable = sensorStatus; + FlowStatus.BlueSensorSignalIntensity = signalIntensity; + FlowStatus.BlueSensorIsEnable = sensorStatus; }); } - + /// /// 各种定时器 /// @@ -518,6 +503,7 @@ FlowStatus.IsHydrophone = false; FrequencyInterval = "100 ~ 3000Hz"; }; + it.HydrophonesRadioButton.Checked += delegate { FlowStatus.IsHydrophone = true; @@ -646,7 +632,9 @@ InterferenceFrequency = "无"; Snr = "无"; FilterValue = "无"; - PipeLine = "无"; + PipeName = string.Empty; + PipeDiameter = string.Empty; + PipeLength = string.Empty; SoundSpeed = "0"; RedTransmitterDistance = 0; ElapseTime = "0"; diff --git a/Correlator/Converter/MultiBindingValueConverter.cs b/Correlator/Converter/MultiBindingValueConverter.cs new file mode 100644 index 0000000..d38105e --- /dev/null +++ b/Correlator/Converter/MultiBindingValueConverter.cs @@ -0,0 +1,26 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Correlator.Converter +{ + public class MultiBindingValueConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + return values[0] + ",管径:" + values[1] + "mm,管段长度:" + values[2] + "m"; + } + catch (Exception) + { + return null; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 42d8da2..9ea28f6 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -174,6 +174,7 @@ + diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs index d7e43e5..8592462 100644 --- a/Correlator/Util/FlowStatus.cs +++ b/Correlator/Util/FlowStatus.cs @@ -17,16 +17,16 @@ public static bool CanCollectData = false; //红色传感器信号 - public static int SensorASignalIntensity = 0; + public static int RedSensorSignalIntensity = 0; //蓝色传感器信号 - public static int SensorBSignalIntensity = 0; + public static int BlueSensorSignalIntensity = 0; //红色传感器是否正常 - public static bool SensorAIsEnable = false; + public static bool RedSensorIsEnable = false; //蓝色传感器是否正常 - public static bool SensorBIsEnable = false; + public static bool BlueSensorIsEnable = false; //用户设置的管材 public static PipeMaterialModel SelectedMaterialModel; diff --git a/Correlator/View/HomePageProWindow.xaml b/Correlator/View/HomePageProWindow.xaml index 4387eb6..67fe0d5 100644 --- a/Correlator/View/HomePageProWindow.xaml +++ b/Correlator/View/HomePageProWindow.xaml @@ -33,6 +33,7 @@ + @@ -456,9 +457,8 @@ - - - + + + Foreground="{StaticResource MainThemeColor}"> + + + + + + + + - - - - - + - + + + + + - /// 绑定管道值 - /// - private string _pipeline = "无"; - - public string PipeLine - { - get => _pipeline; - private set - { - _pipeline = value; - RaisePropertyChanged(); - } - } - - /// /// 绑定声速值 /// private string _soundSpeed = "0"; @@ -305,7 +290,7 @@ } } - private string _pipeName; + private string _pipeName = string.Empty; public string PipeName { @@ -329,7 +314,7 @@ } } - private string _pipeDiameter; + private string _pipeDiameter = string.Empty; public string PipeDiameter { @@ -341,7 +326,7 @@ } } - private string _pipeLength; + private string _pipeLength = string.Empty; public string PipeLength { @@ -412,7 +397,7 @@ public HomePageProViewModel(IPipeMaterialDataService dataService) { RegisterMessage(); - + TimerTick(); _pipeMaterialsArray = new ObservableCollection(); @@ -442,8 +427,8 @@ var sensorStatus = dev.Status == "1"; RedTransmitterState = sensorStatus; //将信号A数据缓存到FlowStatus - FlowStatus.SensorASignalIntensity = signalIntensity; - FlowStatus.SensorAIsEnable = sensorStatus; + FlowStatus.RedSensorSignalIntensity = signalIntensity; + FlowStatus.RedSensorIsEnable = sensorStatus; }); Messenger.Default.Register(this, MessengerToken.BlueSensorStatus, dev => @@ -456,11 +441,11 @@ var sensorStatus = dev.Status == "1"; BlueTransmitterState = sensorStatus; //将信号B数据缓存到FlowStatus - FlowStatus.SensorBSignalIntensity = signalIntensity; - FlowStatus.SensorBIsEnable = sensorStatus; + FlowStatus.BlueSensorSignalIntensity = signalIntensity; + FlowStatus.BlueSensorIsEnable = sensorStatus; }); } - + /// /// 各种定时器 /// @@ -518,6 +503,7 @@ FlowStatus.IsHydrophone = false; FrequencyInterval = "100 ~ 3000Hz"; }; + it.HydrophonesRadioButton.Checked += delegate { FlowStatus.IsHydrophone = true; @@ -646,7 +632,9 @@ InterferenceFrequency = "无"; Snr = "无"; FilterValue = "无"; - PipeLine = "无"; + PipeName = string.Empty; + PipeDiameter = string.Empty; + PipeLength = string.Empty; SoundSpeed = "0"; RedTransmitterDistance = 0; ElapseTime = "0"; diff --git a/Correlator/ViewModel/HomePageViewModel.cs b/Correlator/ViewModel/HomePageViewModel.cs index 79a3f2b..495958e 100644 --- a/Correlator/ViewModel/HomePageViewModel.cs +++ b/Correlator/ViewModel/HomePageViewModel.cs @@ -542,8 +542,8 @@ var sensorStatus = dev.Status == "1"; TransmitterAFault = sensorStatus; //将信号A数据缓存到FlowStatus - FlowStatus.SensorASignalIntensity = signalIntensity; - FlowStatus.SensorAIsEnable = sensorStatus; + FlowStatus.RedSensorSignalIntensity = signalIntensity; + FlowStatus.RedSensorIsEnable = sensorStatus; }); Messenger.Default.Register(this, MessengerToken.BlueSensorStatus, dev => @@ -556,8 +556,8 @@ var sensorStatus = dev.Status == "1"; TransmitterBFault = sensorStatus; //将信号B数据缓存到FlowStatus - FlowStatus.SensorBSignalIntensity = signalIntensity; - FlowStatus.SensorBIsEnable = sensorStatus; + FlowStatus.BlueSensorSignalIntensity = signalIntensity; + FlowStatus.BlueSensorIsEnable = sensorStatus; }); Messenger.Default.Register(this, MessengerToken.ShowCheckResponseDialog,