<Window x:Class="ShanghaiEnvironmentalTechnology.Window5"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="{DynamicResource test}" WindowState="Maximized"   Height="768" Width="1024"
        Loaded="Window_Loaded"
        Background="#F5F7FA" WindowStartupLocation="CenterScreen">
    <Window.Resources>

        <Style x:Key="MyButtonStyle" TargetType="Button">
            <Setter Property="Background" Value="#4A90E2"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Padding" Value="8,4"/>
            <Setter Property="BorderBrush" Value="Transparent"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Height" Value="30"/>
            <Setter Property="Width" Value="100"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Background="{TemplateBinding Background}" CornerRadius="15">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="#3A7BBE"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Background" Value="#2A5E9A"/>
                </Trigger>
            </Style.Triggers>
        </Style>


        <Style x:Key="MyTextBoxStyle" TargetType="TextBox">
            <Setter Property="Background" Value="#FFFFFF"/>
            <Setter Property="Foreground" Value="Black"/>
            <Setter Property="BorderBrush" Value="#4A90E2"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Padding" Value="5,5"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Height" Value="30"/>
            <Setter Property="Width" Value="80"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TextBox">
                        <Border Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}" 
                                CornerRadius="15">
                            <ScrollViewer x:Name="PART_ContentHost"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


        <Style x:Key="SectionTitleStyle" TargetType="TextBlock">
            <Setter Property="FontSize" Value="16"/>
            <Setter Property="FontWeight" Value="Medium"/>
            <Setter Property="Foreground" Value="#333333"/>
            <Setter Property="Margin" Value="0,0,0,10"/>
            <Setter Property="Padding" Value="5"/>
            <Setter Property="Background" Value="#E8F4FF"/>
            <!-- 浅蓝背景强化分区 -->
        </Style>


        <Style x:Key="ParamLabelStyle" TargetType="TextBlock">
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Foreground" Value="#666666"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Width" Value="130"/>
            <!-- 固定宽度，对齐更整齐 -->
            <Setter Property="Margin" Value="5,0"/>
        </Style>


        <Style x:Key="MonitorLabelStyle" TargetType="TextBlock">
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="FontWeight" Value="Medium"/>
            <Setter Property="Foreground" Value="#333333"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Margin" Value="10,0"/>
        </Style>

        <!-- 监测数据文本框（区分只读状态） -->
        <Style x:Key="MonitorTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource MyTextBoxStyle}">
            <Setter Property="IsReadOnly" Value="True"/>
            <Setter Property="Background" Value="#F0F7FF"/>
            <!-- 浅蓝背景区分只读数据 -->
            <Setter Property="Width" Value="100"/>
            <!-- 监测数据框稍宽，更易读 -->
            <Setter Property="BorderBrush" Value="#99C2FF"/>
        </Style>

    </Window.Resources>

    <!-- 主布局：DockPanel分区，避免元素重叠 -->
    <DockPanel Margin="15">
        <!-- 1. 顶部标题区（突出显示） -->
        <!--<Border DockPanel.Dock="Top" Height="60" Background="#4A90E2" CornerRadius="8" Margin="0,0,0,15">
            <TextBlock Text="{DynamicResource test}" 
                       HorizontalAlignment="Center" 
                       VerticalAlignment="Center" 
                       FontSize="24" 
                       Foreground="White"
                       FontWeight="Medium"/>
        </Border>-->
        <!-- 1. 顶部标题区（突出显示 + 左上角下拉框） -->
        <Border DockPanel.Dock="Top" Height="60" Background="#4A90E2" CornerRadius="8" Margin="0,0,0,15">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <!-- 下拉框 -->
                    <ColumnDefinition Width="*"/>
                    <!-- 居中标题 -->
                    <ColumnDefinition Width="Auto"/>
                    <!-- 右侧留白占位，保持对称 -->
                </Grid.ColumnDefinitions>

                <!-- 左上角下拉框 -->
                <ComboBox Grid.Column="0" 
                  Width="120" 
                  Height="30" 
                  VerticalAlignment="Center" 
                  Margin="15,0,0,0"
                  Background="White" SelectionChanged="CaptureModeComboBox_SelectionChanged">
                    <ComboBoxItem Content="YY0671" IsSelected="True"/>
                    <ComboBoxItem Content="{DynamicResource customize}"  />

                </ComboBox>

                <!-- 标题依然居中 -->
                <TextBlock Grid.Column="1" 
                   Text="{DynamicResource test}" 
                   HorizontalAlignment="Center" 
                   VerticalAlignment="Center" 
                   FontSize="24" 
                   Foreground="White"
                   FontWeight="Medium"/>

                <!-- 右侧留空（保证标题居中视觉效果） -->
                <Rectangle Grid.Column="2" Width="120" Visibility="Hidden"/>
            </Grid>
        </Border>
        <!-- 2. 底部操作与导航区（聚合功能按钮） -->
        <Border DockPanel.Dock="Bottom" Height="120" Background="White" 
                BorderBrush="#E0E0E0" BorderThickness="1" 
                CornerRadius="8" Margin="0,15,0,0">
            <StackPanel>
                <!-- 测试核心操作按钮（按重要性区分颜色） -->
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,5">
                    <Button Name="ResetBtn" Content="{DynamicResource test19}" Style="{StaticResource MyButtonStyle}" 
                            Background="#F5A623" Click="Button_Click_10"/>
                    <!-- 橙色：警示性操作 -->
                    <Button Name="TestStartButton" Content="{DynamicResource test20}" Style="{StaticResource MyButtonStyle}" 
                            Background="#52C41A" Click="Button_Click_11"/>
                    <!-- 绿色：正向操作 -->
                    <Button Content="{DynamicResource test21}" Style="{StaticResource MyButtonStyle}" 
                            Background="#FF4D4F" Click="Button_Click_12"/>

                    <Button Name="addPaBtn" Content="{DynamicResource test22}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_16" Width="109"/>
                    <!-- 红色：停止操作 -->
                    <Button Content="{DynamicResource test23}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_13" Width="111"/>
                    <Button Content="{DynamicResource test24}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_14" Width="138"/>
                </StackPanel>

                <!-- 导航按钮（统一放置底部） -->
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,5">
                    <Button Content="{DynamicResource test25}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_4"/>
                    <Button Content="{DynamicResource test26}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_6"/>
                    <Button Content="{DynamicResource test27}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_7" Width="125"/>
                    <Button Content="{DynamicResource test28}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_8" Width="115"/>
                    <Button Content="{DynamicResource test29}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_9" Width="127"/>
                </StackPanel>
            </StackPanel>
        </Border>

        <!-- 3. 中间内容区：左右分栏（设置+监测） -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <!-- 左侧：参数设置区 -->
                <ColumnDefinition Width="1*"/>
                <!-- 右侧：实时监测区 -->
            </Grid.ColumnDefinitions>

            <!-- 左侧：参数设置区（聚合可配置项） -->
            <Border Grid.Column="0" Background="White" 
                    BorderBrush="#E0E0E0" BorderThickness="1" 
                    CornerRadius="8" Margin="0,0,10,0" Padding="15">
                <StackPanel>
                    <!-- 3.1.1 呼吸参数设置（核心配置项） -->

                    <TextBlock Text="{DynamicResource test111}" Style="{StaticResource SectionTitleStyle}"/>

                    <StackPanel Margin="0,0,0,20" HorizontalAlignment="Center">

                        <Grid Width="459">

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="142"/>

                                <ColumnDefinition/>

                                <ColumnDefinition Width="69"/>

                            </Grid.ColumnDefinitions>


                            <Grid.RowDefinitions>
                                <RowDefinition Height="60"/>
                                <RowDefinition Height="60"/>
                                <RowDefinition Height="60"/>
                                <RowDefinition Height="60"/>
                            </Grid.RowDefinitions>


                            <TextBlock Grid.Column="0"
                       Text="{DynamicResource test1}" 
                       Style="{StaticResource ParamLabelStyle}" 
                       TextAlignment="Left" Height="18" Margin="10,0,2,0"/>


                            <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Height="30">
                                <TextBox Name="OutTxt" 
                         Style="{StaticResource MyTextBoxStyle}" 
                         Width="45"
                         PreviewTextInput="NumberPreviewTextInput" 
                         IsReadOnly="True"/>
                                <Button Name="btn1" Content="{DynamicResource test2}"  
                        Style="{StaticResource MyButtonStyle}"  
                        Width="61" 
                        Margin="5,0" 
                        Click="Button_Click_17"/>
                                <TextBlock Text=": " VerticalAlignment="Center" Margin="5,0"/>
                                <TextBox Name="InTxt" 
                         Style="{StaticResource MyTextBoxStyle}" 
                         Width="45"
                         PreviewTextInput="NumberPreviewTextInput" 
                         IsReadOnly="True"/>
                                <Button Name="btn2" Content="{DynamicResource test2}" 
                        Style="{StaticResource MyButtonStyle}"  
                        Width="57" 
                        Margin="10,0" 
                        Click="Button_Click_18"/>
                            </StackPanel>

                            <!-- 2. 潮气量设置 -->
                            <TextBlock Grid.Row="1" Grid.Column="0"
                       Text="{DynamicResource test3}" 
                       Style="{StaticResource ParamLabelStyle}" 
                       TextAlignment="Left" Height="18" Margin="10,0,2,0"/>

                            <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Height="30">
                                <TextBox Name="moistureTxt" 
                         Style="{StaticResource MyTextBoxStyle}" 
                         Width="80"
                         PreviewTextInput="NumberPreviewTextInput" 
                         IsReadOnly="True"/>
                                <TextBlock Text=" L" VerticalAlignment="Center" Margin="5,0"/>
                            </StackPanel>

                            <Button Name="btn3" Grid.Row="1" Grid.Column="1"
                    Content="{DynamicResource test2}" 
                    Style="{StaticResource MyButtonStyle}" 
                    Width="80" 
                    Margin="200,0,8,0"
                    Click="Button_Click_19"
                    VerticalAlignment="Center" Height="30" Grid.ColumnSpan="2"/>

                            <!-- 3. 呼吸频率设置 -->
                            <TextBlock Grid.Row="2" Grid.Column="0"
                       Text="{DynamicResource test4}" 
                       Style="{StaticResource ParamLabelStyle}" 
                       TextAlignment="Left" Height="18" Margin="10,0,2,0"/>

                            <StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Height="30">
                                <TextBox Name="respiratoryRateTxt" 
                         Style="{StaticResource MyTextBoxStyle}" 
                         Width="80"
                         PreviewTextInput="NumberPreviewTextInput" 
                         IsReadOnly="True"/>
                                <TextBlock Text="{DynamicResource test8}" VerticalAlignment="Center" Margin="5,0"/>
                            </StackPanel>

                            <Button Name="btn4" Grid.Row="2" Grid.Column="1"
                    Content="{DynamicResource test2}" 
                    Style="{StaticResource MyButtonStyle}" 
                    Width="80" 
                    Margin="200,0,11,0"
                    Click="Button_Click_20"
                    VerticalAlignment="Center" Height="30" Grid.ColumnSpan="2"/>

                            <!-- 4. 频率系数设置 -->
                            <TextBlock Grid.Row="3" Grid.Column="0"
                       Text="{DynamicResource test5}" 
                       Style="{StaticResource ParamLabelStyle}" 
                       TextAlignment="Left" Height="18" Margin="10,0,2,0"/>

                            <StackPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Height="30">
                                <TextBox x:Name="frequencyTxt" 
                         Style="{StaticResource MyTextBoxStyle}" 
                         Width="80"
                         PreviewTextInput="NumberPreviewTextInput" 
                         IsReadOnly="True"/>
                            </StackPanel>

                            <Button Name="btn5" Grid.Row="3" Grid.Column="1"
                    Content="{DynamicResource test2}" 
                    Style="{StaticResource MyButtonStyle}" 
                    Width="80" 
                    Margin="200,0,11,0"
                    Click="Button_Click_21"
                    VerticalAlignment="Center" Height="30" Grid.ColumnSpan="2"/>
                        </Grid>
                    </StackPanel>




                    <!-- 3.1.2 测试辅助参数（状态类参数） -->
                    <TextBlock Text="{DynamicResource test6}" Style="{StaticResource SectionTitleStyle}"/>
                    <StackPanel Margin="0,0,0,10">
                        <!-- 呼吸次数 -->
                        <StackPanel Orientation="Horizontal" Height="40" VerticalAlignment="Center">
                            <TextBlock Text="{DynamicResource test7}" Style="{StaticResource ParamLabelStyle}" Width="124"/>
                            <TextBox Name="respiratoryCountTxt" Style="{StaticResource MonitorTextBoxStyle}"/>
                            <TextBlock Text="{DynamicResource test8}" VerticalAlignment="Center" Margin="5"/>
                        </StackPanel>

                        <!-- 呼吸时间计时 -->
                        <StackPanel Orientation="Horizontal" Height="40" VerticalAlignment="Center">
                            <TextBlock Text="{DynamicResource test77}" Style="{StaticResource ParamLabelStyle}" Width="124"/>
                            <TextBox Name="breathTimeBegin" Style="{StaticResource MonitorTextBoxStyle}"/>
                            <TextBlock Text="{DynamicResource test9}" VerticalAlignment="Center" Margin="5"/>
                            <TextBox Name="breathTimeEnd" Style="{StaticResource MonitorTextBoxStyle}"/>
                            <TextBlock Text="{DynamicResource test10}" VerticalAlignment="Center" Margin="5"/>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            </Border>

            <!-- 右侧：实时监测区（聚合监测数据） -->
            <Border Grid.Column="1" Background="White" 
                    BorderBrush="#E0E0E0" BorderThickness="1" 
                    CornerRadius="8" Margin="10,0,0,0" Padding="15">

                <StackPanel>
                    <!-- 3.2.1 实时监测数据（核心监测项） -->
                    <TextBlock Text="{DynamicResource test11}" Style="{StaticResource SectionTitleStyle}"/>


                    <StackPanel Margin="0,0,0,20">

                        <!-- 呼吸类型显示控件 -->
                        <TextBlock Name="breathType" Text="{DynamicResource test1212}" Style="{StaticResource SectionTitleStyle}"
                                   FontSize="16" Foreground="Gray"/>


                        <!-- 呼吸管路压力 -->
                        <StackPanel Orientation="Horizontal" Height="45" VerticalAlignment="Center">
                            <TextBlock Text="{DynamicResource test13}" Style="{StaticResource MonitorLabelStyle}"/>
                            <TextBox Name="RespiratoryPressureTxt" Style="{StaticResource MonitorTextBoxStyle}"/>
                            <TextBlock Text=" Pa" VerticalAlignment="Center"/>
                        </StackPanel>

                        <!-- CO₂浓度 -->
                        <StackPanel Orientation="Horizontal" Height="45" VerticalAlignment="Center">
                            <TextBlock Text="{DynamicResource test14}" Style="{StaticResource MonitorLabelStyle}"/>
                            <TextBox Name="CO2PressureTxt" Style="{StaticResource MonitorTextBoxStyle}"/>
                            <TextBlock Text=" %" VerticalAlignment="Center"/>
                        </StackPanel>
                    </StackPanel>

                    <!-- 3.2.2 CO₂测试结果（专项结果） -->
                    <TextBlock Text="{DynamicResource test15}" Style="{StaticResource SectionTitleStyle}"/>
                    <StackPanel>
                        <!-- 开始CO₂浓度 -->
                        <StackPanel Orientation="Horizontal" Height="45" VerticalAlignment="Center">
                            <TextBlock Text="{DynamicResource test16}" Style="{StaticResource MonitorLabelStyle}"/>
                            <TextBox Name="CO2BeginTb" Style="{StaticResource MonitorTextBoxStyle}"/>
                            <TextBlock Text=" %" VerticalAlignment="Center"/>
                        </StackPanel>

                        <!-- 结束CO₂浓度 -->
                        <StackPanel Orientation="Horizontal" Height="45" VerticalAlignment="Center">
                            <TextBlock Text="{DynamicResource test17}" Style="{StaticResource MonitorLabelStyle}"/>
                            <TextBox Name="CO2EndTb" Style="{StaticResource MonitorTextBoxStyle}"/>
                            <TextBlock Text=" %" VerticalAlignment="Center"/>
                        </StackPanel>

                        <!-- CO₂浓度增加值 -->
                        <StackPanel Orientation="Horizontal" Height="45" VerticalAlignment="Center">
                            <TextBlock Text="{DynamicResource test18}" Style="{StaticResource MonitorLabelStyle}"/>
                            <TextBox Name="CO2AddTxt" Style="{StaticResource MonitorTextBoxStyle}"/>
                            <TextBlock Text=" %" VerticalAlignment="Center"/>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            </Border>
        </Grid>
    </DockPanel>
</Window>