20240801_FJEQ_upperpc/FujianEarthquake_seabed/FujianEarthquake/Views/ShoreBaseStationStatusDataView.xaml
XuMin 1f5631afb3 1 研究上下位机通信协议,编写协议解析代码;
2 研究岸基站可编程电源通信协议,编写岸基站状态数据显示页面;
2024-08-29 18:03:03 +08:00

389 lines
26 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<UserControl x:Class="FujianEarthquake.Views.ShoreBaseStationStatusDataView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FujianEarthquake.Views"
xmlns:CommonValueToBrushConvert="clr-namespace:FujianEarthquake.Common.ValueToBrushConvert"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
FontFamily="{StaticResource DigitalDisplay}"
Name="ShoreBaseStationStatusDataPage"
d:DesignHeight="850" d:DesignWidth="1550">
<UserControl.Resources>
<Style TargetType="GroupBox">
<Setter Property="Margin" Value="10,5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<!--左上角-->
<Polyline HorizontalAlignment="Left" VerticalAlignment="Top"
Points="0 30,0 10,10 0,30 0" Stroke="#9918AABD" StrokeThickness="1"/>
<!--左上角点-->
<Ellipse Width="4" Height="4" VerticalAlignment="Top" HorizontalAlignment="Left"
Fill="#9918AABD" Margin="24,-2,0,0"/>
<Ellipse Width="4" Height="4" VerticalAlignment="Top" HorizontalAlignment="Left"
Fill="#9918AABD" Margin="-2,24,0,0"/>
<!--右上角-->
<Path Data="M0 0, 3 3, 30 3, 33 0, 68 0, 73 7,78 7, 78 10M8 0, 25 0"
Stroke="#5518AABD" VerticalAlignment="Top" HorizontalAlignment="Right"/>
<!--左下角-->
<Polyline Points="0,0 0,15 10,15" Stroke="#5518AABD" VerticalAlignment="Bottom"
HorizontalAlignment="Left"/>
<!--右下角-->
<Polyline Points="10,0 0,10" Stroke="#5518AABD" VerticalAlignment="Bottom"
HorizontalAlignment="Right"/>
<!--右下角图表-->
<Polyline Points="0,7 7 7 7 0" Fill="#9918AABD" VerticalAlignment="Bottom"
HorizontalAlignment="Right"/>
<Border BorderBrush="#5518AABD" BorderThickness="0,1,0,0" VerticalAlignment="Top"
Margin="30,-0.5,78,0"/>
<Border BorderBrush="#5518AABD" BorderThickness="0,0,1,0" HorizontalAlignment="Right"
Margin="0,10"/>
<Border BorderBrush="#5518AABD" BorderThickness="0,1,0,0" VerticalAlignment="Bottom"
Margin="10,0"/>
<Border BorderBrush="#5518AABD" BorderThickness="0,0,1,0" HorizontalAlignment="Left"
Margin="-0.5,15"/>
<!--箭头-->
<Path Data="M0 0,3 0,5 4,3 8,0 8,3 4" Fill="#9918AABD" VerticalAlignment="Top"
HorizontalAlignment="Left" Margin="10,13"/>
<Path Data="M0 0,3 0,5 4,3 8,0 8,3 4" Fill="#5518AABD" VerticalAlignment="Top"
HorizontalAlignment="Left" Margin="16,13"/>
<!--字体-->
<TextBlock Text="{TemplateBinding Header}" Foreground="#18AABD"
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="25,12"/>
<!-- 占位对象 -->
<ContentPresenter />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
<Grid>
<Border x:Name="columnHeaderBorder" BorderThickness="0,0,0,1"
BorderBrush="#EEE"
Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
TextBlock.TextAlignment="Center"
TextBlock.FontSize="18"
TextBlock.Foreground="White"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<CommonValueToBrushConvert:ValueToBrushConvertShoreBaseStationVoltage x:Key="ValueToBrushConvertShoreBaseStationVoltage"/>
<CommonValueToBrushConvert:ValueToBrushConvertShoreBaseStationCurrent x:Key="ValueToBrushConvertShoreBaseStationCurrent"/>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.15*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<GroupBox Header="岸基站状态数据查询条件">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2.5*"/>
<ColumnDefinition Width="0.1*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"
Orientation="Horizontal" Margin="40,0,0,0">
<CheckBox Content="时间筛选:" Foreground="White" FontSize="18"
IsChecked="{Binding IsChecked}" VerticalAlignment="Center"/>
<hc:DateTimePicker hc:InfoElement.ShowClearButton="True"
hc:InfoElement.TitleWidth="80" hc:InfoElement.TitlePlacement="Left"
Style="{StaticResource DateTimePickerPlus}" hc:InfoElement.Title="起始时间:"
Foreground="White" CaretBrush="White" BorderBrush="White"
FontSize="14" Width="260" Margin="10,0,0,0" Background="Transparent"
SelectedDateTime="{Binding StartDateTime, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="-" Foreground="White" HorizontalAlignment="Center"
VerticalAlignment="Center" Margin="10,0,0,0"/>
<hc:DateTimePicker hc:InfoElement.ShowClearButton="True"
hc:InfoElement.TitleWidth="80" hc:InfoElement.TitlePlacement="Left"
Style="{StaticResource DateTimePickerPlus}" hc:InfoElement.Title="结束时间:"
Foreground="White" CaretBrush="White" BorderBrush="White"
FontSize="14" Width="260" Margin="10,0,0,0" Background="Transparent"
SelectedDateTime="{Binding EndDateTime, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
</Grid>
</Grid>
</GroupBox>
</Grid>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="6*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="岸基站状态数据展示">
<hc:TransitioningContentControl>
<Grid Margin="10,35,10,10">
<Grid.RowDefinitions>
<RowDefinition Height="12*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<DataGrid x:Name="ShoreBaseStationStateDataGrid" ItemsSource="{Binding ShoreBaseStationStateDataList}"
AutoGenerateColumns="False" Margin="10,0,10,0" CanUserSortColumns="False"
CanUserAddRows="False" CanUserDeleteRows="False" Background="Transparent"
CanUserReorderColumns="False" CanUserResizeColumns="False" IsHitTestVisible="False"
CanUserResizeRows="False" BorderThickness="0" Grid.RowSpan="2">
<DataGrid.Resources>
<Style TargetType="DataGridCell" x:Key="DataGridCellCenter">
<Setter Property="Background" Value="#FF14273A"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="#A0A0A0"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridCell">
<Border x:Name="border" BorderBrush="#A0A0A0" BorderThickness="0,0,0,1"
Background="{TemplateBinding Background}">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Index}" Width="0.5*" Header="编号"
CanUserSort="False" CellStyle="{StaticResource DataGridCellCenter}"/>
<DataGridTextColumn Binding="{Binding RecordTime, StringFormat='yyyy/MM/dd HH:mm:ss'}" Width="1.8*" Header="记录时间"
CanUserSort="False" CellStyle="{StaticResource DataGridCellCenter}"/>
<!--岸基站输出电压设置范围为46-50-->
<DataGridTemplateColumn Width="*" Header="输出电压 V" CellStyle="{StaticResource DataGridCellCenter}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Center" Text="{Binding In_Vol,StringFormat=F2}"
Foreground="{Binding Path=Out_Vol, Converter={StaticResource ValueToBrushConvertShoreBaseStationVoltage},ConverterParameter=50}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--岸基站输出电流设置范围为0-5-->
<DataGridTemplateColumn Width="*" Header="输出电流 A" CellStyle="{StaticResource DataGridCellCenter}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Center" Text="{Binding In_Cur,StringFormat=F2}"
Foreground="{Binding Path=Out_Cur, Converter={StaticResource ValueToBrushConvertShoreBaseStationCurrent},ConverterParameter=5}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="过压保护状态" Width="*" CellStyle="{StaticResource DataGridCellCenter}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding VolProStatus}" Width="35" Height="35"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="过流保护状态" Width="*" CellStyle="{StaticResource DataGridCellCenter}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding CurProStatus}" Width="35" Height="35"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="继电器状态" Width="*" CellStyle="{StaticResource DataGridCellCenter}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding RelayStatus}" Width="35" Height="35"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center"
HorizontalAlignment="Right" Margin="0,0,10,0">
<TextBlock VerticalAlignment="Center" FontSize="17" Foreground="White"
Margin="0,0,20,0" Text="{Binding ShoreBaseStationStateMsg}"/>
<Button Content="上一页" FontSize="16" Command="{Binding ForwordShoreBaseStationStateCommand}"
Background="Transparent" BorderBrush="White" Style="{StaticResource ButtonStyle}"
Foreground="White" Width="85" Height="35">
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="8"/>
</Style>
</Button.Resources>
</Button>
<Button Content="下一页" FontSize="16" Margin="20,0,20,0" Foreground="White"
Command="{Binding NextShoreBaseStationStateCommand}" Width="85" Height="35"
Background="Transparent" BorderBrush="White" Style="{StaticResource ButtonStyle}">
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="8"/>
</Style>
</Button.Resources>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="30,0,0,0"
HorizontalAlignment="Left" VerticalAlignment="Center">
<Button Name="DownloadDataBtn" HorizontalAlignment="Left" VerticalAlignment="Center" Height="45"
BorderThickness="0" Command="{Binding DownloadDataCommand}" Width="45"
Style="{StaticResource ButtonStyle}" Background="Transparent"
IsEnabled="{Binding DownloadDataBtnIsEnabled}">
<Button.Content>
<Image Source="/Assets/Images/Download.png" Height="30" Width="30"
HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Button.Content>
<Button.ToolTip>
<ToolTip Content="下载数据"/>
</Button.ToolTip>
</Button>
<TextBlock Name="DownloadDataMsg" Text="{Binding DownloadDataMsg}"
Foreground="{Binding DownloadDataMsgForeground}" FontSize="12" HorizontalAlignment="Left"
VerticalAlignment="Bottom" Margin="5,0,0,5"
Visibility="{Binding DownloadDataMsgVisibility}"/>
</StackPanel>
</Grid>
</hc:TransitioningContentControl>
</GroupBox>
<Grid Grid.Row="1">
<GroupBox Header="岸基站状态数据请求">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.3*"/>
<RowDefinition/>
<RowDefinition Height="0.55*"/>
</Grid.RowDefinitions>
<TextBlock Name="AskDataMsg" Grid.Row="2" Text="{Binding AskDataMsg}" FontSize="12"
Foreground="{Binding AskDataMsgForeground}"
VerticalAlignment="Center" Margin="400,5,0,0"
Visibility="{Binding AskDataMsgVisibility}"/>
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center"
Margin="0,0,0,-10">
<CheckBox Content="周期请求" Foreground="White" FontSize="18"
IsChecked="{Binding CycleRequestIsChecked}" VerticalAlignment="Center"/>
<TextBlock Text="周期:" FontSize="16" Foreground="White" VerticalAlignment="Center"
Margin="10,0,10,0"/>
<TextBox Name="CycleRequestCycleTextBox"
Text="{Binding CycleRequestCycle, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Foreground="Black" FontSize="16" Width="100" Height="28"
TextAlignment="Left" VerticalContentAlignment="Center"
CaretBrush="Black" Background="White" HorizontalContentAlignment="Center"/>
<TextBlock Text="s" FontSize="17" Foreground="White" VerticalAlignment="Center"
Margin="10,0,20,0"/>
<Button Name="AskDataBtn" Foreground="White" Background="Transparent" BorderBrush="White"
VerticalAlignment="Center" HorizontalAlignment="Center" BorderThickness="1" Width="150"
Height="45" Style="{StaticResource ButtonStyle}"
Command="{Binding AskDataCommand}" IsEnabled="{Binding AskDataBtnIsEnabled}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<Image Source="/Assets/Images/AskData.png" Width="18"/>
<TextBlock Text="请求数据" Foreground="White" FontSize="16" Margin="15,0"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</Button.Content>
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="8"/>
</Style>
</Button.Resources>
</Button>
<Button Name="RefreshDataBtn" Foreground="White" Background="Transparent" BorderBrush="White"
VerticalAlignment="Center" HorizontalAlignment="Center" BorderThickness="1" Width="150"
Height="45" Margin="50,0,0,0" Style="{StaticResource ButtonStyle}"
Command="{Binding RefreshDataCommand}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<Image Source="/Assets/Images/Refresh.png" Width="18"/>
<TextBlock Text="刷新数据" Foreground="White" FontSize="16" Margin="15,0"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</Button.Content>
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="8"/>
</Style>
</Button.Resources>
</Button>
<!--<Button Name="AlarmSettingBtn" Foreground="White" Background="Transparent" BorderBrush="White"
VerticalAlignment="Center" HorizontalAlignment="Center" BorderThickness="1" Width="150"
Height="45" Margin="60,0,0,0" Style="{StaticResource ButtonStyle}"
Command="{Binding AlarmSettingCommand}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<Image Source="/Assets/Images/AlarmWhite.png" Width="20"/>
<TextBlock Text="报警设置" Foreground="White" FontSize="16" Margin="15,0"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</Button.Content>
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="8"/>
</Style>
</Button.Resources>
</Button>-->
<!--<Button Name="OtherSettingBtn" Foreground="White" Background="Transparent" BorderBrush="White"
VerticalAlignment="Center" HorizontalAlignment="Center" BorderThickness="1" Width="150"
Height="45" Margin="60,0,0,0" Style="{StaticResource ButtonStyle}"
Command="{Binding OtherSettingCommand}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<Image Source="/Assets/Images/Set.png" Width="18"/>
<TextBlock Text="其他设置" Foreground="White" FontSize="16" Margin="15,0"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</Button.Content>
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="8"/>
</Style>
</Button.Resources>
</Button>-->
</StackPanel>
</Grid>
</GroupBox>
</Grid>
</Grid>
</Grid>
</UserControl>