Files
Sleep-Multi-functionality/Window4.xaml

324 lines
15 KiB
Plaintext
Raw Normal View History

2026-05-04 14:46:58 +08:00
<Window x:Class="ShanghaiEnvironmentalTechnology.Window4"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="单一故障气阻测试" Height="768" Width="1024"
Loaded="Window_Loaded"
WindowStartupLocation="CenterScreen">
<Window.Resources>
<!-- 原有样式保持不变 -->
<Style x:Key="MyButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#4A90E2"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="10"/>
<Setter Property="Padding" Value="10,5"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Width" Value="120"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="20">
<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="2"/>
<Setter Property="Padding" Value="10,10"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Width" Value="120"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="20">
<ScrollViewer x:Name="PART_ContentHost"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MyComboBoxStyle" TargetType="ComboBox">
<Setter Property="Background" Value="#FFFFFF"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="BorderBrush" Value="#4A90E2"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Width" Value="150"/>
<Setter Property="Margin" Value="10"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5">
<Grid>
<ToggleButton IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Focusable="False"
ClickMode="Press">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<ContentPresenter HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="5,0,0,0"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>
<Path Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 0 L 4 4 L 8 0 Z"
Fill="Black"/>
</Grid>
</ToggleButton>
<Popup IsOpen="{TemplateBinding IsDropDownOpen}"
Placement="Bottom"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide">
<Grid MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border Background="White"
BorderBrush="#4A90E2"
BorderThickness="2"
CornerRadius="5"/>
<ScrollViewer Margin="1">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</ScrollViewer>
</Grid>
</Popup>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="0">
<Grid Margin="20">
<StackPanel>
<TextBlock Text="呼气/吸气"
FontSize="24"
FontWeight="Bold"
HorizontalAlignment="Center"
Margin="0,0,0,10"/>
<ComboBox x:Name="CaptureModeComboBox"
Style="{StaticResource MyComboBoxStyle}"
HorizontalAlignment="Center"
SelectionChanged="CaptureModeComboBox_SelectionChanged"
Margin="0,0,0,10">
<ComboBoxItem Content="呼吸类别" IsEnabled="False"/>
<ComboBoxItem Content="呼气" IsSelected="True"/>
<ComboBoxItem Content="吸气"/>
</ComboBox>
<TextBlock Text="单一故障气阻测试"
FontSize="24"
FontWeight="Bold"
HorizontalAlignment="Center"
Margin="0,10,0,10"/>
<Grid Margin="10" HorizontalAlignment="Left" MinWidth="400">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<!-- 标签列 -->
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="*"/>
<!-- 按钮列 -->
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="35"/>
<RowDefinition Height="Auto" MinHeight="35"/>
<RowDefinition Height="Auto" MinHeight="35"/>
<RowDefinition Height="Auto" MinHeight="35"/>
</Grid.RowDefinitions>
<!-- 设置流量行 -->
<TextBlock Grid.Row="0" Text="设置流量"
VerticalAlignment="Center"
FontWeight="Bold"
FontSize="16"
Margin="0,0,15,0"/>
<StackPanel Grid.Row="0" Grid.Column="1"
Orientation="Horizontal"
VerticalAlignment="Center"
Margin="0,5"
Width="160">
<TextBox Name="clostTxt"
Style="{StaticResource MyTextBoxStyle}"
IsReadOnly="True"
PreviewTextInput="ClostTxt_PreviewTextInput"
Width="80"/>
<TextBlock Text="L/min"
VerticalAlignment="Center"
Margin="10,0,0,0"
MinWidth="50"/>
</StackPanel>
<Button Grid.Row="0" Grid.Column="2"
Content="设置"
Style="{StaticResource MyButtonStyle}"
Click="Button_Click"
Margin="15,5"/>
<!-- 鼻口压力行 -->
<TextBlock Grid.Row="1" Text="鼻口压力"
VerticalAlignment="Center"
FontWeight="Bold"
FontSize="16"
Margin="0,0,15,0"/>
<StackPanel Grid.Row="1" Grid.Column="1"
Orientation="Horizontal"
VerticalAlignment="Center"
Margin="0,5"
Width="160">
<TextBox Name="NoseTxt"
Style="{StaticResource MyTextBoxStyle}"
Text="???"
IsEnabled="False"
Width="80"/>
<TextBlock Text="pa"
VerticalAlignment="Center"
Margin="10,0,0,0"
MinWidth="50"/>
</StackPanel>
<Button Grid.Row="1" Grid.Column="2"
Content="校准"
Style="{StaticResource MyButtonStyle}"
Click="Button_Click_1"
Margin="15,5"/>
<!-- 呼流量行 -->
<TextBlock Grid.Row="2" Text="呼流量"
VerticalAlignment="Center"
FontWeight="Bold"
FontSize="16"
Margin="0,0,15,0"/>
<StackPanel Grid.Row="2" Grid.Column="1"
Orientation="Horizontal"
VerticalAlignment="Center"
Margin="0,5"
Width="160">
<TextBox Name="outTxt"
Style="{StaticResource MyTextBoxStyle}"
Text="???"
IsEnabled="False"
Width="80"/>
<TextBlock Text="L/min"
VerticalAlignment="Center"
Margin="10,0,0,0"
MinWidth="50"/>
</StackPanel>
<Button Grid.Row="2" Grid.Column="2"
Content="记录呼气阻力"
Style="{StaticResource MyButtonStyle}"
Click="Button_Click_5"
Margin="15,5"/>
<!-- 吸流量行 -->
<TextBlock Grid.Row="3" Text="吸流量"
VerticalAlignment="Center"
FontWeight="Bold"
FontSize="16"
Margin="0,0,15,0"/>
<StackPanel Grid.Row="3" Grid.Column="1"
Orientation="Horizontal"
VerticalAlignment="Center"
Margin="0,5"
Width="160">
<TextBox Name="InTxt"
Style="{StaticResource MyTextBoxStyle}"
Text="???"
IsEnabled="False"
Width="80"/>
<TextBlock Text="L/min"
VerticalAlignment="Center"
Margin="10,0,0,0"
MinWidth="50"/>
</StackPanel>
<Button Grid.Row="3" Grid.Column="2"
Content="记录吸气阻力"
Style="{StaticResource MyButtonStyle}"
Click="Button_Click_5"
Margin="15,5"/>
</Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10">
<!-- 减少边距原20→10 -->
<Button Content="主页" Style="{StaticResource MyButtonStyle}" Click="Button_Click_2"/>
<Button Name="TestStartButton" Content="测试启动" Style="{StaticResource MyButtonStyle}" Click="Button_Click_4"/>
<Button Content="测试停止" Style="{StaticResource MyButtonStyle}" Click="Button_Click_3"/>
<Button Content="记录画面" Style="{StaticResource MyButtonStyle}" Click="Button_Click_7"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10">
<TextBlock Text="呼气阻力" VerticalAlignment="Center" FontWeight="Bold" FontSize="16" Margin="20 0 50 0"/>
<TextBox Name="saveFlowOutTxt" Style="{StaticResource MyTextBoxStyle}" Text="???" Width="120" IsEnabled="False"/>
<TextBlock Text="pa" VerticalAlignment="Center" Margin="10,0,0,0"/>
<TextBlock Text="吸气阻力" VerticalAlignment="Center" FontWeight="Bold" FontSize="16" Margin="20 0 50 0"/>
<TextBox Name="saveFlowInTxt" Style="{StaticResource MyTextBoxStyle}" Text="???" Width="120" IsEnabled="False"/>
<TextBlock Text="pa" VerticalAlignment="Center" Margin="10,0,0,0"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,20">
<!-- 增加底部边距,避免被窗口边缘遮挡 -->
<!--<Button Content="记录呼气阻力" Style="{StaticResource MyButtonStyle}" Click="Button_Click_5"/>
<Button Content="记录吸气阻力" Style="{StaticResource MyButtonStyle}" Click="Button_Click_5"/>-->
</StackPanel>
</StackPanel>
</Grid>
</ScrollViewer>
</Window>