添加项目文件。
This commit is contained in:
299
Views/TestView.xaml
Normal file
299
Views/TestView.xaml
Normal file
@@ -0,0 +1,299 @@
|
||||
<UserControl x:Class="HME_MoistureLossMeter.Views.TestView"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="700" d:DesignWidth="1024">
|
||||
|
||||
<Grid Background="{StaticResource BackgroundBrush}" Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 左侧:主显示区域 -->
|
||||
<Border Grid.Row="0" Grid.RowSpan="2" Grid.Column="0"
|
||||
Style="{StaticResource PanelBorderStyle}"
|
||||
Margin="0,0,10,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 标题 -->
|
||||
<TextBlock Text="实时数据"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="{StaticResource PrimaryBrush}"
|
||||
Margin="0,0,0,10"/>
|
||||
|
||||
<!-- 数据显示网格 -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 第一列 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="水浴温度" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding WaterTemp, StringFormat='{}{0:F2} ℃'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="箱体温度" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding ChamberTemp, StringFormat='{}{0:F2} ℃'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="重量" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding Weight, StringFormat='{}{0:F2} g'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="3" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="空气体积" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding AirVolume, StringFormat='{}{0:F2} L'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="4" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="出口流量" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding OutletFlow, StringFormat='{}{0:F2} L/min'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="5" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="潮气量" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding TidalVolume, StringFormat='{}{0:F1} ml'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="6" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="频率" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding Frequency, StringFormat='{}{0:F2} 次/min'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="7" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="呼吸次数" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding BreathCount}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 第二列 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="设定测试时间" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding PresetHour, StringFormat='{}{0}H'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="当前时间" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding CurrentTime, StringFormat='{}{0:HH:mm:ss}'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="初始质量" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding InitialMass, StringFormat='{}{0:F2} g'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="3" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="测后质量" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding FinalMass, StringFormat='{}{0:F2} g'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="4" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="水分损失" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding MoistureLoss, StringFormat='{}{0:F2} mg/L'}"
|
||||
Style="{StaticResource DisplayValueStyle}"
|
||||
Foreground="{StaticResource DangerBrush}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="5" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="干燥空气量" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding DryAirFlow, StringFormat='{}{0:F2} L/min'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="6" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="测试状态" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding IsTesting, Converter={StaticResource BoolToVisibilityConverter},
|
||||
FallbackValue=未测试}"
|
||||
Style="{StaticResource DisplayValueStyle}"
|
||||
Foreground="{Binding IsTesting, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=SuccessBrush, FallbackValue={StaticResource WarningBrush}}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 第三列:状态指示灯 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="2" Margin="5">
|
||||
<TextBlock Text="状态指示灯" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<WrapPanel Margin="0,5,0,0">
|
||||
<Border Background="{Binding IsHeating, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=WarningBrush, FallbackValue=#95A5A6}"
|
||||
Width="20" Height="20" CornerRadius="10" Margin="2"/>
|
||||
<TextBlock Text="加热" FontSize="11" VerticalAlignment="Center" Margin="2,0,10,0"/>
|
||||
|
||||
<Border Background="{Binding IsInhale, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=SuccessBrush, FallbackValue=#95A5A6}"
|
||||
Width="20" Height="20" CornerRadius="10" Margin="2"/>
|
||||
<TextBlock Text="吸气" FontSize="11" VerticalAlignment="Center" Margin="2,0,10,0"/>
|
||||
|
||||
<Border Background="{Binding IsExhale, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=DangerBrush, FallbackValue=#95A5A6}"
|
||||
Width="20" Height="20" CornerRadius="10" Margin="2"/>
|
||||
<TextBlock Text="呼气" FontSize="11" VerticalAlignment="Center" Margin="2,0,10,0"/>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="2" Margin="5">
|
||||
<TextBlock Text="PLC状态" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding ConnectionStatus}"
|
||||
Style="{StaticResource DisplayValueStyle}"
|
||||
Foreground="{Binding IsConnected, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=SuccessBrush, FallbackValue={StaticResource DangerBrush}}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- 底部信息 -->
|
||||
<Border Grid.Row="2" Background="#F8F9FA" CornerRadius="4" Padding="5" Margin="0,10,0,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="实验条件: " FontWeight="Bold" FontSize="12"/>
|
||||
<TextBlock Text="{Binding CurrentTime, StringFormat='{}{0:MM/dd/yy ddd HH:mm:ss}'}" FontSize="12"/>
|
||||
<TextBlock Text=" | 操作员: " FontWeight="Bold" FontSize="12" Margin="10,0,0,0"/>
|
||||
<TextBlock Text="{Binding OperatorId}" FontSize="12"/>
|
||||
<TextBlock Text=" | 批号: " FontWeight="Bold" FontSize="12" Margin="10,0,0,0"/>
|
||||
<TextBlock Text="{Binding BatchNo}" FontSize="12"/>
|
||||
<TextBlock Text=" | 实验编号: " FontWeight="Bold" FontSize="12" Margin="10,0,0,0"/>
|
||||
<TextBlock Text="{Binding ExperimentId}" FontSize="12"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 右侧:控制区域 -->
|
||||
<Border Grid.Row="0" Grid.Column="1"
|
||||
Style="{StaticResource PanelBorderStyle}"
|
||||
Margin="10,0,0,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="测试控制"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="{StaticResource PrimaryBrush}"
|
||||
Margin="0,0,0,10"/>
|
||||
|
||||
<WrapPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
|
||||
<Button Content="复位"
|
||||
Command="{Binding ResetCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource WarningBrush}"/>
|
||||
|
||||
<Button Content="测试"
|
||||
Command="{Binding StartTestCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource SuccessBrush}"/>
|
||||
|
||||
<Button Content="停止"
|
||||
Command="{Binding StopTestCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource DangerBrush}"/>
|
||||
|
||||
<Button Content="P1记录"
|
||||
Command="{Binding RecordP1Command}"
|
||||
Width="80" Height="40"/>
|
||||
|
||||
<Button Content="P2记录"
|
||||
Command="{Binding RecordP2Command}"
|
||||
Width="80" Height="40"/>
|
||||
|
||||
<Button Content="打印"
|
||||
Command="{Binding PrintCommand}"
|
||||
Width="80" Height="40"/>
|
||||
|
||||
<Button Content="加热"
|
||||
Command="{Binding ToggleHeatCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{Binding IsHeating, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=DangerBrush, FallbackValue={StaticResource AccentBrush}}"/>
|
||||
|
||||
<Button Content="呼气"
|
||||
Command="{Binding ManualExhaleCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource DangerBrush}"/>
|
||||
|
||||
<Button Content="吸气"
|
||||
Command="{Binding ManualInhaleCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource SuccessBrush}"/>
|
||||
|
||||
<Button Content="下降"
|
||||
Command="{Binding MoveDownCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource WarningBrush}"/>
|
||||
|
||||
<Button Content="上升"
|
||||
Command="{Binding MoveUpCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource WarningBrush}"/>
|
||||
|
||||
<Button Content="清零"
|
||||
Command="{Binding ClearCommand}"
|
||||
Width="80" Height="40"/>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 连接控制 -->
|
||||
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"
|
||||
Style="{StaticResource PanelBorderStyle}"
|
||||
Margin="0,10,0,0">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Content="连接PLC"
|
||||
Command="{Binding ConnectCommand}"
|
||||
Width="100" Height="35"
|
||||
Background="{StaticResource SuccessBrush}"/>
|
||||
<Button Content="断开PLC"
|
||||
Command="{Binding DisconnectCommand}"
|
||||
Width="100" Height="35"
|
||||
Background="{StaticResource DangerBrush}"
|
||||
Margin="10,0,0,0"/>
|
||||
<TextBlock Text="状态:" FontWeight="Bold" Margin="20,0,5,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding ConnectionStatus}"
|
||||
Foreground="{Binding IsConnected, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=SuccessBrush, FallbackValue={StaticResource DangerBrush}}"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user