This commit is contained in:
xyy
2026-06-16 20:50:05 +08:00
parent afef4f5cc6
commit 8c0af19f02
5 changed files with 148 additions and 39 deletions

View File

@@ -205,36 +205,56 @@
<!-- 主内容 (Row 3) -->
<Grid Grid.Row="3" Margin="0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="280"/>
<ColumnDefinition Width="380"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- 左侧控制区 -->
<Border Grid.Column="0" Background="White" CornerRadius="8" Padding="10" Margin="0,0,10,0" BorderBrush="#DDDDDD" BorderThickness="1">
<StackPanel>
<GroupBox Header="通讯控制" Margin="0,0,0,10">
<StackPanel>
<Button Command="{Binding ConnectCommand}" Content="连接PLC" Height="45"/>
<Button Command="{Binding DisconnectCommand}" Content="断开连接" Height="45"/>
</StackPanel>
</GroupBox>
<GroupBox Header="采样参数" Margin="0,0,0,10">
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,5">
<TextBlock Text="采样时间(秒):" Width="100" VerticalAlignment="Center" FontSize="14"/>
<TextBox Text="{Binding SampleTimeSeconds}" Width="80" IsEnabled="{Binding IsTesting, Converter={StaticResource InverseBoolConverter}}"/>
<ScrollViewer VerticalScrollBarVisibility="Auto" MaxHeight="450">
<StackPanel>
<GroupBox Header="通讯控制" Margin="0,0,0,10">
<StackPanel>
<Button Command="{Binding ConnectCommand}" Content="连接PLC" Height="45"/>
<Button Command="{Binding DisconnectCommand}" Content="断开连接" Height="45"/>
</StackPanel>
<Button Command="{Binding StartTestCommand}" Content="开始测试" Height="45" Margin="0,10,0,0" IsEnabled="{Binding IsTesting, Converter={StaticResource InverseBoolConverter}}"/>
<TextBlock Text="测试进行中..." Visibility="{Binding IsTesting, Converter={StaticResource BoolToVisibilityConverter}}" Foreground="Orange" FontWeight="Bold" FontSize="14" Margin="0,5,0,0" HorizontalAlignment="Center"/>
</StackPanel>
</GroupBox>
<GroupBox Header="数据分析">
<StackPanel>
<Button Command="{Binding CalculateCommand}" Content="计算结果" Height="45"/>
<Button Command="{Binding ExportReportCommand}" Content="导出报告" Height="45"/>
</StackPanel>
</GroupBox>
</StackPanel>
</GroupBox>
<GroupBox Header="采样参数" Margin="0,0,0,10">
<StackPanel>
<!-- 采样时间设置 -->
<StackPanel Orientation="Horizontal" Margin="0,5">
<TextBlock Text="采样时间(秒):" Width="100" VerticalAlignment="Center" FontSize="14"/>
<TextBox Text="{Binding SampleTimeSeconds}" Width="80" IsEnabled="{Binding IsTesting, Converter={StaticResource InverseBoolConverter}}"/>
</StackPanel>
<!-- 阀门与泵独立控制(手动调试用) -->
<Border BorderBrush="#CCCCCC" BorderThickness="1" CornerRadius="5" Padding="5" Margin="0,5">
<StackPanel>
<TextBlock Text="手动控制" FontWeight="Bold" FontSize="12" Foreground="Gray" Margin="0,0,0,5"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Command="{Binding OpenValveCommand}" Content="开阀(M5)" Width="70" Height="30" Margin="2" Background="#3498DB" Foreground="White"/>
<Button Command="{Binding CloseValveCommand}" Content="关阀(M5)" Width="70" Height="30" Margin="2" Background="#E74C3C" Foreground="White"/>
<Button Command="{Binding StartPumpCommand}" Content="启泵(M6)" Width="70" Height="30" Margin="2" Background="#2ECC71" Foreground="White"/>
<Button Command="{Binding StopPumpCommand}" Content="停泵(M6)" Width="70" Height="30" Margin="2" Background="#E67E22" Foreground="White"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 自动测试按钮 -->
<Button Command="{Binding StartTestCommand}" Content="开始测试" Height="45" Margin="0,10,0,0" IsEnabled="{Binding IsTesting, Converter={StaticResource InverseBoolConverter}}"/>
<TextBlock Text="测试进行中..." Visibility="{Binding IsTesting, Converter={StaticResource BoolToVisibilityConverter}}" Foreground="Orange" FontWeight="Bold" FontSize="14" Margin="0,5,0,0" HorizontalAlignment="Center"/>
<Button Command="{Binding StopTestCommand}" Content="停止测试" Height="45" Margin="0,10,0,0" Background="#E74C3C" Foreground="White" />
</StackPanel>
</GroupBox>
<GroupBox Header="数据分析">
<StackPanel>
<Button Command="{Binding CalculateCommand}" Content="计算结果" Height="45"/>
<Button Command="{Binding ExportReportCommand}" Content="导出报告" Height="45"/>
</StackPanel>
</GroupBox>
</StackPanel>
</ScrollViewer>
</Border>
<!-- 右侧称重数据表格 -->