Files
VacuumPressureMembranePoreS…/Views/MainWindow.xaml
2026-04-02 10:13:01 +08:00

172 lines
9.3 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<Window x:Class="MembranePoreTester.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MembranePoreTester.Views"
xmlns:viewModels="clr-namespace:MembranePoreTester.ViewModels"
xmlns:conv="clr-namespace:MembranePoreTester.Converters"
Title="膜孔径测试系统 (GB/T 32361-2015)"
Width="1024" MinHeight="768" WindowState="Maximized"
WindowStartupLocation="CenterScreen" KeyDown="Window_KeyDown"
Background="#F5F7FA" FontFamily="Segoe UI">
<Window.DataContext>
<viewModels:MainViewModel />
</Window.DataContext>
<Window.Resources>
<conv:BoolToStringConverter x:Key="BoolToStringConverter"/>
<!-- 统一按钮样式(与子视图保持一致) -->
<Style TargetType="Button">
<Setter Property="Background" Value="#2196F3"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="12,6"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="4" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1976D2"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#0D47A1"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 统一 ComboBox 样式 -->
<Style TargetType="ComboBox">
<Setter Property="Height" Value="28"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="#D0D3D9"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<!-- 统一 TabControl 样式 -->
<Style TargetType="TabControl">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
<Style TargetType="TabItem">
<Setter Property="FontSize" Value="13"/>
<Setter Property="Padding" Value="15,8"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#5F6A7A"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border Background="{TemplateBinding Background}"
BorderThickness="0,0,0,2"
BorderBrush="Transparent"
Padding="{TemplateBinding Padding}">
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="Blue"/>
<Setter Property="BorderBrush" Value="#2196F3"/>
<Setter Property="Background" Value="#E3F2FD"/>
<!-- 添加浅蓝背景 -->
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Blue"/>
<Setter Property="Background" Value="#F5F5F5"/>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<DockPanel>
<!-- 顶部历史记录栏 -->
<Border DockPanel.Dock="Top" Background="White" BorderBrush="#E9ECF0" BorderThickness="0,0,0,1" Padding="10,5">
<StackPanel Orientation="Horizontal">
<Button Content="📋 历史记录" Click="OpenHistory_Click" Width="100" HorizontalAlignment="Left" Background="#607D8B"/>
<Button Content="阀门控制" Click="OpenValveControl_Click" Padding="10,5" Margin="5"/>
</StackPanel>
</Border>
<!-- 工位选项卡 -->
<TabControl x:Name="stationTabControl" ItemsSource="{Binding Stations}" Background="White" Margin="10,10,10,10">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" FontSize="14" FontWeight="Medium"/>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate>
<DockPanel Margin="0,10,0,0">
<!-- 工位控制栏 -->
<Border DockPanel.Dock="Top" Background="White" CornerRadius="6" Padding="10" Margin="0,0,0,10" BorderBrush="#E9ECF0" BorderThickness="1">
<StackPanel Orientation="Horizontal">
<ComboBox ItemsSource="{Binding PressureModeList}" SelectedItem="{Binding SelectedPressureMode}" Width="80"/>
<Button Content="▶ 启动" Command="{Binding StartCommand}" Width="80" Background="#4CAF50"/>
<Button Content="⏹ 停止" Command="{Binding StopCommand}" Width="80" Background="#F44336"/>
<Button Content="{Binding PressButtonText}" Command="{Binding PressCommand}" Width="80" Background="#FF9800"/>
<!-- 状态指示灯 -->
<StackPanel Orientation="Horizontal" Margin="15,0,0,0">
<Grid Width="18" Height="18" Margin="2">
<Ellipse Fill="{Binding EnableStatusColor}">
<Ellipse.Effect>
<DropShadowEffect BlurRadius="3" ShadowDepth="0" Opacity="0.3"/>
</Ellipse.Effect>
</Ellipse>
<Ellipse Margin="2" Opacity="0.6">
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="White" Offset="0.2"/>
<GradientStop Color="Transparent" Offset="1"/>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
</Grid>
<TextBlock Text="{Binding EnableStatusText}" VerticalAlignment="Center" Margin="5,0,0,0" FontSize="12"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="15,0,0,0">
<StackPanel Orientation="Horizontal" Margin="0,0,10,0">
<Label Content="加压上限:" VerticalAlignment="Center" Margin="0,0,5,0"/>
<TextBox x:Name="txtPressureUpper" Width="120" FontSize="16" Height="32" VerticalAlignment="Center" Text="{Binding PressureUpperLimit, UpdateSourceTrigger=LostFocus, StringFormat=F3}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="加压速率:" VerticalAlignment="Center" Margin="0,0,5,0"/>
<TextBox x:Name="txtPressureRate" Width="120" FontSize="16" Height="32" VerticalAlignment="Center" Text="{Binding PressureRate, UpdateSourceTrigger=LostFocus, StringFormat=F3}" />
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
<!-- 测试类型选项卡修复嵌套绑定直接定义两个TabItem -->
<TabControl SelectionChanged="TabControl_SelectionChanged">
<TabItem Header="泡点法测试最大孔径">
<local:BubblePointView DataContext="{Binding BubblePointVM}"/>
</TabItem>
<TabItem Header="孔分布测试">
<local:PoreDistributionView DataContext="{Binding PoreDistributionVM}"/>
</TabItem>
</TabControl>
</DockPanel>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
</DockPanel>
</Window>