暂时提交,等客户那边测试

This commit is contained in:
xyy
2026-03-11 19:11:06 +08:00
parent 84fae8c87c
commit fb82101706
5 changed files with 351 additions and 358 deletions

View File

@@ -5,36 +5,34 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PLCDataMonitor"
mc:Ignorable="d"
d:DesignHeight="480" d:DesignWidth="960"
d:DesignHeight="700" d:DesignWidth="1000"
FontFamily="Microsoft YaHei">
<!-- 最外层网格,明确划分两行:顶部连接区和数据区 -->
<Grid Margin="10">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<!-- 顶部区域自动适应高度 -->
<RowDefinition Height="*"/>
<!-- 数据区域占剩余空间 -->
</Grid.RowDefinitions>
<!-- 顶部PLC连接区域 -->
<!--<Border Grid.Row="0" Background="White" Margin="0,0,0,10" Padding="10" Height="60">
-->
<!-- 这里可以放PLC连接控件示例 -->
<!--
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="PLC连接状态" Margin="5"/>
<TextBlock Text="未连接" Foreground="Red" Margin="5"/>
<Button Content="连接" Margin="10,0" Padding="5,2"/>
<!-- 顶部PLC连接区域(尽量紧凑) -->
<Border Grid.Row="0" Background="White" Margin="0,0,0,5" Padding="5"
BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Ellipse x:Name="StatusEllipse" Width="16" Height="16"
Fill="{Binding StatusColor, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
Margin="0,0,5,0"/>
<TextBlock x:Name="StatusText"
Text="{Binding ConnectionStatus, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
FontSize="12" Foreground="#333" Margin="0,0,15,0"/>
<Button x:Name="PauseButton" Content="暂停" Width="70" Height="28" Margin="5,0"
Background="#E67E22" Foreground="White" BorderThickness="0" Click="PauseButton_Click"/>
<Button x:Name="ResumeButton" Content="继续" Width="70" Height="28" Margin="5,0"
Background="#27AE60" Foreground="White" BorderThickness="0" Click="ResumeButton_Click"/>
</StackPanel>
</Border>-->
</Border>
<!-- 数据显示区域 -->
<!-- 数据显示区域明确设置5行每行高度平均分配并强制所有行高度一致 -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
@@ -42,110 +40,109 @@
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- 工位1压力 -->
<Border Background="White" Margin="8" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="工位1压力" FontSize="14" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock x:Name="TbStation1Pressure" Text="0.0" FontSize="28" FontWeight="Bold" Foreground="#3498DB"/>
<TextBlock Text=" N" FontSize="16" Foreground="#666" Margin="3,5,0,0"/>
<Border Grid.Row="0" Grid.Column="0" Background="White" Margin="3" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2">
<TextBlock Text="工位1压力" FontSize="12" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
<TextBlock x:Name="TbStation1Pressure" Text="0.0" FontSize="24" FontWeight="Bold" Foreground="#3498DB"/>
<TextBlock Text=" N" FontSize="14" Foreground="#666" Margin="3,4,0,0"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 工位2压力 -->
<Border Background="White" Margin="8" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4" Grid.Column="1">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="工位2压力" FontSize="14" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock x:Name="TbStation2Pressure" Text="0.0" FontSize="28" FontWeight="Bold" Foreground="#E74C3C"/>
<TextBlock Text=" N" FontSize="16" Foreground="#666" Margin="3,5,0,0"/>
<Border Grid.Row="0" Grid.Column="1" Background="White" Margin="3" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2">
<TextBlock Text="工位2压力" FontSize="12" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
<TextBlock x:Name="TbStation2Pressure" Text="0.0" FontSize="24" FontWeight="Bold" Foreground="#E74C3C"/>
<TextBlock Text=" N" FontSize="14" Foreground="#666" Margin="3,4,0,0"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 摩擦力1 -->
<Border Background="White" Margin="8" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4" Grid.Row="1">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="摩擦力1" FontSize="14" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock x:Name="TbFriction1" Text="0.0" FontSize="28" FontWeight="Bold" Foreground="#F39C12"/>
<TextBlock Text=" N" FontSize="16" Foreground="#666" Margin="3,5,0,0"/>
<Border Grid.Row="1" Grid.Column="0" Background="White" Margin="3" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2">
<TextBlock Text="摩擦力1" FontSize="12" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
<TextBlock x:Name="TbFriction1" Text="0.0" FontSize="24" FontWeight="Bold" Foreground="#F39C12"/>
<TextBlock Text=" N" FontSize="14" Foreground="#666" Margin="3,4,0,0"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 摩擦力2 -->
<Border Background="White" Margin="8" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4" Grid.Row="1" Grid.Column="1">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="摩擦力2" FontSize="14" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock x:Name="TbFriction2" Text="0.0" FontSize="28" FontWeight="Bold" Foreground="#9B59B6"/>
<TextBlock Text=" N" FontSize="16" Foreground="#666" Margin="3,5,0,0"/>
<Border Grid.Row="1" Grid.Column="1" Background="White" Margin="3" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2">
<TextBlock Text="摩擦力2" FontSize="12" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
<TextBlock x:Name="TbFriction2" Text="0.0" FontSize="24" FontWeight="Bold" Foreground="#9B59B6"/>
<TextBlock Text=" N" FontSize="14" Foreground="#666" Margin="3,4,0,0"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 设定次数 -->
<Border Background="White" Margin="8" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4" Grid.Row="2">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="设定次数" FontSize="14" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock x:Name="txtcount1" Text="0" FontSize="28" FontWeight="Bold" Foreground="#F39C12"/>
<TextBlock Text=" 次" FontSize="16" Foreground="#666" Margin="3,5,0,0"/>
<Border Grid.Row="2" Grid.Column="0" Background="White" Margin="3" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2">
<TextBlock Text="设定次数" FontSize="12" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
<TextBlock x:Name="txtcount1" Text="0" FontSize="24" FontWeight="Bold" Foreground="#F39C12"/>
<TextBlock Text=" 次" FontSize="14" Foreground="#666" Margin="3,4,0,0"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 实际次数 -->
<Border Background="White" Margin="8" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4" Grid.Row="2" Grid.Column="1">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="实际次数" FontSize="14" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock x:Name="txtcount2" Text="0" FontSize="28" FontWeight="Bold" Foreground="#9B59B6"/>
<TextBlock Text=" 次" FontSize="16" Foreground="#666" Margin="3,5,0,0"/>
<Border Grid.Row="2" Grid.Column="1" Background="White" Margin="3" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2">
<TextBlock Text="实际次数" FontSize="12" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
<TextBlock x:Name="txtcount2" Text="0" FontSize="24" FontWeight="Bold" Foreground="#9B59B6"/>
<TextBlock Text=" 次" FontSize="14" Foreground="#666" Margin="3,4,0,0"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 设定次数 -->
<Border Background="White" Margin="8" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4" Grid.Row="3">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="温度1" FontSize="14" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock x:Name="txtT1" Text="0" FontSize="28" FontWeight="Bold" Foreground="#F39C12"/>
<TextBlock Text=" ℃" FontSize="16" Foreground="#666" Margin="3,5,0,0"/>
<!-- 温度1 -->
<Border Grid.Row="3" Grid.Column="0" Background="White" Margin="3" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2">
<TextBlock Text="温度1" FontSize="12" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
<TextBlock x:Name="txtT1" Text="0" FontSize="24" FontWeight="Bold" Foreground="#F39C12"/>
<TextBlock Text=" ℃" FontSize="14" Foreground="#666" Margin="3,4,0,0"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 实际次数 -->
<Border Background="White" Margin="8" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4" Grid.Row="3" Grid.Column="1">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="温度2" FontSize="14" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock x:Name="txtT2" Text="0" FontSize="28" FontWeight="Bold" Foreground="#9B59B6"/>
<TextBlock Text=" ℃" FontSize="16" Foreground="#666" Margin="3,5,0,0"/>
<!-- 温度2 -->
<Border Grid.Row="3" Grid.Column="1" Background="White" Margin="3" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2">
<TextBlock Text="温度2" FontSize="12" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
<TextBlock x:Name="txtT2" Text="0" FontSize="24" FontWeight="Bold" Foreground="#9B59B6"/>
<TextBlock Text=" ℃" FontSize="14" Foreground="#666" Margin="3,4,0,0"/>
</StackPanel>
</StackPanel>
</Border>
<Border Background="White" Margin="8" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4" Grid.Row="4" Grid.ColumnSpan="2">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="距离" FontSize="14" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock x:Name="txtDistince" Text="0" FontSize="28" FontWeight="Bold" Foreground="#F39C12"/>
<TextBlock Text=" m" FontSize="16" Foreground="#666" Margin="3,5,0,0"/>
<!-- 距离(跨两列,确保行高与其他行一致) -->
<Border Grid.Row="4" Grid.ColumnSpan="2" Background="White" Margin="3" BorderThickness="1" BorderBrush="#E0E0E0" CornerRadius="4">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2">
<TextBlock Text="距离" FontSize="12" FontWeight="Bold" Foreground="#333"/>
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
<TextBlock x:Name="txtDistince" Text="0" FontSize="24" FontWeight="Bold" Foreground="#F39C12"/>
<TextBlock Text=" m" FontSize="14" Foreground="#666" Margin="3,4,0,0"/>
</StackPanel>
</StackPanel>
</Border>
</Grid>
</Grid>
</UserControl>