303 lines
17 KiB
XML
303 lines
17 KiB
XML
<UserControl x:Class="MembranePoreTester.Views.PoreDistributionView"
|
||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
xmlns:oxy="http://oxyplot.org/wpf"
|
||
xmlns:conv="clr-namespace:MembranePoreTester.Converters"
|
||
Background="#F5F7FA" >
|
||
<UserControl.Resources>
|
||
<conv:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
|
||
<conv:DoubleStringConverter x:Key="DoubleStringConverter"/>
|
||
|
||
<!-- 统一按钮样式 -->
|
||
<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>
|
||
|
||
<!-- 统一文本框样式 -->
|
||
<Style TargetType="TextBox">
|
||
<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"/>
|
||
<Setter Property="Padding" Value="5,2"/>
|
||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||
</Style>
|
||
|
||
<!-- 统一组合框样式 -->
|
||
<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"/>
|
||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||
</Style>
|
||
|
||
<!-- 统一标签样式 -->
|
||
<Style TargetType="Label">
|
||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||
<Setter Property="FontSize" Value="12"/>
|
||
<Setter Property="Foreground" Value="#2C3E50"/>
|
||
<Setter Property="Margin" Value="5"/>
|
||
</Style>
|
||
|
||
<!-- 统一GroupBox样式(自定义,圆角白色背景) -->
|
||
<Style TargetType="GroupBox">
|
||
<Setter Property="Background" Value="White"/>
|
||
<Setter Property="BorderBrush" Value="#E9ECF0"/>
|
||
<Setter Property="BorderThickness" Value="1"/>
|
||
<Setter Property="Margin" Value="0,0,0,10"/>
|
||
<Setter Property="Padding" Value="10"/>
|
||
<Setter Property="Template">
|
||
<Setter.Value>
|
||
<ControlTemplate TargetType="GroupBox">
|
||
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="6">
|
||
<Grid Margin="10">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="*"/>
|
||
</Grid.RowDefinitions>
|
||
<TextBlock Grid.Row="0" Text="{TemplateBinding Header}" FontWeight="SemiBold" FontSize="14" Margin="0,0,0,10"/>
|
||
<ContentPresenter Grid.Row="1" Content="{TemplateBinding Content}"/>
|
||
</Grid>
|
||
</Border>
|
||
</ControlTemplate>
|
||
</Setter.Value>
|
||
</Setter>
|
||
</Style>
|
||
|
||
<!-- DataGrid 样式 -->
|
||
<Style TargetType="DataGrid">
|
||
<Setter Property="Background" Value="White"/>
|
||
<Setter Property="BorderBrush" Value="#E9ECF0"/>
|
||
<Setter Property="RowHeight" Value="28"/>
|
||
<Setter Property="FontSize" Value="12"/>
|
||
<Setter Property="GridLinesVisibility" Value="Horizontal"/>
|
||
<Setter Property="HeadersVisibility" Value="Column"/>
|
||
</Style>
|
||
</UserControl.Resources>
|
||
|
||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||
<Grid Margin="10">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="*"/>
|
||
<RowDefinition Height="Auto"/>
|
||
</Grid.RowDefinitions>
|
||
|
||
<!-- 样品信息区域 -->
|
||
<GroupBox Grid.Row="0" Header="📄 样品信息">
|
||
<Grid>
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="Auto"/>
|
||
<ColumnDefinition Width="*"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
<ColumnDefinition Width="*"/>
|
||
</Grid.ColumnDefinitions>
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
<!-- 新增第5行 -->
|
||
</Grid.RowDefinitions>
|
||
|
||
<Label Grid.Row="0" Grid.Column="0" Content="膜类型:"/>
|
||
<ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding MembraneTypes}"
|
||
SelectedItem="{Binding Record.SampleType}" IsEnabled="False" IsReadOnly="True"/>
|
||
|
||
|
||
<!--<Label Grid.Row="0" Grid.Column="2" Content="室温(°C):"/>
|
||
<TextBox Grid.Row="0" Grid.Column="3" Text="{Binding Record.RoomTemperature}"/>-->
|
||
|
||
<Label Grid.Row="1" Grid.Column="2" Content="浸润时间(h):"/>
|
||
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding Record.SoakingTime, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource DoubleStringConverter}}"/>
|
||
|
||
<Label Grid.Row="1" Grid.Column="0" Content="测试液体:"/>
|
||
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Liquids}"
|
||
SelectedItem="{Binding SelectedLiquid}" DisplayMemberPath="Name"/>
|
||
<!--<Label Grid.Row="2" Grid.Column="2" Content="生产厂家:"/>
|
||
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding Record.LiquidManufacturer}"/>-->
|
||
|
||
<Label Grid.Row="3" Grid.Column="0" Content="压力单位:"/>
|
||
<ComboBox Grid.Row="3" Grid.Column="1" ItemsSource="{Binding PressureUnits}"
|
||
SelectedItem="{Binding Record.PressureUnit}"/>
|
||
|
||
<Label Grid.Row="3" Grid.Column="2" Content="(干/湿膜)/(大/小流量):"/>
|
||
<StackPanel Grid.Row="3" Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right">
|
||
<ComboBox ItemsSource="{Binding TestModes}" SelectedItem="{Binding TestMode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="80" Margin="0,0,5,0"/>
|
||
<ComboBox ItemsSource="{Binding PressureModeList}" SelectedItem="{Binding SelectedPressureMode}" Width="100" Margin="0,0,5,0"/>
|
||
<Button Content="🗑 清除数据" Command="{Binding ClearAllCommand}" Background="#F44336" Width="90" Margin="0,0,0,0"/>
|
||
</StackPanel>
|
||
|
||
|
||
|
||
<!--<StackPanel Orientation="Horizontal" Grid.Row="4">
|
||
<TextBlock Text="实时流量:" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||
<TextBox Text="{Binding CurrentFlow, StringFormat=F2}"
|
||
IsReadOnly="True"
|
||
Width="70"
|
||
Background="Transparent"
|
||
BorderThickness="0"
|
||
FontWeight="Bold"
|
||
Foreground="#2196F3"/>
|
||
<TextBlock Text="L/min" VerticalAlignment="Center" Margin="5,0,0,0"/>
|
||
</StackPanel>-->
|
||
|
||
<Label Grid.Row="4" Grid.Column="0" Content="加压速率:"/>
|
||
<TextBox Grid.Row="4" Grid.Column="1" IsEnabled="False" Text="{Binding SpeedRate1, StringFormat=F2}" Margin="5"/>
|
||
|
||
|
||
<Label Grid.Row="4" Grid.Column="2" Content="实时流量(L/min):"/>
|
||
<TextBox Grid.Row="4" Grid.Column="3" IsEnabled="False" Text="{Binding CurrentFlow, StringFormat=F3}"/>
|
||
<Label Grid.Row="5" Grid.Column="0" Content="当前压力(kPa):"/>
|
||
<TextBox Grid.Row="5" Grid.Column="1" IsEnabled="False" Grid.ColumnSpan="3" Text="{Binding CurrentPressure, StringFormat=F2}"/>
|
||
|
||
</Grid>
|
||
</GroupBox>
|
||
|
||
<!-- 数据表格与图表区域 -->
|
||
<Grid Grid.Row="1">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="*"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
<ColumnDefinition Width="*"/>
|
||
</Grid.ColumnDefinitions>
|
||
|
||
|
||
|
||
<!-- 左侧数据表格区域,改为两列 Grid -->
|
||
|
||
<ScrollViewer VerticalScrollBarVisibility="Auto" MaxHeight="400">
|
||
|
||
<Grid Grid.Column="0">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="*"/>
|
||
<ColumnDefinition Width="*"/>
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<!-- 湿膜表格 -->
|
||
<GroupBox Grid.Column="0" Header="💧 湿膜数据" Margin="0,0,5,0">
|
||
<DataGrid x:Name="dgWetData" ItemsSource="{Binding Record.DataPoints}"
|
||
SelectedItem="{Binding SelectedDataPoint}"
|
||
AutoGenerateColumns="False"
|
||
CanUserAddRows="False"
|
||
ColumnWidth="*">
|
||
<DataGrid.Columns>
|
||
<DataGridTextColumn Header="压力(Pa)"
|
||
Binding="{Binding Pressure, UpdateSourceTrigger=PropertyChanged}"
|
||
MinWidth="100"/>
|
||
<DataGridTextColumn Header="湿膜流量(L/min)"
|
||
Binding="{Binding WetFlow, UpdateSourceTrigger=PropertyChanged}"
|
||
MinWidth="100"/>
|
||
</DataGrid.Columns>
|
||
</DataGrid>
|
||
</GroupBox>
|
||
|
||
<!-- 干膜表格 -->
|
||
<GroupBox Grid.Column="1" Header="🔥 干膜数据" Margin="5,0,0,0">
|
||
<DataGrid x:Name="dgDryData" ItemsSource="{Binding Record.DataPoints}"
|
||
SelectedItem="{Binding SelectedDataPoint}"
|
||
AutoGenerateColumns="False"
|
||
CanUserAddRows="False"
|
||
ColumnWidth="*">
|
||
<DataGrid.Columns>
|
||
<DataGridTextColumn Header="压力(Pa)"
|
||
Binding="{Binding Pressure, UpdateSourceTrigger=PropertyChanged}"
|
||
MinWidth="100"/>
|
||
<DataGridTextColumn Header="干膜流量(L/min)"
|
||
Binding="{Binding DryFlow, UpdateSourceTrigger=PropertyChanged}"
|
||
MinWidth="100"/>
|
||
</DataGrid.Columns>
|
||
</DataGrid>
|
||
</GroupBox>
|
||
</Grid>
|
||
|
||
</ScrollViewer>
|
||
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Center" Background="#E9ECF0"/>
|
||
|
||
<!-- 右侧曲线图 -->
|
||
<GroupBox Grid.Column="2" Header="📈 流量-压力曲线" Margin="5,0,0,0">
|
||
<StackPanel>
|
||
<Border Background="#F5F5F5" CornerRadius="4" Padding="8,4" Margin="0,0,0,5" HorizontalAlignment="Right">
|
||
<StackPanel Orientation="Horizontal">
|
||
<Rectangle Width="20" Height="2" Fill="Blue" Margin="0,0,5,0"/>
|
||
<TextBlock Text="湿膜流量 (Wet Flow)" FontSize="11" Margin="0,0,15,0"/>
|
||
<Rectangle Width="20" Height="2" Fill="Red" Margin="0,0,5,0"/>
|
||
<TextBlock Text="干膜流量 (Dry Flow)" FontSize="11"/>
|
||
<!-- 新增:干膜半流量标注(绿色虚线) -->
|
||
<Rectangle Width="20" Height="2" Fill="Green" Margin="10,0,5,0"/>
|
||
<TextBlock Text="干膜半流量 (Half of Dry Flow)" FontSize="11"/>
|
||
</StackPanel>
|
||
</Border>
|
||
<!--<oxy:PlotView Model="{Binding PlotModel}" Height="300" Margin="5"/>-->
|
||
|
||
<oxy:PlotView x:Name="PlotViewStation1" Height="300" Margin="5" Visibility="Collapsed"/>
|
||
<oxy:PlotView x:Name="PlotViewStation2" Height="300" Margin="5" Visibility="Collapsed"/>
|
||
<oxy:PlotView x:Name="PlotViewStation3" Height="300" Margin="5" Visibility="Collapsed"/>
|
||
|
||
</StackPanel>
|
||
</GroupBox>
|
||
</Grid>
|
||
|
||
<!-- 计算结果及操作按钮区域 -->
|
||
<Border Grid.Row="2" Margin="0,10,0,0" Background="White" CornerRadius="6" Padding="10" BorderBrush="#E9ECF0" BorderThickness="1">
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
|
||
|
||
<GroupBox Header="📏 平均孔径" Margin="0" BorderThickness="0">
|
||
<TextBlock Text="{Binding AveragePoreSize, StringFormat={}{0:F3} μm}" FontSize="14" FontWeight="Bold" Foreground="#2196F3"/>
|
||
</GroupBox>
|
||
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="2,0"/>
|
||
|
||
<GroupBox Header="🎯 孔分布区间计算" Margin="5" BorderThickness="0">
|
||
<StackPanel Orientation="Horizontal">
|
||
<TextBox Text="{Binding LowerPore}" Width="48" Margin="1"/>
|
||
<TextBlock Text="~" VerticalAlignment="Center" Margin="1"/>
|
||
<TextBox Text="{Binding UpperPore}" Width="48" Margin="1"/>
|
||
<TextBlock Text="μm" VerticalAlignment="Center" Margin="2,0,5,0"/>
|
||
<Button Content="计算" Command="{Binding CalculateCommand}" Margin="2,0" Padding="8,5" Background="#2196F3" Click="Button_Click"/>
|
||
<TextBlock Text="{Binding RangePercentage, StringFormat={}{0:F2}%}" FontSize="14" FontWeight="Bold" VerticalAlignment="Center" Margin="5,0" Foreground="#4CAF50"/>
|
||
</StackPanel>
|
||
</GroupBox>
|
||
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="3,0"/>
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||
<Button Content="🔧 大流量校准" Command="{Binding OpenFlowCalibCommand}" Background="#607D8B"/>
|
||
<Button Content="🔧 小流量校准" Command="{Binding OpenFlowCalibCommand2}" Background="#607D8B"/>
|
||
<Button Content="📄 生成报告" Command="{Binding GenerateReportCommand}" Background="#2196F3"/>
|
||
<Button Content="💾 保存到历史" Command="{Binding SaveCommand}" Background="#4CAF50"/>
|
||
<Button Content="📊 导出Excel" Command="{Binding ExportCommand}" Background="#FF9800"/>
|
||
|
||
</StackPanel>
|
||
</StackPanel>
|
||
</Border>
|
||
</Grid>
|
||
</ScrollViewer>
|
||
</UserControl> |