Files
Sleep-Multi-functionality/Window1.xaml

132 lines
6.9 KiB
Plaintext
Raw Normal View History

2026-05-04 14:46:58 +08:00
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:av="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="av" x:Class="ShanghaiEnvironmentalTechnology.Window1"
Title="排气流量测试"
Height="768" Width="1024" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen">
<Window.Resources>
<Style x:Key="MyButtonStyle" TargetType="{x:Type 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="{x:Type 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="{x:Type 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="{x:Type 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 TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="18"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Margin" Value="5"/>
</Style>
</Window.Resources>
<Grid Margin="20">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Width="800">
<TextBlock Text="排气流量测试"
FontSize="36"
FontWeight="Bold"
HorizontalAlignment="Center"
Margin="0,0,0,20"/>
<TextBlock Text="提示: 调节设定压力,该时的流量"
HorizontalAlignment="Center"
Margin="0,0,0,30"/>
<StackPanel Orientation="Vertical" Margin="0,0,0,20">
<StackPanel Orientation="Horizontal" Margin="0,10">
<TextBlock Text="设定压力:" VerticalAlignment="Center" Foreground="Black"/>
<TextBox x:Name="SettingPaTextBox" Width="120" Margin="10,0" Style="{StaticResource MyTextBoxStyle}"
IsReadOnly="True"
InputScope="Number" PreviewTextInput="SettingPaTextBox_PreviewTextInput" />
<TextBlock Text="pa" VerticalAlignment="Center" Foreground="Black"/>
<Button Content="设置" Style="{StaticResource MyButtonStyle}" Click="SettingPaTextBox_MouseLeave"/>
<!--<Button Content="确定" Style="{StaticResource MyButtonStyle}"/>-->
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10">
<TextBlock Text="实时压力:" VerticalAlignment="Center" Foreground="Black"/>
<TextBox x:Name="RealTimePressureTextBox" Width="120" Margin="10,0" Style="{StaticResource MyTextBoxStyle}" IsReadOnly="True" IsEnabled="True"/>
<TextBlock Text="pa" VerticalAlignment="Center" Foreground="Black"/>
<Button Content="校准压力" Style="{StaticResource MyButtonStyle}" Click="Button_Click"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="0,20">
<StackPanel Orientation="Horizontal" Margin="0,10">
<TextBlock Text="实时流量:" VerticalAlignment="Center" Foreground="Black"/>
<TextBlock x:Name="txtFolw" Text="???" Margin="10,0" VerticalAlignment="Center" Foreground="Black"/>
<TextBlock Text="L/min" VerticalAlignment="Center" Foreground="Black"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10">
<Button Content="记录流量" Style="{StaticResource MyButtonStyle}" Click="Button_Click_4"/>
<TextBlock x:Name="saveFlowTxt" Text="???" Margin="10,0" VerticalAlignment="Center" Foreground="Black"/>
<TextBlock Text="L/min" VerticalAlignment="Center" Foreground="Black"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,30">
<Button Content="主页" Style="{StaticResource MyButtonStyle}" Click="Button_Click_1"/>
<Button x:Name="TestStartButton" Content="测试启动" Style="{StaticResource MyButtonStyle}" Click="Button_Click_2"/>
<Button Content="测试停止" Style="{StaticResource MyButtonStyle}" Click="Button_Click_3" />
<Button Content="记录画面" Style="{StaticResource MyButtonStyle}" Click="Button_Click_5" />
</StackPanel>
</StackPanel>
</Grid>
</Window>