Files
huadongmocaceshiyi/HomePage.xaml

160 lines
9.6 KiB
Plaintext
Raw Normal View History

2026-03-11 16:42:31 +08:00
<UserControl x:Class="PLCDataMonitor.HomePage"
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:PLCDataMonitor"
mc:Ignorable="d"
2026-03-11 19:11:06 +08:00
d:DesignHeight="700" d:DesignWidth="1000"
2026-03-11 16:42:31 +08:00
FontFamily="Microsoft YaHei">
2026-03-11 19:11:06 +08:00
<Grid Margin="5">
2026-03-11 16:42:31 +08:00
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
2026-03-11 19:11:06 +08:00
<!-- 顶部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"/>
2026-03-24 19:34:22 +08:00
<!--<Button x:Name="ResumeButton" Content="继续" Width="70" Height="28" Margin="5,0"
Background="#27AE60" Foreground="White" BorderThickness="0" Click="ResumeButton_Click"/>-->
2026-03-21 11:15:47 +08:00
<!-- 在 ResumeButton 后添加 -->
2026-03-23 17:31:25 +08:00
<local:AlarmScrollingText x:Name="AlarmScrollingCtrl"
2026-03-24 19:34:22 +08:00
Text="无报警"
Background="#FFF0F0F0"
Height="40"
Width="400"
Margin="5"
HorizontalAlignment="Center"/>
2026-03-11 16:42:31 +08:00
</StackPanel>
2026-03-11 19:11:06 +08:00
</Border>
2026-03-11 16:42:31 +08:00
2026-03-11 19:11:06 +08:00
<!-- 数据显示区域明确设置5行每行高度平均分配并强制所有行高度一致 -->
2026-03-11 16:42:31 +08:00
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
2026-03-11 19:11:06 +08:00
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
2026-03-11 16:42:31 +08:00
<!-- 工位1压力 -->
2026-03-11 19:11:06 +08:00
<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"/>
2026-03-11 16:42:31 +08:00
</StackPanel>
</StackPanel>
</Border>
<!-- 工位2压力 -->
2026-03-11 19:11:06 +08:00
<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"/>
2026-03-11 16:42:31 +08:00
</StackPanel>
</StackPanel>
</Border>
<!-- 摩擦力1 -->
2026-03-11 19:11:06 +08:00
<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"/>
2026-03-11 16:42:31 +08:00
</StackPanel>
</StackPanel>
</Border>
<!-- 摩擦力2 -->
2026-03-11 19:11:06 +08:00
<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"/>
2026-03-11 16:42:31 +08:00
</StackPanel>
</StackPanel>
</Border>
<!-- 设定次数 -->
2026-03-11 19:11:06 +08:00
<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"/>
2026-03-11 16:42:31 +08:00
</StackPanel>
</StackPanel>
</Border>
<!-- 实际次数 -->
2026-03-11 19:11:06 +08:00
<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"/>
2026-03-11 16:42:31 +08:00
</StackPanel>
</StackPanel>
</Border>
2026-03-11 19:11:06 +08:00
<!-- 温度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"/>
2026-03-11 16:42:31 +08:00
</StackPanel>
</StackPanel>
</Border>
2026-03-11 19:11:06 +08:00
<!-- 温度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"/>
2026-03-11 16:42:31 +08:00
</StackPanel>
</StackPanel>
</Border>
2026-03-11 19:11:06 +08:00
<!-- 距离(跨两列,确保行高与其他行一致) -->
<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"/>
2026-03-11 16:42:31 +08:00
</StackPanel>
</StackPanel>
</Border>
</Grid>
</Grid>
</UserControl>