Files
zijiuqizonghejianyanyi/MainWindow.xaml

319 lines
18 KiB
Plaintext
Raw Permalink Normal View History

2026-03-11 15:21:27 +08:00
<Window x:Class="自救器呼吸器综合检验仪.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:自救器呼吸器综合检验仪"
2026-03-16 19:10:33 +08:00
Title="自救器呼吸器综合检验仪" Height="600" Width="1024" WindowState="Maximized"
2026-03-11 15:21:27 +08:00
WindowStartupLocation="CenterScreen"
Background="Transparent"
FontFamily="Microsoft YaHeui" Loaded="Window_Loaded" Closed="Window_Closed" Closing="Window_Closing">
<Window.DataContext>
<local:MainViewModel />
</Window.DataContext>
2026-03-16 19:10:33 +08:00
2026-03-11 15:21:27 +08:00
<Window.Resources>
<Style x:Key="LabelStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="11"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Margin" Value="3,2"/>
</Style>
<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontSize" Value="11"/>
<Setter Property="Height" Value="22"/>
<Setter Property="Width" Value="65"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Margin" Value="3,2"/>
<Setter Property="BorderBrush" Value="#CCCCCC"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
</Window.Resources>
2026-03-16 19:10:33 +08:00
2026-03-11 15:21:27 +08:00
<!-- 背景层 -->
<Grid>
<!-- 背景图片 -->
<Grid.Background>
<ImageBrush ImageSource="Resources/sleep2.jpg" Stretch="UniformToFill" Opacity="0.15"/>
</Grid.Background>
<!-- 背景遮罩层 -->
<Rectangle Fill="#1E3A5F" Opacity="0.85"/>
<!-- 主内容容器 -->
<Grid Margin="25">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 顶部标题栏 -->
<Border Grid.Row="0" Background="#2A4B6D" BorderBrush="#3A5B8C" BorderThickness="0,0,0,2"
Margin="0,0,0,20" Padding="25,15">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- 主标题 -->
<StackPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock Text="定量供应检验系统"
FontSize="26" FontWeight="Bold" Foreground="White"/>
<!--<TextBlock Text="定量供应检验系统"
2026-03-16 19:10:33 +08:00
FontSize="14" Foreground="#CCFFFFFF" Margin="0,5,0,0"/>-->
2026-03-11 15:21:27 +08:00
</StackPanel>
2026-03-16 19:58:18 +08:00
<StackPanel Grid.Column="2" Orientation="Horizontal" Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center">
2026-03-11 15:21:27 +08:00
<TextBlock Text="样品编号:" FontSize="26" FontWeight="Bold" Foreground="White" Style="{StaticResource LabelStyle}"/>
<TextBox x:Name="pressureDiff2" Text="" Width="180" Style="{StaticResource TextBoxStyle}" LostFocus="pressureDiff2_GotFocus"/>
2026-03-16 19:58:18 +08:00
<Border Background="White" Padding="15,8" Margin="15,0,0,0" VerticalAlignment="Center">
<TextBlock Text="{Binding CurrentTime, StringFormat='yyyy-MM-dd HH:mm:ss'}"
FontSize="12" FontWeight="Bold" Foreground="#2C3E50"/>
</Border>
2026-03-11 15:21:27 +08:00
</StackPanel>
<!-- 状态指示 -->
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,30,0">
<Border Background="#27AE60" Padding="12,6" Margin="0,0,15,0">
<TextBlock Text="系统状态:" FontSize="12" Foreground="White" FontWeight="Bold"/>
</Border>
<Border x:Name="statusPanel" Background="#3498DB" Padding="12,6">
<TextBlock x:Name="status" Text="空闲" FontSize="12" Foreground="White" FontWeight="Bold"/>
</Border>
</StackPanel>
</Grid>
</Border>
<!-- 主内容区域 -->
<Grid Grid.Row="1" Margin="0,0,0,20">
<Grid.ColumnDefinitions>
2026-03-16 19:10:33 +08:00
<ColumnDefinition Width="3*"/>
2026-03-11 15:21:27 +08:00
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<!-- 左侧:配置与监控区 -->
<Grid Grid.Column="0" Margin="0,0,20,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 参数配置区 -->
<Border Grid.Row="0" Background="White" Margin="0,0,0,20"
BorderBrush="#E1E8ED" BorderThickness="1">
<StackPanel Margin="30,25">
2026-03-16 19:10:33 +08:00
2026-03-11 15:21:27 +08:00
<TextBlock Text="⚙️ 参数配置" FontSize="20" FontWeight="Bold"
Foreground="#2C3E50" Margin="0,0,0,20"/>
2026-03-16 19:10:33 +08:00
2026-03-11 15:21:27 +08:00
<!-- 检验时间配置 -->
2026-03-16 19:10:33 +08:00
<Grid Margin="0,0,0,15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Text="检验时间:" VerticalAlignment="Center"
2026-03-11 15:21:27 +08:00
FontSize="14" FontWeight="SemiBold" Foreground="#2C3E50"/>
2026-03-16 19:10:33 +08:00
<TextBox Grid.Column="1" x:Name="settingtime" Text="0" Width="100" Height="35"
2026-03-11 15:21:27 +08:00
VerticalContentAlignment="Center" TextAlignment="Center"
BorderBrush="#DCDFE6" BorderThickness="1" Background="#FAFBFC"
FontSize="14" TextChanged="settingtime_TextChanged"/>
2026-03-16 19:10:33 +08:00
<TextBlock Grid.Column="2" Text="秒" Margin="15,0,20,0" VerticalAlignment="Center"
2026-03-11 15:21:27 +08:00
FontSize="14" Foreground="#7F8C8D"/>
<Button Content="🔧 设置参数" Click="BtnWrite401_Click"
2026-03-16 19:10:33 +08:00
Grid.Row="1" Grid.Column="0"
Background="#3498DB" Foreground="White" FontSize="13" FontWeight="Bold" Height="38" BorderThickness="0" Margin="0,12,53,0"
Cursor="Hand" Grid.ColumnSpan="2"/>
2026-03-11 15:21:27 +08:00
<Button x:Name="btn_flow2" Content="定量供氧L/min" Click="BtnWrite400_Click"
2026-03-16 19:10:33 +08:00
Grid.Row="1" Grid.Column="1"
Background="#3498DB" Foreground="White" FontSize="13" FontWeight="Bold" Height="38" BorderThickness="0" Margin="91,12,8,0"
Cursor="Hand" Grid.ColumnSpan="3"/>
2026-03-11 15:21:27 +08:00
<Button x:Name="btn_flow3" Content="自动/手动补给供氧(L/min)" Click="BtnWrite400_Click1"
2026-03-16 19:10:33 +08:00
Grid.Row="1" Grid.Column="4" Grid.ColumnSpan="2"
Background="#3498DB" Foreground="White" FontSize="12" FontWeight="Bold"
Height="38" BorderThickness="0" Padding="12,0" Margin="44,12,24,0" Cursor="Hand"/>
2026-03-11 15:21:27 +08:00
<!--<Border Background="#F8F9FA" Padding="10,6" BorderBrush="#E1E8ED" BorderThickness="1">-->
2026-03-16 19:10:33 +08:00
<!--<TextBlock x:Name="label_flow" Text="0-100L/min" VerticalAlignment="Center"
2026-03-11 15:21:27 +08:00
FontSize="12" FontWeight="Bold" Foreground="#3498DB"/>-->
2026-03-16 19:10:33 +08:00
2026-03-11 15:21:27 +08:00
<!--</Border>-->
2026-03-16 19:10:33 +08:00
</Grid>
2026-03-11 15:21:27 +08:00
<!-- 试验时间显示 -->
<!--<StackPanel Orientation="Horizontal">
<TextBlock Text="试验时间:" Width="100" VerticalAlignment="Center"
FontSize="14" FontWeight="SemiBold" Foreground="#2C3E50"/>
<TextBox Text="0" Width="70" Height="35" VerticalContentAlignment="Center"
TextAlignment="Center" BorderBrush="#DCDFE6" BorderThickness="1"
Background="#FAFBFC" FontSize="14"/>
<TextBlock Text="分" Margin="10,0,25,0" VerticalAlignment="Center"
FontSize="14" Foreground="#7F8C8D"/>
<TextBox Text="0" Width="70" Height="35" VerticalContentAlignment="Center"
TextAlignment="Center" BorderBrush="#DCDFE6" BorderThickness="1"
Background="#FAFBFC" FontSize="14"/>
<TextBlock Text="秒" Margin="10,0,0,0" VerticalAlignment="Center"
FontSize="14" Foreground="#7F8C8D"/>
</StackPanel>-->
</StackPanel>
</Border>
<!-- 实时数据监控 -->
<Border Grid.Row="1" Background="White" BorderBrush="#E1E8ED" BorderThickness="1">
<StackPanel Margin="30,25">
<TextBlock Text="📊 实时数据监控" FontSize="20" FontWeight="Bold"
Foreground="#2C3E50" Margin="0,0,0,25"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- 当前流量 -->
<Border Grid.Column="0" Background="#F8F9FA" Margin="15" Padding="25,20"
BorderBrush="#E1E8ED" BorderThickness="1">
<StackPanel>
<TextBlock Text="当前流量" FontSize="13" Foreground="#7F8C8D"
FontWeight="SemiBold" Margin="0,0,0,12"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock x:Name="min" Text="0.00" FontSize="24" FontWeight="Bold"
Foreground="#2C3E50"/>
<TextBlock Text="L/min" FontSize="13" Foreground="#7F8C8D"
VerticalAlignment="Bottom" Margin="8,0,0,3"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 试验时间 -->
<Border Grid.Column="1" Background="#F8F9FA" Margin="15" Padding="25,20"
BorderBrush="#E1E8ED" BorderThickness="1">
<StackPanel>
<TextBlock Text="试验时间" FontSize="13" Foreground="#7F8C8D"
FontWeight="SemiBold" Margin="0,0,0,12"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock x:Name="second" Text="0.00" FontSize="24" FontWeight="Bold"
Foreground="#2C3E50"/>
<TextBlock Text="秒" FontSize="13" Foreground="#7F8C8D"
VerticalAlignment="Bottom" Margin="8,0,0,3"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 供氧流量 -->
<Border Grid.Column="2" Background="#F8F9FA" Margin="15" Padding="25,20"
BorderBrush="#E1E8ED" BorderThickness="1">
<StackPanel>
<TextBlock Text="供氧流量" FontSize="13" Foreground="#7F8C8D"
FontWeight="SemiBold" Margin="0,0,0,12"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock x:Name="speed" Text="0.00" FontSize="24" FontWeight="Bold"
Foreground="#2C3E50"/>
<TextBlock Text="L/min" FontSize="13" Foreground="#7F8C8D"
VerticalAlignment="Bottom" Margin="8,0,0,3"/>
</StackPanel>
</StackPanel>
</Border>
2026-03-16 19:10:33 +08:00
2026-03-11 15:21:27 +08:00
</Grid>
</StackPanel>
</Border>
</Grid>
<!-- 右侧:操作控制区 -->
<StackPanel Grid.Column="1">
<!-- 数据管理 -->
<Border Background="White" Margin="0,0,0,20" BorderBrush="#E1E8ED" BorderThickness="1">
<StackPanel Margin="25,20">
<TextBlock Text="💾 数据管理" FontSize="18" FontWeight="Bold" Foreground="#2C3E50"
HorizontalAlignment="Center" Margin="0,0,0,20"/>
<Button Content="📝 记录数据" Click="Button_Click"
Background="#3498DB" Foreground="White" FontSize="14" FontWeight="Bold"
Height="50" BorderThickness="0" Cursor="Hand"/>
</StackPanel>
</Border>
<!-- 测试控制 -->
<Border Background="White" BorderBrush="#E1E8ED" BorderThickness="1">
<StackPanel Margin="25,20">
<TextBlock Text="🎛️ 测试控制" FontSize="18" FontWeight="Bold" Foreground="#2C3E50"
HorizontalAlignment="Center" Margin="0,0,0,20"/>
<Button Content="🚀 启动测试" Click="Button_Click_1"
Background="#27AE60" Foreground="White" FontSize="14" FontWeight="Bold"
Height="50" BorderThickness="0" Margin="0,0,0,12" Cursor="Hand"/>
<Button Content="🛑 停止测试" Click="Button_Click_2"
Background="#E74C3C" Foreground="White" FontSize="14" FontWeight="Bold"
Height="50" BorderThickness="0" Margin="0,0,0,12" Cursor="Hand"/>
<Button Content="📡 开始采集" Click="Button_Click_3"
Background="#3498DB" Foreground="White" FontSize="13" FontWeight="Bold"
Height="45" BorderThickness="0" Cursor="Hand"/>
</StackPanel>
</Border>
</StackPanel>
</Grid>
<!-- 底部导航 -->
<Border Grid.Row="2" Background="White" BorderBrush="#E1E8ED" BorderThickness="1,0,0,0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="15,12">
<Button x:Name="btn_setting"
Content=""
Click="btn_setting_Click"
Background="Transparent"
BorderBrush="Transparent"
Foreground="Transparent"
Opacity="0"
Width="140" Height="40"
Margin="8,5"
Cursor="Hand"/>
<Button Content="🔬 定量供应检验"
Background="#3498DB" Foreground="White" FontSize="12" FontWeight="Bold"
Width="140" Height="40" BorderThickness="0" Margin="8,5" Cursor="Hand"/>
<Button Content="📉 负压气密性检验" Click="Button_Click_5"
Background="White" Foreground="#2C3E50" FontSize="12" FontWeight="Bold"
Width="140" Height="40" BorderBrush="#3498DB" BorderThickness="1" Margin="8,5"
Cursor="Hand"/>
<Button Content="📈 正压气密性检验" Click="Button_Click_6"
Background="White" Foreground="#2C3E50" FontSize="12" FontWeight="Bold"
Width="140" Height="40" BorderBrush="#3498DB" BorderThickness="1" Margin="8,5"
Cursor="Hand"/>
<Button Content="⚡ 排气阀压力测试" Click="Button_Click_7"
Background="White" Foreground="#2C3E50" FontSize="12" FontWeight="Bold"
Width="140" Height="40" BorderBrush="#3498DB" BorderThickness="1" Margin="8,5"
Cursor="Hand"/>
</StackPanel>
</Border>
</Grid>
</Grid>
2026-03-16 19:10:33 +08:00
</Window>