160 lines
9.6 KiB
XML
160 lines
9.6 KiB
XML
<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"
|
||
d:DesignHeight="700" d:DesignWidth="1000"
|
||
FontFamily="Microsoft YaHei">
|
||
|
||
<Grid Margin="5">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="*"/>
|
||
</Grid.RowDefinitions>
|
||
|
||
<!-- 顶部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"/>-->
|
||
|
||
|
||
<!-- 在 ResumeButton 后添加 -->
|
||
|
||
<local:AlarmScrollingText x:Name="AlarmScrollingCtrl"
|
||
Text="无报警"
|
||
Background="#FFF0F0F0"
|
||
Height="40"
|
||
Width="400"
|
||
Margin="5"
|
||
HorizontalAlignment="Center"/>
|
||
|
||
</StackPanel>
|
||
</Border>
|
||
|
||
<!-- 数据显示区域:明确设置5行,每行高度平均分配,并强制所有行高度一致 -->
|
||
<Grid Grid.Row="1">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="*"/>
|
||
<RowDefinition Height="*"/>
|
||
<RowDefinition Height="*"/>
|
||
<RowDefinition Height="*"/>
|
||
<RowDefinition Height="*"/>
|
||
</Grid.RowDefinitions>
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="*"/>
|
||
<ColumnDefinition Width="*"/>
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<!-- 工位1压力 -->
|
||
<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 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 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 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 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 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>
|
||
|
||
<!-- 温度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>
|
||
|
||
<!-- 温度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 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> |