添加项目文件。
This commit is contained in:
119
Views/MainWindow.xaml
Normal file
119
Views/MainWindow.xaml
Normal file
@@ -0,0 +1,119 @@
|
||||
<Window x:Class="HME_MoistureLossMeter.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:views="clr-namespace:HME_MoistureLossMeter.Views"
|
||||
xmlns:converters="clr-namespace:HME_MoistureLossMeter.Converters"
|
||||
Title="HME水分损失测量仪"
|
||||
Width="1024" Height="768"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Background="#F0F2F5">
|
||||
<Window.Resources>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Height" Value="40"/>
|
||||
<Setter Property="Margin" Value="5"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="Background" Value="#2C7DA0"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="BorderBrush" Value="#1F5E7A"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" Value="#CCCCCC"/>
|
||||
<Setter Property="Foreground" Value="#666666"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#1F5E7A"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style TargetType="TextBox">
|
||||
<Setter Property="Height" Value="35"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="BorderBrush" Value="#CCCCCC"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="5"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style TargetType="GroupBox">
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Margin" Value="0,5"/>
|
||||
</Style>
|
||||
<Style TargetType="Border" x:Key="CardBorder">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Setter Property="CornerRadius" Value="8"/>
|
||||
<Setter Property="Padding" Value="10"/>
|
||||
<Setter Property="BorderBrush" Value="#DDDDDD"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
</Style>
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
<converters:BoolToColorConverter x:Key="BoolToColorConverter"/>
|
||||
<converters:BoolToStringConverter x:Key="BoolToStringConverter"/>
|
||||
<converters:InverseBoolConverter x:Key="InverseBoolConverter"/>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Margin="15">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 顶部状态栏 -->
|
||||
<Border Grid.Row="0" Background="#2C3E50" CornerRadius="5" Padding="10" Margin="0,0,0,10">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="状态:" Foreground="White" FontSize="14" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding ConnectionStatus}"
|
||||
Foreground="{Binding IsConnected, Converter={StaticResource BoolToColorConverter}}"
|
||||
FontSize="14" FontWeight="Bold" Margin="5,0,20,0"/>
|
||||
<Separator Background="White" Width="1" Margin="5,0"/>
|
||||
<TextBlock Text="当前视图:" Foreground="White" FontSize="14" Margin="15,0,0,0"/>
|
||||
<TextBlock Text="{Binding CurrentViewName}" Foreground="White" FontSize="14" FontWeight="Bold" Margin="5,0,20,0"/>
|
||||
<Separator Background="White" Width="1" Margin="5,0"/>
|
||||
<TextBlock Text="测试状态:" Foreground="White" FontSize="14" Margin="15,0,0,0"/>
|
||||
<TextBlock Text="{Binding IsTesting, Converter={StaticResource BoolToStringConverter}}"
|
||||
Foreground="White" FontSize="14" FontWeight="Bold" Margin="5,0,0,0"/>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="1" Text="{Binding CurrentTime, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"
|
||||
Foreground="White" FontSize="14" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 主内容 -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="180"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- 导航 -->
|
||||
<Border Grid.Column="0" Style="{StaticResource CardBorder}" Margin="0,0,10,0">
|
||||
<StackPanel Margin="5">
|
||||
<Button Content="测试画面" Command="{Binding NavigateToTestCommand}" Height="45" Margin="0,5"/>
|
||||
<Button Content="手动控制" Command="{Binding NavigateToManualCommand}" Height="45" Margin="0,5"/>
|
||||
<Button Content="记录画面" Command="{Binding NavigateToRecordCommand}" Height="45" Margin="0,5"/>
|
||||
<Button Content="报表" Command="{Binding NavigateToReportCommand}" Height="45" Margin="0,5"/>
|
||||
<Separator Margin="0,15"/>
|
||||
<Button Content="退出" Command="{Binding ExitApplicationCommand}" Height="45" Margin="0,5" Background="#E74C3C"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<!-- 视图 -->
|
||||
<ContentControl Grid.Column="1" Content="{Binding CurrentView}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- 底部状态 -->
|
||||
<Border Grid.Row="2" Background="#2C3E50" CornerRadius="5" Padding="5" Margin="0,10,0,0">
|
||||
<TextBlock Text="{Binding StatusMessage}" Foreground="White" FontSize="12" HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
12
Views/MainWindow.xaml.cs
Normal file
12
Views/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace HME_MoistureLossMeter
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
200
Views/ManualControlView.xaml
Normal file
200
Views/ManualControlView.xaml
Normal file
@@ -0,0 +1,200 @@
|
||||
<UserControl x:Class="HME_MoistureLossMeter.Views.ManualControlView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="700" d:DesignWidth="1024">
|
||||
|
||||
<Grid Background="{StaticResource BackgroundBrush}" Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 左侧:参数设置 -->
|
||||
<Border Grid.Row="0" Grid.RowSpan="2" Grid.Column="0"
|
||||
Style="{StaticResource PanelBorderStyle}"
|
||||
Margin="0,0,10,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="参数设置"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="{StaticResource PrimaryBrush}"
|
||||
Margin="0,0,0,15"/>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="手动速度"
|
||||
FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
Text="{Binding ManualSpeed, StringFormat='{}{0:F2}'}"
|
||||
Margin="5,0,5,0"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="2"
|
||||
Text="mm/MIN"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="#7F8C8D"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
Text="潮气量系数"
|
||||
FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1"
|
||||
Text="{Binding TidalCoeff, StringFormat='{}{0:F2}'}"
|
||||
Margin="5,0,5,0"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
Text="频率系数"
|
||||
FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1"
|
||||
Text="{Binding FreqCoeff, StringFormat='{}{0:F2}'}"
|
||||
Margin="5,0,5,0"/>
|
||||
|
||||
<StackPanel Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,10,0,0">
|
||||
<Button Content="保存参数"
|
||||
Command="{Binding SaveParametersCommand}"
|
||||
Width="100" Height="35"
|
||||
Background="{StaticResource SuccessBrush}"/>
|
||||
<Button Content="刷新"
|
||||
Command="{Binding RefreshParametersCommand}"
|
||||
Width="80" Height="35"
|
||||
Margin="10,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 右侧:手动控制 -->
|
||||
<Border Grid.Row="0" Grid.RowSpan="2" Grid.Column="1"
|
||||
Style="{StaticResource PanelBorderStyle}"
|
||||
Margin="10,0,0,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="手动控制"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="{StaticResource PrimaryBrush}"
|
||||
Margin="0,0,0,15"/>
|
||||
|
||||
<!-- 控制按钮 -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 方向控制 -->
|
||||
<Button Grid.Row="0" Grid.Column="1"
|
||||
Content="▲ 上升"
|
||||
Command="{Binding MoveUpCommand}"
|
||||
Height="40"
|
||||
Background="{StaticResource WarningBrush}"
|
||||
Margin="5"/>
|
||||
|
||||
<Button Grid.Row="1" Grid.Column="0"
|
||||
Content="◄ 左"
|
||||
Command="{Binding MoveLeftCommand}"
|
||||
Height="40"
|
||||
Margin="5"/>
|
||||
|
||||
<Button Grid.Row="1" Grid.Column="1"
|
||||
Content="校零"
|
||||
Command="{Binding ZeroCalibrationCommand}"
|
||||
Height="40"
|
||||
Background="{StaticResource AccentBrush}"
|
||||
Margin="5"/>
|
||||
|
||||
<Button Grid.Row="1" Grid.Column="2"
|
||||
Content="右 ►"
|
||||
Command="{Binding MoveRightCommand}"
|
||||
Height="40"
|
||||
Margin="5"/>
|
||||
|
||||
<Button Grid.Row="2" Grid.Column="1"
|
||||
Content="▼ 下降"
|
||||
Command="{Binding MoveDownCommand}"
|
||||
Height="40"
|
||||
Background="{StaticResource WarningBrush}"
|
||||
Margin="5"/>
|
||||
|
||||
<!-- 呼吸控制 -->
|
||||
<Button Grid.Row="3" Grid.Column="0"
|
||||
Content="手动呼"
|
||||
Command="{Binding ManualExhaleCommand}"
|
||||
Height="40"
|
||||
Background="{StaticResource DangerBrush}"
|
||||
Margin="5"/>
|
||||
|
||||
<Button Grid.Row="3" Grid.Column="1"
|
||||
Content="停止"
|
||||
Command="{Binding StopTestCommand}"
|
||||
Height="40"
|
||||
Background="{StaticResource DangerBrush}"
|
||||
Margin="5"/>
|
||||
|
||||
<Button Grid.Row="3" Grid.Column="2"
|
||||
Content="手动吸"
|
||||
Command="{Binding ManualInhaleCommand}"
|
||||
Height="40"
|
||||
Background="{StaticResource SuccessBrush}"
|
||||
Margin="5"/>
|
||||
</Grid>
|
||||
|
||||
<!-- 状态显示 -->
|
||||
<Border Grid.Row="2" Background="#F8F9FA" CornerRadius="4" Padding="5" Margin="0,10,0,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="PLC状态: " FontWeight="Bold" FontSize="12"/>
|
||||
<TextBlock Text="{Binding ConnectionStatus}"
|
||||
Foreground="{Binding IsConnected, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=SuccessBrush, FallbackValue={StaticResource DangerBrush}}"
|
||||
FontWeight="Bold"/>
|
||||
<TextBlock Text=" | 手动速度: " FontWeight="Bold" FontSize="12" Margin="15,0,0,0"/>
|
||||
<TextBlock Text="{Binding ManualSpeed, StringFormat='{}{0:F2} mm/MIN'}" FontSize="12"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
12
Views/ManualControlView.xaml.cs
Normal file
12
Views/ManualControlView.xaml.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace HME_MoistureLossMeter.Views
|
||||
{
|
||||
public partial class ManualControlView : UserControl
|
||||
{
|
||||
public ManualControlView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
95
Views/RecordView.xaml
Normal file
95
Views/RecordView.xaml
Normal file
@@ -0,0 +1,95 @@
|
||||
<UserControl x:Class="HME_MoistureLossMeter.Views.RecordView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="700" d:DesignWidth="1024">
|
||||
|
||||
<Grid Background="{StaticResource BackgroundBrush}" Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 标题 -->
|
||||
<TextBlock Grid.Row="0"
|
||||
Text="历史记录"
|
||||
FontSize="18"
|
||||
FontWeight="Bold"
|
||||
Foreground="{StaticResource PrimaryBrush}"
|
||||
Margin="0,0,0,10"/>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<Border Grid.Row="1"
|
||||
Style="{StaticResource PanelBorderStyle}">
|
||||
<DataGrid ItemsSource="{Binding Records}"
|
||||
SelectedItem="{Binding SelectedRecord}"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
CanUserDeleteRows="False"
|
||||
IsReadOnly="True"
|
||||
HeadersVisibility="Column"
|
||||
RowHeight="35"
|
||||
FontSize="13"
|
||||
AlternatingRowBackground="#F8F9FA"
|
||||
GridLinesVisibility="Horizontal"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch">
|
||||
|
||||
<DataGrid.Resources>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="{StaticResource PrimaryBrush}"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="Height" Value="35"/>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="编号" Binding="{Binding RecordId}" Width="80"/>
|
||||
<DataGridTextColumn Header="时间" Binding="{Binding TestTime}" Width="180"/>
|
||||
<DataGridTextColumn Header="操作员编号" Binding="{Binding OperatorId}" Width="120"/>
|
||||
<DataGridTextColumn Header="生产批号" Binding="{Binding BatchNo}" Width="150"/>
|
||||
<DataGridTextColumn Header="实验编号" Binding="{Binding ExperimentId}" Width="100"/>
|
||||
<DataGridTextColumn Header="初始质量(g)" Binding="{Binding InitialMass, StringFormat='{}{0:F2}'}" Width="120"/>
|
||||
<DataGridTextColumn Header="测后质量(g)" Binding="{Binding FinalMass, StringFormat='{}{0:F2}'}" Width="120"/>
|
||||
<DataGridTextColumn Header="水分损失(mg/L)" Binding="{Binding MoistureLoss, StringFormat='{}{0:F2}'}" Width="140">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style>
|
||||
<Setter Property="TextBlock.Foreground" Value="{StaticResource DangerBrush}"/>
|
||||
<Setter Property="TextBlock.FontWeight" Value="Bold"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Border>
|
||||
|
||||
<!-- 底部操作按钮 -->
|
||||
<WrapPanel Grid.Row="2"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,10,0,0">
|
||||
<Button Content="同步到MES"
|
||||
Command="{Binding SyncToMesCommand}"
|
||||
Width="120" Height="35"
|
||||
Background="{StaticResource SuccessBrush}"/>
|
||||
<Button Content="删除选中"
|
||||
Command="{Binding DeleteSelectedRecordCommand}"
|
||||
Width="120" Height="35"
|
||||
Background="{StaticResource DangerBrush}"
|
||||
Margin="10,0,0,0"/>
|
||||
<Button Content="清除全部"
|
||||
Command="{Binding ClearRecordsCommand}"
|
||||
Width="120" Height="35"
|
||||
Background="{StaticResource WarningBrush}"
|
||||
Margin="10,0,0,0"/>
|
||||
<TextBlock Text="提示:长按可清除记录"
|
||||
Foreground="#7F8C8D"
|
||||
FontSize="12"
|
||||
VerticalAlignment="Center"
|
||||
Margin="20,0,0,0"/>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
12
Views/RecordView.xaml.cs
Normal file
12
Views/RecordView.xaml.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace HME_MoistureLossMeter.Views
|
||||
{
|
||||
public partial class RecordView : UserControl
|
||||
{
|
||||
public RecordView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Views/ReportView.xaml
Normal file
7
Views/ReportView.xaml
Normal file
@@ -0,0 +1,7 @@
|
||||
<UserControl x:Class="HME_MoistureLossMeter.Views.ReportView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Grid Background="White">
|
||||
<TextBlock Text="报表功能开发中..." FontSize="24" Foreground="Gray" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
9
Views/ReportView.xaml.cs
Normal file
9
Views/ReportView.xaml.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace HME_MoistureLossMeter.Views
|
||||
{
|
||||
public partial class ReportView : UserControl
|
||||
{
|
||||
public ReportView() => InitializeComponent();
|
||||
}
|
||||
}
|
||||
299
Views/TestView.xaml
Normal file
299
Views/TestView.xaml
Normal file
@@ -0,0 +1,299 @@
|
||||
<UserControl x:Class="HME_MoistureLossMeter.Views.TestView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="700" d:DesignWidth="1024">
|
||||
|
||||
<Grid Background="{StaticResource BackgroundBrush}" Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 左侧:主显示区域 -->
|
||||
<Border Grid.Row="0" Grid.RowSpan="2" Grid.Column="0"
|
||||
Style="{StaticResource PanelBorderStyle}"
|
||||
Margin="0,0,10,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 标题 -->
|
||||
<TextBlock Text="实时数据"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="{StaticResource PrimaryBrush}"
|
||||
Margin="0,0,0,10"/>
|
||||
|
||||
<!-- 数据显示网格 -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 第一列 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="水浴温度" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding WaterTemp, StringFormat='{}{0:F2} ℃'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="箱体温度" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding ChamberTemp, StringFormat='{}{0:F2} ℃'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="重量" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding Weight, StringFormat='{}{0:F2} g'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="3" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="空气体积" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding AirVolume, StringFormat='{}{0:F2} L'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="4" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="出口流量" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding OutletFlow, StringFormat='{}{0:F2} L/min'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="5" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="潮气量" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding TidalVolume, StringFormat='{}{0:F1} ml'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="6" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="频率" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding Frequency, StringFormat='{}{0:F2} 次/min'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="7" Grid.Column="0" Margin="5">
|
||||
<TextBlock Text="呼吸次数" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding BreathCount}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 第二列 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="设定测试时间" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding PresetHour, StringFormat='{}{0}H'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="当前时间" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding CurrentTime, StringFormat='{}{0:HH:mm:ss}'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="初始质量" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding InitialMass, StringFormat='{}{0:F2} g'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="3" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="测后质量" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding FinalMass, StringFormat='{}{0:F2} g'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="4" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="水分损失" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding MoistureLoss, StringFormat='{}{0:F2} mg/L'}"
|
||||
Style="{StaticResource DisplayValueStyle}"
|
||||
Foreground="{StaticResource DangerBrush}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="5" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="干燥空气量" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding DryAirFlow, StringFormat='{}{0:F2} L/min'}"
|
||||
Style="{StaticResource DisplayValueStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="6" Grid.Column="1" Margin="5">
|
||||
<TextBlock Text="测试状态" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding IsTesting, Converter={StaticResource BoolToVisibilityConverter},
|
||||
FallbackValue=未测试}"
|
||||
Style="{StaticResource DisplayValueStyle}"
|
||||
Foreground="{Binding IsTesting, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=SuccessBrush, FallbackValue={StaticResource WarningBrush}}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 第三列:状态指示灯 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="2" Margin="5">
|
||||
<TextBlock Text="状态指示灯" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<WrapPanel Margin="0,5,0,0">
|
||||
<Border Background="{Binding IsHeating, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=WarningBrush, FallbackValue=#95A5A6}"
|
||||
Width="20" Height="20" CornerRadius="10" Margin="2"/>
|
||||
<TextBlock Text="加热" FontSize="11" VerticalAlignment="Center" Margin="2,0,10,0"/>
|
||||
|
||||
<Border Background="{Binding IsInhale, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=SuccessBrush, FallbackValue=#95A5A6}"
|
||||
Width="20" Height="20" CornerRadius="10" Margin="2"/>
|
||||
<TextBlock Text="吸气" FontSize="11" VerticalAlignment="Center" Margin="2,0,10,0"/>
|
||||
|
||||
<Border Background="{Binding IsExhale, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=DangerBrush, FallbackValue=#95A5A6}"
|
||||
Width="20" Height="20" CornerRadius="10" Margin="2"/>
|
||||
<TextBlock Text="呼气" FontSize="11" VerticalAlignment="Center" Margin="2,0,10,0"/>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="2" Margin="5">
|
||||
<TextBlock Text="PLC状态" Style="{StaticResource DisplayLabelStyle}"/>
|
||||
<TextBlock Text="{Binding ConnectionStatus}"
|
||||
Style="{StaticResource DisplayValueStyle}"
|
||||
Foreground="{Binding IsConnected, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=SuccessBrush, FallbackValue={StaticResource DangerBrush}}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- 底部信息 -->
|
||||
<Border Grid.Row="2" Background="#F8F9FA" CornerRadius="4" Padding="5" Margin="0,10,0,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="实验条件: " FontWeight="Bold" FontSize="12"/>
|
||||
<TextBlock Text="{Binding CurrentTime, StringFormat='{}{0:MM/dd/yy ddd HH:mm:ss}'}" FontSize="12"/>
|
||||
<TextBlock Text=" | 操作员: " FontWeight="Bold" FontSize="12" Margin="10,0,0,0"/>
|
||||
<TextBlock Text="{Binding OperatorId}" FontSize="12"/>
|
||||
<TextBlock Text=" | 批号: " FontWeight="Bold" FontSize="12" Margin="10,0,0,0"/>
|
||||
<TextBlock Text="{Binding BatchNo}" FontSize="12"/>
|
||||
<TextBlock Text=" | 实验编号: " FontWeight="Bold" FontSize="12" Margin="10,0,0,0"/>
|
||||
<TextBlock Text="{Binding ExperimentId}" FontSize="12"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 右侧:控制区域 -->
|
||||
<Border Grid.Row="0" Grid.Column="1"
|
||||
Style="{StaticResource PanelBorderStyle}"
|
||||
Margin="10,0,0,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="测试控制"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="{StaticResource PrimaryBrush}"
|
||||
Margin="0,0,0,10"/>
|
||||
|
||||
<WrapPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
|
||||
<Button Content="复位"
|
||||
Command="{Binding ResetCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource WarningBrush}"/>
|
||||
|
||||
<Button Content="测试"
|
||||
Command="{Binding StartTestCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource SuccessBrush}"/>
|
||||
|
||||
<Button Content="停止"
|
||||
Command="{Binding StopTestCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource DangerBrush}"/>
|
||||
|
||||
<Button Content="P1记录"
|
||||
Command="{Binding RecordP1Command}"
|
||||
Width="80" Height="40"/>
|
||||
|
||||
<Button Content="P2记录"
|
||||
Command="{Binding RecordP2Command}"
|
||||
Width="80" Height="40"/>
|
||||
|
||||
<Button Content="打印"
|
||||
Command="{Binding PrintCommand}"
|
||||
Width="80" Height="40"/>
|
||||
|
||||
<Button Content="加热"
|
||||
Command="{Binding ToggleHeatCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{Binding IsHeating, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=DangerBrush, FallbackValue={StaticResource AccentBrush}}"/>
|
||||
|
||||
<Button Content="呼气"
|
||||
Command="{Binding ManualExhaleCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource DangerBrush}"/>
|
||||
|
||||
<Button Content="吸气"
|
||||
Command="{Binding ManualInhaleCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource SuccessBrush}"/>
|
||||
|
||||
<Button Content="下降"
|
||||
Command="{Binding MoveDownCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource WarningBrush}"/>
|
||||
|
||||
<Button Content="上升"
|
||||
Command="{Binding MoveUpCommand}"
|
||||
Width="80" Height="40"
|
||||
Background="{StaticResource WarningBrush}"/>
|
||||
|
||||
<Button Content="清零"
|
||||
Command="{Binding ClearCommand}"
|
||||
Width="80" Height="40"/>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 连接控制 -->
|
||||
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"
|
||||
Style="{StaticResource PanelBorderStyle}"
|
||||
Margin="0,10,0,0">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Content="连接PLC"
|
||||
Command="{Binding ConnectCommand}"
|
||||
Width="100" Height="35"
|
||||
Background="{StaticResource SuccessBrush}"/>
|
||||
<Button Content="断开PLC"
|
||||
Command="{Binding DisconnectCommand}"
|
||||
Width="100" Height="35"
|
||||
Background="{StaticResource DangerBrush}"
|
||||
Margin="10,0,0,0"/>
|
||||
<TextBlock Text="状态:" FontWeight="Bold" Margin="20,0,5,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding ConnectionStatus}"
|
||||
Foreground="{Binding IsConnected, Converter={StaticResource BoolToVisibilityConverter},
|
||||
ConverterParameter=SuccessBrush, FallbackValue={StaticResource DangerBrush}}"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
12
Views/TestView.xaml.cs
Normal file
12
Views/TestView.xaml.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace HME_MoistureLossMeter.Views
|
||||
{
|
||||
public partial class TestView : UserControl
|
||||
{
|
||||
public TestView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user