diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 3fb1dd9..42d8da2 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -258,10 +258,12 @@ + + AudioFileWindow.xaml diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 3fb1dd9..42d8da2 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -258,10 +258,12 @@ + + AudioFileWindow.xaml diff --git a/Correlator/View/HomePageProWindow.xaml b/Correlator/View/HomePageProWindow.xaml index 2974eef..14f5183 100644 --- a/Correlator/View/HomePageProWindow.xaml +++ b/Correlator/View/HomePageProWindow.xaml @@ -2,6 +2,7 @@ x:Class="Correlator.View.HomePageProWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:converter="clr-namespace:Correlator.Converter" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -11,14 +12,23 @@ d:DesignHeight="1080" d:DesignWidth="1920" Background="#EBECF0" - DataContext="{Binding HomePage, Source={StaticResource Locator}}" + DataContext="{Binding HomePagePro, Source={StaticResource Locator}}" Icon="/Correlator;component/Image/favicon.ico" WindowStartupLocation="CenterScreen" WindowState="Maximized" WindowStyle="None" mc:Ignorable="d"> - + + + + + + + + + + @@ -329,7 +339,7 @@ Height="82" Margin="20,0,0,40" VerticalAlignment="Bottom" - Source="/Correlator;component/Image/l_icon0.png" /> + Source="{Binding RedTransmitterSignalIntensity, ConverterParameter=0, Converter={StaticResource SignalImageConverter}}" /> @@ -339,7 +349,7 @@ Height="82" Margin="0,0,20,40" VerticalAlignment="Bottom" - Source="/Correlator;component/Image/r_icon0.png" /> + Source="{Binding BlueTransmitterSignalIntensity, ConverterParameter=1, Converter={StaticResource SignalImageConverter}}" /> @@ -387,7 +397,7 @@ Margin="0,0,15,0" FontSize="18" Foreground="{StaticResource MainThemeColor}" - Text="1000Hz" /> + Text="{Binding InterferenceFrequency}" /> + Text="{Binding Snr}" /> + Text="{Binding FilterValue}" /> @@ -446,22 +456,24 @@ + Text="" /> + Text="管材:" /> + Text="{Binding PipeLine}" /> + Text="" /> + Text="声速:" /> + Text="{Binding SoundSpeed, StringFormat={}{0}m/s}" /> @@ -514,56 +525,67 @@ - - - - - + HorizontalAlignment="Left" + Orientation="Vertical"> + + + + + - - - - - - + - + + + + + - - - - - - + + + + + + + + + - + + + + Text="{Binding ElapseTime, StringFormat={}{0}}" /> - - - - - + HorizontalAlignment="Right" + Orientation="Vertical"> + + + + + - - - - - + + + + + - + - - - - - - + + + + + + + + + - - + + @@ -939,7 +972,7 @@ Margin="1" VerticalAlignment="Center" Background="Transparent" - Value="{Binding Battery}" /> + Value="{Binding ComputerBattery}" /> + + AudioFileWindow.xaml diff --git a/Correlator/View/HomePageProWindow.xaml b/Correlator/View/HomePageProWindow.xaml index 2974eef..14f5183 100644 --- a/Correlator/View/HomePageProWindow.xaml +++ b/Correlator/View/HomePageProWindow.xaml @@ -2,6 +2,7 @@ x:Class="Correlator.View.HomePageProWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:converter="clr-namespace:Correlator.Converter" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -11,14 +12,23 @@ d:DesignHeight="1080" d:DesignWidth="1920" Background="#EBECF0" - DataContext="{Binding HomePage, Source={StaticResource Locator}}" + DataContext="{Binding HomePagePro, Source={StaticResource Locator}}" Icon="/Correlator;component/Image/favicon.ico" WindowStartupLocation="CenterScreen" WindowState="Maximized" WindowStyle="None" mc:Ignorable="d"> - + + + + + + + + + + @@ -329,7 +339,7 @@ Height="82" Margin="20,0,0,40" VerticalAlignment="Bottom" - Source="/Correlator;component/Image/l_icon0.png" /> + Source="{Binding RedTransmitterSignalIntensity, ConverterParameter=0, Converter={StaticResource SignalImageConverter}}" /> @@ -339,7 +349,7 @@ Height="82" Margin="0,0,20,40" VerticalAlignment="Bottom" - Source="/Correlator;component/Image/r_icon0.png" /> + Source="{Binding BlueTransmitterSignalIntensity, ConverterParameter=1, Converter={StaticResource SignalImageConverter}}" /> @@ -387,7 +397,7 @@ Margin="0,0,15,0" FontSize="18" Foreground="{StaticResource MainThemeColor}" - Text="1000Hz" /> + Text="{Binding InterferenceFrequency}" /> + Text="{Binding Snr}" /> + Text="{Binding FilterValue}" /> @@ -446,22 +456,24 @@ + Text="" /> + Text="管材:" /> + Text="{Binding PipeLine}" /> + Text="" /> + Text="声速:" /> + Text="{Binding SoundSpeed, StringFormat={}{0}m/s}" /> @@ -514,56 +525,67 @@ - - - - - + HorizontalAlignment="Left" + Orientation="Vertical"> + + + + + - - - - - - + - + + + + + - - - - - - + + + + + + + + + - + + + + Text="{Binding ElapseTime, StringFormat={}{0}}" /> - - - - - + HorizontalAlignment="Right" + Orientation="Vertical"> + + + + + - - - - - + + + + + - + - - - - - - + + + + + + + + + - - + + @@ -939,7 +972,7 @@ Margin="1" VerticalAlignment="Center" Background="Transparent" - Value="{Binding Battery}" /> + Value="{Binding ComputerBattery}" /> + + AudioFileWindow.xaml diff --git a/Correlator/View/HomePageProWindow.xaml b/Correlator/View/HomePageProWindow.xaml index 2974eef..14f5183 100644 --- a/Correlator/View/HomePageProWindow.xaml +++ b/Correlator/View/HomePageProWindow.xaml @@ -2,6 +2,7 @@ x:Class="Correlator.View.HomePageProWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:converter="clr-namespace:Correlator.Converter" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -11,14 +12,23 @@ d:DesignHeight="1080" d:DesignWidth="1920" Background="#EBECF0" - DataContext="{Binding HomePage, Source={StaticResource Locator}}" + DataContext="{Binding HomePagePro, Source={StaticResource Locator}}" Icon="/Correlator;component/Image/favicon.ico" WindowStartupLocation="CenterScreen" WindowState="Maximized" WindowStyle="None" mc:Ignorable="d"> - + + + + + + + + + + @@ -329,7 +339,7 @@ Height="82" Margin="20,0,0,40" VerticalAlignment="Bottom" - Source="/Correlator;component/Image/l_icon0.png" /> + Source="{Binding RedTransmitterSignalIntensity, ConverterParameter=0, Converter={StaticResource SignalImageConverter}}" /> @@ -339,7 +349,7 @@ Height="82" Margin="0,0,20,40" VerticalAlignment="Bottom" - Source="/Correlator;component/Image/r_icon0.png" /> + Source="{Binding BlueTransmitterSignalIntensity, ConverterParameter=1, Converter={StaticResource SignalImageConverter}}" /> @@ -387,7 +397,7 @@ Margin="0,0,15,0" FontSize="18" Foreground="{StaticResource MainThemeColor}" - Text="1000Hz" /> + Text="{Binding InterferenceFrequency}" /> + Text="{Binding Snr}" /> + Text="{Binding FilterValue}" /> @@ -446,22 +456,24 @@ + Text="" /> + Text="管材:" /> + Text="{Binding PipeLine}" /> + Text="" /> + Text="声速:" /> + Text="{Binding SoundSpeed, StringFormat={}{0}m/s}" /> @@ -514,56 +525,67 @@ - - - - - + HorizontalAlignment="Left" + Orientation="Vertical"> + + + + + - - - - - - + - + + + + + - - - - - - + + + + + + + + + - + + + + Text="{Binding ElapseTime, StringFormat={}{0}}" /> - - - - - + HorizontalAlignment="Right" + Orientation="Vertical"> + + + + + - - - - - + + + + + - + - - - - - - + + + + + + + + + - - + + @@ -939,7 +972,7 @@ Margin="1" VerticalAlignment="Center" Background="Transparent" - Value="{Binding Battery}" /> + Value="{Binding ComputerBattery}" /> _currentTime; + private set + { + _currentTime = value; + RaisePropertyChanged(); + } + } + + /// + /// 红色发射机信号强度0-5 + /// + private int _redTransmitterSignalIntensity; + + public int RedTransmitterSignalIntensity + { + get => _redTransmitterSignalIntensity; + private set + { + _redTransmitterSignalIntensity = value; + RaisePropertyChanged(); + } + } + + /// + /// 蓝色发射机信号强度0-5 + /// + private int _blueTransmitterSignalIntensity; + + public int BlueTransmitterSignalIntensity + { + get => _blueTransmitterSignalIntensity; + private set + { + _blueTransmitterSignalIntensity = value; + RaisePropertyChanged(); + } + } + + /// + /// 绑定干扰频段值 + /// + private string _interferenceFrequency = "无"; + + public string InterferenceFrequency + { + get => _interferenceFrequency; + private set + { + _interferenceFrequency = value; + RaisePropertyChanged(); + } + } + + /// + /// 绑定过信噪比 + /// + private string _snr = "无"; + + public string Snr + { + get => _snr; + private set + { + _snr = value; + RaisePropertyChanged(); + } + } + + /// + /// 绑定过滤器值 + /// + private string _filterValue = "无"; + + public string FilterValue + { + get => _filterValue; + private set + { + _filterValue = value; + RaisePropertyChanged(); + } + } + + /// + /// 绑定管道值 + /// + private string _pipeline = "无"; + + public string PipeLine + { + get => _pipeline; + private set + { + _pipeline = value; + RaisePropertyChanged(); + } + } + + /// + /// 绑定声速值 + /// + private string _soundSpeed = "0"; + + public string SoundSpeed + { + get => _soundSpeed; + private set + { + _soundSpeed = value; + RaisePropertyChanged(); + } + } + + /// + /// 红色发射机是否故障 + /// + private bool _redTransmitterState; + + public bool RedTransmitterState + { + get => _redTransmitterState; + set + { + _redTransmitterState = value; + RaisePropertyChanged(); + } + } + + /// + /// 蓝色发射机是否故障 + /// + private bool _blueTransmitterState; + + public bool BlueTransmitterState + { + get => _blueTransmitterState; + private set + { + _blueTransmitterState = value; + RaisePropertyChanged(); + } + } + + /// + /// 红色发射机距离 + /// + private double _redTransmitterDistance; + + public double RedTransmitterDistance + { + get => _redTransmitterDistance; + private set + { + _redTransmitterDistance = value; + RaisePropertyChanged(); + } + } + + /// + /// 蓝色发射机距离 + /// + private double _blueTransmitterDistance; + + public double BlueTransmitterDistance + { + get => _blueTransmitterDistance; + private set + { + _blueTransmitterDistance = value; + RaisePropertyChanged(); + } + } + + /// + /// 红色发射机电量 0-100 + /// + private double _redTransmitterBattery; + + public double RedTransmitterBattery + { + get => _redTransmitterBattery; + set + { + _redTransmitterBattery = value; + RaisePropertyChanged(); + } + } + + /// + /// 蓝色发射机电量 0-100 + /// + private double _blueTransmitterBattery; + + public double BlueTransmitterBattery + { + get => _blueTransmitterBattery; + set + { + _blueTransmitterBattery = value; + RaisePropertyChanged(); + } + } + + /// + /// 绑定经过了值 + /// + private string _elapseTime = "0"; + + public string ElapseTime + { + get => _elapseTime; + private set + { + _elapseTime = value; + RaisePropertyChanged(); + } + } + + private double _computerBattery; + + public double ComputerBattery + { + get => _computerBattery; + set + { + _computerBattery = value; + RaisePropertyChanged(); + } + } + + #endregion + + #region PC电量状态 + + [DllImport("kernel32.dll", EntryPoint = "GetSystemPowerStatus")] + private static extern void GetSystemPowerStatus(ref SystemConfig.SystemPowerStatus lpSystemPowerStatus); + + #endregion + + public HomePageProViewModel() + { + TimerTick(); + + InitDefaultValue(); + } + + /// + /// 各种定时器 + /// + private void TimerTick() + { + //实时显示时间 + _timer.Tick += delegate + { + var dateTime = DateTime.Now; + var strDateTime = dateTime.ToString("yyyy年MM月dd日") + + dateTime.ToString("\0 \0 \0 dddd \0 \0 \0", new CultureInfo("zh-cn")) + + dateTime.ToString("HH:mm:ss"); + CurrentTime = strDateTime; + }; + _timer.Start(); + + //获取电池电量 + var sysPower = new SystemConfig.SystemPowerStatus(); + GetSystemPowerStatus(ref sysPower); + ComputerBattery = sysPower.BatteryPercent == 255 ? 100 : sysPower.BatteryPercent; + + _batteryTimer.Tick += delegate + { + GetSystemPowerStatus(ref sysPower); + ComputerBattery = sysPower.BatteryPercent == 255 ? 100 : sysPower.BatteryPercent; + }; + _batteryTimer.Start(); + } + + /// + /// 设置默认值 + /// + private void InitDefaultValue() + { + } + } +} \ No newline at end of file diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 3fb1dd9..42d8da2 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -258,10 +258,12 @@ + + AudioFileWindow.xaml diff --git a/Correlator/View/HomePageProWindow.xaml b/Correlator/View/HomePageProWindow.xaml index 2974eef..14f5183 100644 --- a/Correlator/View/HomePageProWindow.xaml +++ b/Correlator/View/HomePageProWindow.xaml @@ -2,6 +2,7 @@ x:Class="Correlator.View.HomePageProWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:converter="clr-namespace:Correlator.Converter" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -11,14 +12,23 @@ d:DesignHeight="1080" d:DesignWidth="1920" Background="#EBECF0" - DataContext="{Binding HomePage, Source={StaticResource Locator}}" + DataContext="{Binding HomePagePro, Source={StaticResource Locator}}" Icon="/Correlator;component/Image/favicon.ico" WindowStartupLocation="CenterScreen" WindowState="Maximized" WindowStyle="None" mc:Ignorable="d"> - + + + + + + + + + + @@ -329,7 +339,7 @@ Height="82" Margin="20,0,0,40" VerticalAlignment="Bottom" - Source="/Correlator;component/Image/l_icon0.png" /> + Source="{Binding RedTransmitterSignalIntensity, ConverterParameter=0, Converter={StaticResource SignalImageConverter}}" /> @@ -339,7 +349,7 @@ Height="82" Margin="0,0,20,40" VerticalAlignment="Bottom" - Source="/Correlator;component/Image/r_icon0.png" /> + Source="{Binding BlueTransmitterSignalIntensity, ConverterParameter=1, Converter={StaticResource SignalImageConverter}}" /> @@ -387,7 +397,7 @@ Margin="0,0,15,0" FontSize="18" Foreground="{StaticResource MainThemeColor}" - Text="1000Hz" /> + Text="{Binding InterferenceFrequency}" /> + Text="{Binding Snr}" /> + Text="{Binding FilterValue}" /> @@ -446,22 +456,24 @@ + Text="" /> + Text="管材:" /> + Text="{Binding PipeLine}" /> + Text="" /> + Text="声速:" /> + Text="{Binding SoundSpeed, StringFormat={}{0}m/s}" /> @@ -514,56 +525,67 @@ - - - - - + HorizontalAlignment="Left" + Orientation="Vertical"> + + + + + - - - - - - + - + + + + + - - - - - - + + + + + + + + + - + + + + Text="{Binding ElapseTime, StringFormat={}{0}}" /> - - - - - + HorizontalAlignment="Right" + Orientation="Vertical"> + + + + + - - - - - + + + + + - + - - - - - - + + + + + + + + + - - + + @@ -939,7 +972,7 @@ Margin="1" VerticalAlignment="Center" Background="Transparent" - Value="{Binding Battery}" /> + Value="{Binding ComputerBattery}" /> _currentTime; + private set + { + _currentTime = value; + RaisePropertyChanged(); + } + } + + /// + /// 红色发射机信号强度0-5 + /// + private int _redTransmitterSignalIntensity; + + public int RedTransmitterSignalIntensity + { + get => _redTransmitterSignalIntensity; + private set + { + _redTransmitterSignalIntensity = value; + RaisePropertyChanged(); + } + } + + /// + /// 蓝色发射机信号强度0-5 + /// + private int _blueTransmitterSignalIntensity; + + public int BlueTransmitterSignalIntensity + { + get => _blueTransmitterSignalIntensity; + private set + { + _blueTransmitterSignalIntensity = value; + RaisePropertyChanged(); + } + } + + /// + /// 绑定干扰频段值 + /// + private string _interferenceFrequency = "无"; + + public string InterferenceFrequency + { + get => _interferenceFrequency; + private set + { + _interferenceFrequency = value; + RaisePropertyChanged(); + } + } + + /// + /// 绑定过信噪比 + /// + private string _snr = "无"; + + public string Snr + { + get => _snr; + private set + { + _snr = value; + RaisePropertyChanged(); + } + } + + /// + /// 绑定过滤器值 + /// + private string _filterValue = "无"; + + public string FilterValue + { + get => _filterValue; + private set + { + _filterValue = value; + RaisePropertyChanged(); + } + } + + /// + /// 绑定管道值 + /// + private string _pipeline = "无"; + + public string PipeLine + { + get => _pipeline; + private set + { + _pipeline = value; + RaisePropertyChanged(); + } + } + + /// + /// 绑定声速值 + /// + private string _soundSpeed = "0"; + + public string SoundSpeed + { + get => _soundSpeed; + private set + { + _soundSpeed = value; + RaisePropertyChanged(); + } + } + + /// + /// 红色发射机是否故障 + /// + private bool _redTransmitterState; + + public bool RedTransmitterState + { + get => _redTransmitterState; + set + { + _redTransmitterState = value; + RaisePropertyChanged(); + } + } + + /// + /// 蓝色发射机是否故障 + /// + private bool _blueTransmitterState; + + public bool BlueTransmitterState + { + get => _blueTransmitterState; + private set + { + _blueTransmitterState = value; + RaisePropertyChanged(); + } + } + + /// + /// 红色发射机距离 + /// + private double _redTransmitterDistance; + + public double RedTransmitterDistance + { + get => _redTransmitterDistance; + private set + { + _redTransmitterDistance = value; + RaisePropertyChanged(); + } + } + + /// + /// 蓝色发射机距离 + /// + private double _blueTransmitterDistance; + + public double BlueTransmitterDistance + { + get => _blueTransmitterDistance; + private set + { + _blueTransmitterDistance = value; + RaisePropertyChanged(); + } + } + + /// + /// 红色发射机电量 0-100 + /// + private double _redTransmitterBattery; + + public double RedTransmitterBattery + { + get => _redTransmitterBattery; + set + { + _redTransmitterBattery = value; + RaisePropertyChanged(); + } + } + + /// + /// 蓝色发射机电量 0-100 + /// + private double _blueTransmitterBattery; + + public double BlueTransmitterBattery + { + get => _blueTransmitterBattery; + set + { + _blueTransmitterBattery = value; + RaisePropertyChanged(); + } + } + + /// + /// 绑定经过了值 + /// + private string _elapseTime = "0"; + + public string ElapseTime + { + get => _elapseTime; + private set + { + _elapseTime = value; + RaisePropertyChanged(); + } + } + + private double _computerBattery; + + public double ComputerBattery + { + get => _computerBattery; + set + { + _computerBattery = value; + RaisePropertyChanged(); + } + } + + #endregion + + #region PC电量状态 + + [DllImport("kernel32.dll", EntryPoint = "GetSystemPowerStatus")] + private static extern void GetSystemPowerStatus(ref SystemConfig.SystemPowerStatus lpSystemPowerStatus); + + #endregion + + public HomePageProViewModel() + { + TimerTick(); + + InitDefaultValue(); + } + + /// + /// 各种定时器 + /// + private void TimerTick() + { + //实时显示时间 + _timer.Tick += delegate + { + var dateTime = DateTime.Now; + var strDateTime = dateTime.ToString("yyyy年MM月dd日") + + dateTime.ToString("\0 \0 \0 dddd \0 \0 \0", new CultureInfo("zh-cn")) + + dateTime.ToString("HH:mm:ss"); + CurrentTime = strDateTime; + }; + _timer.Start(); + + //获取电池电量 + var sysPower = new SystemConfig.SystemPowerStatus(); + GetSystemPowerStatus(ref sysPower); + ComputerBattery = sysPower.BatteryPercent == 255 ? 100 : sysPower.BatteryPercent; + + _batteryTimer.Tick += delegate + { + GetSystemPowerStatus(ref sysPower); + ComputerBattery = sysPower.BatteryPercent == 255 ? 100 : sysPower.BatteryPercent; + }; + _batteryTimer.Start(); + } + + /// + /// 设置默认值 + /// + private void InitDefaultValue() + { + } + } +} \ No newline at end of file diff --git a/Correlator/ViewModel/ViewModelLocator.cs b/Correlator/ViewModel/ViewModelLocator.cs index 12d8914..caf5ef2 100644 --- a/Correlator/ViewModel/ViewModelLocator.cs +++ b/Correlator/ViewModel/ViewModelLocator.cs @@ -43,6 +43,7 @@ #region VM SimpleIoc.Default.Register(); + SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); @@ -54,11 +55,13 @@ SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); + SimpleIoc.Default.Register(); #endregion } public HomePageViewModel HomePage => ServiceLocator.Current.GetInstance(); + public HomePageProViewModel HomePagePro => ServiceLocator.Current.GetInstance(); public AudioFileViewModel AudioFile => ServiceLocator.Current.GetInstance(); public PictureFileViewModel PictureFile => ServiceLocator.Current.GetInstance(); public AuditionViewModel Audition => ServiceLocator.Current.GetInstance(); @@ -76,6 +79,7 @@ public EditPipeLengthViewModel EditPipeLength => ServiceLocator.Current.GetInstance(); public EditFilterViewModel EditFilter => ServiceLocator.Current.GetInstance(); + public CheckResponseViewModel CheckResponse => ServiceLocator.Current.GetInstance(); public static void Cleanup() {