UI进行中
|
|
@ -22,7 +22,9 @@ namespace WpfApp
|
||||||
/// <returns>如果硬件已绑定且匹配返回true,否则返回false</returns>
|
/// <returns>如果硬件已绑定且匹配返回true,否则返回false</returns>
|
||||||
private static bool CheckHardwareBinding()
|
private static bool CheckHardwareBinding()
|
||||||
{
|
{
|
||||||
string storedHardwareId = "8f07378cbfb5247c6481694a0ba0cb0b74739eddcc91f591623409a45803ee69";
|
//string storedHardwareId = "8f07378cbfb5247c6481694a0ba0cb0b74739eddcc91f591623409a45803ee69";
|
||||||
|
string storedHardwareId = "2703a031ecb416bd4ef9b91a5bd5f8698f745bb9efcbf7da35d251d0491b9cd8";
|
||||||
|
|
||||||
return HardwareInfo.ValidateHardwareId(storedHardwareId);
|
return HardwareInfo.ValidateHardwareId(storedHardwareId);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -59,6 +61,7 @@ namespace WpfApp
|
||||||
if (!CheckHardwareBinding())
|
if (!CheckHardwareBinding())
|
||||||
{
|
{
|
||||||
MessageBox.Show("检测到硬件环境发生变化,应用程序无法启动!", "警告", MessageBoxButton.OK, MessageBoxImage.Warning);
|
MessageBox.Show("检测到硬件环境发生变化,应用程序无法启动!", "警告", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
Console.WriteLine($"硬件环境序列号:{HardwareInfo.GetHardwareId()}");
|
||||||
LogService.Log.Info($"硬件环境序列号:{HardwareInfo.GetHardwareId()}");
|
LogService.Log.Info($"硬件环境序列号:{HardwareInfo.GetHardwareId()}");
|
||||||
Shutdown(); // 退出应用程序
|
Shutdown(); // 退出应用程序
|
||||||
return;
|
return;
|
||||||
|
|
@ -70,7 +73,7 @@ namespace WpfApp
|
||||||
Shutdown(); // 退出应用程序
|
Shutdown(); // 退出应用程序
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 获取主窗口实例并显示
|
// 获取主窗口实例并显示
|
||||||
|
|
|
||||||
368
MainWindow.xaml
|
|
@ -3,11 +3,373 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:WpfApp"
|
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
|
||||||
|
xmlns:local="clr-namespace:WpfApp.src.components"
|
||||||
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="MainWindow" Height="450" Width="800">
|
Title="MainWindow" Height="800" Width="1200">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Button Content="Button" HorizontalAlignment="Left" Margin="135,125,0,0" VerticalAlignment="Top" Click="Button_Click"/>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<!-- 顶部工具栏 -->
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<!-- 中间内容 -->
|
||||||
|
<RowDefinition Height="49"/>
|
||||||
|
<!-- 底部状态栏 -->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 使用 DockPanel 可以方便地将 ToolBar 放在顶部 -->
|
||||||
|
|
||||||
|
<!-- 工具栏放在顶部 -->
|
||||||
|
<ToolBar Grid.Row="0">
|
||||||
|
<Button Click="OnFilePageButtonClick">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="pack://application:,,,/src/public/Icons/main1-file-icon.png" Width="16" Height="16" />
|
||||||
|
<TextBlock Text="文件" Margin="5,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Click="OnConfigPageButtonClick">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="pack://application:,,,/src/public/Icons/main2-config-icon.png" Width="16" Height="16" />
|
||||||
|
<TextBlock Text="配置" Margin="5,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Click="OnStandardPageButtonClick">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="pack://application:,,,/src/public/Icons/main3-standard-icon.png" Width="16" Height="16" />
|
||||||
|
<TextBlock Text="标定" Margin="5,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<!--<Button Click="OnDetectionPageButtonClick">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="pack://application:,,,/src/public/Icons/main4-detection-icon.png" Width="16" Height="16" />
|
||||||
|
<TextBlock Text="检测" Margin="5,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>-->
|
||||||
|
|
||||||
|
<Button Click="OnGaugePageButtonClick">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="pack://application:,,,/src/public/Icons/main5-gauge-icon.png" Width="16" Height="16" />
|
||||||
|
<TextBlock Text="Gauge R&P" Margin="5,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button Click="OnCgCgkPageButtonClick">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="pack://application:,,,/src/public/Icons/main6-cgCgk-icon.png" Width="16" Height="16" />
|
||||||
|
<TextBlock Text="CgCgk" Margin="5,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button Click="OnSysSetPageButtonClick">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="pack://application:,,,/src/public/Icons/main7-sysSet-icon.png" Width="16" Height="16" />
|
||||||
|
<TextBlock Text="系统设定" Margin="5,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button Click="OnCloseMainWindowButtonClick">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="pack://application:,,,/src/public/Icons/main8-exit-icon.png" Width="16" Height="16" />
|
||||||
|
<TextBlock Text="退出" Margin="5,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Click="OnDemoButtonClick">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="pack://application:,,,/src/public/Icons/main8-exit-icon.png" Width="16" Height="16" />
|
||||||
|
<TextBlock Text="测试" Margin="5,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
|
||||||
|
</ToolBar>
|
||||||
|
|
||||||
|
<!-- 中间部分 -->
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 顶部数据表格区域 -->
|
||||||
|
<Border Grid.Row="0" Background="White" BorderBrush="#CCCCCC" BorderThickness="1" Margin="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="120"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 表头 -->
|
||||||
|
<Border Grid.Row="0" Grid.Column="0" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1">
|
||||||
|
<TextBlock Text="检测" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="0" Grid.Column="1" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1" Background="#D4B896">
|
||||||
|
<TextBlock Text="传感器1" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="0" Grid.Column="2" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1" Background="#D4B896">
|
||||||
|
<TextBlock Text="传感器2" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="0" Grid.Column="3" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1" Background="#D4B896">
|
||||||
|
<TextBlock Text="传感器3" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="0" Grid.Column="4" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1" Background="#D4B896">
|
||||||
|
<TextBlock Text="传感器4" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="0" Grid.Column="5" BorderBrush="#CCCCCC" BorderThickness="0,0,0,1" Background="#D4B896">
|
||||||
|
<TextBlock Text="等级" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 数据行 -->
|
||||||
|
<!-- 体积直径 -->
|
||||||
|
<Border Grid.Row="1" Grid.Column="0" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1">
|
||||||
|
<TextBlock Text="体积直径" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="1" Grid.Column="1" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1">
|
||||||
|
<TextBlock Text="72.9323" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="1" Grid.Column="2" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1">
|
||||||
|
<TextBlock Text="0.0000" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="1" Grid.Column="3" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1">
|
||||||
|
<TextBlock Text="72.1638" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="1" Grid.Column="4" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1">
|
||||||
|
<TextBlock Text="0.0000" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="1" Grid.Column="5" BorderBrush="#CCCCCC" BorderThickness="0,0,0,1">
|
||||||
|
<TextBlock Text="OK" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontSize="55"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 实际直径 -->
|
||||||
|
<Border Grid.Row="2" Grid.Column="0" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1">
|
||||||
|
<TextBlock Text="实际直径" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="2" Grid.Column="1" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1">
|
||||||
|
<TextBlock Text="-0.0007" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="2" Grid.Column="2" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1">
|
||||||
|
<TextBlock Text="-39.9913" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="2" Grid.Column="3" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1">
|
||||||
|
<TextBlock Text="-0.0114" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="2" Grid.Column="4" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1">
|
||||||
|
<TextBlock Text="0.0000" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<!-- <Border Grid.Row="2" Grid.Column="5" BorderBrush="#CCCCCC" BorderThickness="0,0,0,1">
|
||||||
|
</Border> -->
|
||||||
|
|
||||||
|
<!-- 确认直径 -->
|
||||||
|
<Border Grid.Row="3" Grid.Column="0" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1">
|
||||||
|
<TextBlock Text="确认直径" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="3" Grid.Column="1" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1" Background="#90EE90">
|
||||||
|
<TextBlock Text="0.0000" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="3" Grid.Column="2" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1" Background="#90EE90">
|
||||||
|
<TextBlock Text="0.0000" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="3" Grid.Column="3" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1" Background="#90EE90">
|
||||||
|
<TextBlock Text="0.0000" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="3" Grid.Column="4" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1" Background="#90EE90">
|
||||||
|
<TextBlock Text="0.0000" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<!-- <Border Grid.Row="3" Grid.Column="5" BorderBrush="#CCCCCC" BorderThickness="0,0,0,1">
|
||||||
|
</Border> -->
|
||||||
|
|
||||||
|
<!-- 确认数据 -->
|
||||||
|
<Border Grid.Row="4" Grid.Column="0" BorderBrush="#CCCCCC" BorderThickness="0,0,1,0">
|
||||||
|
<TextBlock Text="确认数据" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="4" Grid.Column="1" BorderBrush="#CCCCCC" BorderThickness="0,0,1,0" Background="#90EE90">
|
||||||
|
<TextBlock Text="0.0000" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="4" Grid.Column="2" BorderBrush="#CCCCCC" BorderThickness="0,0,1,0" Background="#90EE90">
|
||||||
|
<TextBlock Text="0.0000" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="4" Grid.Column="3" BorderBrush="#CCCCCC" BorderThickness="0,0,1,0" Background="#90EE90">
|
||||||
|
<TextBlock Text="0.0000" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="4" Grid.Column="4" BorderBrush="#CCCCCC" BorderThickness="0,0,1,0" Background="#90EE90">
|
||||||
|
<TextBlock Text="0.0000" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<!-- <Border Grid.Row="4" Grid.Column="5" BorderBrush="#CCCCCC" BorderThickness="0,0,0,0">
|
||||||
|
</Border> -->
|
||||||
|
|
||||||
|
<!-- 等级列合并 -->
|
||||||
|
<Border Grid.Row="1" Grid.Column="5" Grid.RowSpan="4"
|
||||||
|
BorderBrush="#CCCCCC" BorderThickness="0,0,0,0" Background="#C1FFC1">
|
||||||
|
<TextBlock Text="OK"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Foreground="Green"
|
||||||
|
FontSize="66"
|
||||||
|
FontWeight="Bold"
|
||||||
|
TextAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 中间柱状图区域 -->
|
||||||
|
<Grid Grid.Row="1" Margin="10" Background="#F8F6E7">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="4*"/>
|
||||||
|
<!-- 左侧:传感器柱状图 -->
|
||||||
|
<ColumnDefinition Width="3*"/>
|
||||||
|
<!-- 右侧:文本占位 -->
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 左侧:水平排列三个传感器柱状图 -->
|
||||||
|
<Grid Grid.Column="0" Margin="5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<local:SensorChart x:Name="Sensor1" SensorName="传感器1" Value="-40" Grid.Column="0" Margin="2"/>
|
||||||
|
<local:SensorChart x:Name="Sensor2" SensorName="传感器2" Value="40" Grid.Column="1" Margin="2"/>
|
||||||
|
<local:SensorChart x:Name="Sensor3" SensorName="传感器3" Value="-40" Grid.Column="2" Margin="2"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 右侧:曲线 -->
|
||||||
|
<Grid Grid.Column="1" Background="White" Margin="5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<!-- 传感器1 -->
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<!-- 传感器2 -->
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<!-- 传感器3 -->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 图1:传感器1 -->
|
||||||
|
<Grid Grid.Row="0" Margin="5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<!-- 标题 -->
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<!-- 图表 -->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
Text="传感器1"
|
||||||
|
FontSize="16"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="Black"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Margin="0,0,0,5"/>
|
||||||
|
|
||||||
|
<lvc:CartesianChart Grid.Row="1"
|
||||||
|
x:Name="myChart"
|
||||||
|
Margin="0,0,0,5"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 图2:传感器2 -->
|
||||||
|
<Grid Grid.Row="1" Margin="5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
Text="传感器2"
|
||||||
|
FontSize="16"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="Black"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Margin="0,0,0,5"/>
|
||||||
|
|
||||||
|
<lvc:CartesianChart Grid.Row="1"
|
||||||
|
x:Name="myChart1"
|
||||||
|
Margin="0,0,0,5"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 图3:传感器3 -->
|
||||||
|
<Grid Grid.Row="2" Margin="5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
Text="传感器3"
|
||||||
|
FontSize="16"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="Black"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Margin="0,0,0,5"/>
|
||||||
|
|
||||||
|
<lvc:CartesianChart Grid.Row="1"
|
||||||
|
x:Name="myChart2"
|
||||||
|
Margin="0,0,0,5"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 底部 StatusBar + 控制按钮自适应 -->
|
||||||
|
<StatusBar Grid.Row="2">
|
||||||
|
<!-- 左侧状态显示 -->
|
||||||
|
<StatusBarItem>
|
||||||
|
<TextBlock Text="连接成功!当前记录: DFPV C15TDE" />
|
||||||
|
</StatusBarItem>
|
||||||
|
<StatusBarItem>
|
||||||
|
<ProgressBar Width="100" Height="20" Value="50" />
|
||||||
|
</StatusBarItem>
|
||||||
|
|
||||||
|
<!-- 右侧控制按钮组 -->
|
||||||
|
<StatusBarItem HorizontalAlignment="Right">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 左侧保存/申请类型 -->
|
||||||
|
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,10,0">
|
||||||
|
<TextBlock Text="像素/每微米:" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||||
|
<ComboBox Width="80" Height="25" VerticalAlignment="Center">
|
||||||
|
<ComboBoxItem Content="低等"/>
|
||||||
|
<ComboBoxItem Content="中等" IsSelected="True"/>
|
||||||
|
<ComboBoxItem Content="高等"/>
|
||||||
|
</ComboBox>
|
||||||
|
<RadioButton Content="日志记录" VerticalAlignment="Center" Margin="10,0,0,0" Foreground="Black"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 中间状态显示 -->
|
||||||
|
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,10,0">
|
||||||
|
<Button Content="保存至Cg&Cgk" Width="100" Height="30" Margin="5,0"/>
|
||||||
|
<Button Content="保存至R&R" Width="80" Height="30" Margin="5,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 右侧按钮组 -->
|
||||||
|
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||||
|
<Button Content="检测确定" Width="70" Height="30" Margin="5,0" Background="#E6F3FF"/>
|
||||||
|
<Button Content="保存" Width="50" Height="30" Margin="5,0"/>
|
||||||
|
<Button Content="完成" Width="50" Height="30" Margin="5,0" Background="#90EE90"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</StatusBarItem>
|
||||||
|
</StatusBar>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
using guoke;
|
using guoke;
|
||||||
|
using LiveCharts;
|
||||||
|
using LiveCharts.Wpf;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using WpfApp.src.view;
|
||||||
|
|
||||||
|
|
||||||
namespace WpfApp
|
namespace WpfApp
|
||||||
{
|
{
|
||||||
|
|
@ -28,6 +33,164 @@ namespace WpfApp
|
||||||
{
|
{
|
||||||
log.Info($"接收到事件:{d.Data}");
|
log.Info($"接收到事件:{d.Data}");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#region 曲线测试数据
|
||||||
|
SetWindowTitle("FMSDGAUGE");
|
||||||
|
|
||||||
|
// 传感器1
|
||||||
|
// 初始化Series
|
||||||
|
myChart.Series = new SeriesCollection
|
||||||
|
{
|
||||||
|
// 柱状图
|
||||||
|
new ColumnSeries
|
||||||
|
{
|
||||||
|
Title = "柱状数据",
|
||||||
|
Values = new ChartValues<double> { 20, 10, 12, 5, 9 }
|
||||||
|
},
|
||||||
|
// 标准1
|
||||||
|
new LineSeries
|
||||||
|
{
|
||||||
|
Title = "标准1",
|
||||||
|
Values = new ChartValues<double> { 5, 5, 5, 5, 5 },
|
||||||
|
StrokeThickness = 2,
|
||||||
|
Fill = System.Windows.Media.Brushes.Transparent
|
||||||
|
},
|
||||||
|
// 标准2
|
||||||
|
new LineSeries
|
||||||
|
{
|
||||||
|
Title = "标准2",
|
||||||
|
Values = new ChartValues<double> { 10, 10, 10, 10, 10 },
|
||||||
|
StrokeThickness = 2,
|
||||||
|
Stroke = System.Windows.Media.Brushes.Green,
|
||||||
|
Fill = System.Windows.Media.Brushes.Transparent
|
||||||
|
},
|
||||||
|
// 标准3
|
||||||
|
new LineSeries
|
||||||
|
{
|
||||||
|
Title = "标准3",
|
||||||
|
Values = new ChartValues<double> { 30, 30, 30, 30, 30 },
|
||||||
|
StrokeThickness = 2,
|
||||||
|
Stroke = System.Windows.Media.Brushes.Red,
|
||||||
|
Fill = System.Windows.Media.Brushes.Transparent
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 设置X轴标签
|
||||||
|
myChart.AxisX.Add(new Axis
|
||||||
|
{
|
||||||
|
Title = "",
|
||||||
|
Labels = new[] { "13:27 23", "13:27 45", "13:27 49", "13:27 50", "13:27 55" }
|
||||||
|
});
|
||||||
|
|
||||||
|
// 设置Y轴
|
||||||
|
myChart.AxisY.Add(new Axis
|
||||||
|
{
|
||||||
|
Title = ""
|
||||||
|
});
|
||||||
|
|
||||||
|
// 传感器2
|
||||||
|
// 初始化Series
|
||||||
|
myChart1.Series = new SeriesCollection
|
||||||
|
{
|
||||||
|
// 柱状图
|
||||||
|
new ColumnSeries
|
||||||
|
{
|
||||||
|
Title = "柱状数据",
|
||||||
|
Values = new ChartValues<double> { 20, 10, 12, 5, 9 }
|
||||||
|
},
|
||||||
|
// 标准1
|
||||||
|
new LineSeries
|
||||||
|
{
|
||||||
|
Title = "标准1",
|
||||||
|
Values = new ChartValues<double> { 5, 5, 5, 5, 5 },
|
||||||
|
StrokeThickness = 2,
|
||||||
|
Fill = System.Windows.Media.Brushes.Transparent
|
||||||
|
},
|
||||||
|
// 标准2
|
||||||
|
new LineSeries
|
||||||
|
{
|
||||||
|
Title = "标准2",
|
||||||
|
Values = new ChartValues<double> { 10, 10, 10, 10, 10 },
|
||||||
|
StrokeThickness = 2,
|
||||||
|
Stroke = System.Windows.Media.Brushes.Green,
|
||||||
|
Fill = System.Windows.Media.Brushes.Transparent
|
||||||
|
},
|
||||||
|
// 标准3
|
||||||
|
new LineSeries
|
||||||
|
{
|
||||||
|
Title = "标准3",
|
||||||
|
Values = new ChartValues<double> { 30, 30, 30, 30, 30 },
|
||||||
|
StrokeThickness = 2,
|
||||||
|
Stroke = System.Windows.Media.Brushes.Red,
|
||||||
|
Fill = System.Windows.Media.Brushes.Transparent
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 设置X轴标签
|
||||||
|
myChart1.AxisX.Add(new Axis
|
||||||
|
{
|
||||||
|
Title = "",
|
||||||
|
Labels = new[] { "13:27 23", "13:27 45", "13:27 49", "13:27 50", "13:27 55" }
|
||||||
|
});
|
||||||
|
|
||||||
|
// 设置Y轴
|
||||||
|
myChart1.AxisY.Add(new Axis
|
||||||
|
{
|
||||||
|
Title = ""
|
||||||
|
});
|
||||||
|
|
||||||
|
// 传感器3
|
||||||
|
// 初始化Series
|
||||||
|
myChart2.Series = new SeriesCollection
|
||||||
|
{
|
||||||
|
// 柱状图
|
||||||
|
new ColumnSeries
|
||||||
|
{
|
||||||
|
Title = "柱状数据",
|
||||||
|
Values = new ChartValues<double> { 20, 10, 12, 5, 9 }
|
||||||
|
},
|
||||||
|
// 标准1
|
||||||
|
new LineSeries
|
||||||
|
{
|
||||||
|
Title = "标准1",
|
||||||
|
Values = new ChartValues<double> { 5, 5, 5, 5, 5 },
|
||||||
|
StrokeThickness = 2,
|
||||||
|
Fill = System.Windows.Media.Brushes.Transparent
|
||||||
|
},
|
||||||
|
// 标准2
|
||||||
|
new LineSeries
|
||||||
|
{
|
||||||
|
Title = "标准2",
|
||||||
|
Values = new ChartValues<double> { 10, 10, 10, 10, 10 },
|
||||||
|
StrokeThickness = 2,
|
||||||
|
Stroke = System.Windows.Media.Brushes.Green,
|
||||||
|
Fill = System.Windows.Media.Brushes.Transparent
|
||||||
|
},
|
||||||
|
// 标准3
|
||||||
|
new LineSeries
|
||||||
|
{
|
||||||
|
Title = "标准3",
|
||||||
|
Values = new ChartValues<double> { 30, 30, 30, 30, 30 },
|
||||||
|
StrokeThickness = 2,
|
||||||
|
Stroke = System.Windows.Media.Brushes.Red,
|
||||||
|
Fill = System.Windows.Media.Brushes.Transparent
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 设置X轴标签
|
||||||
|
myChart2.AxisX.Add(new Axis
|
||||||
|
{
|
||||||
|
Title = "",
|
||||||
|
Labels = new[] { "13:27 23", "13:27 45", "13:27 49", "13:27 50", "13:27 55" }
|
||||||
|
});
|
||||||
|
|
||||||
|
// 设置Y轴
|
||||||
|
myChart2.AxisY.Add(new Axis
|
||||||
|
{
|
||||||
|
Title = ""
|
||||||
|
});
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
|
@ -40,5 +203,193 @@ namespace WpfApp
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置窗体标题的函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newTitle"></param>
|
||||||
|
public void SetWindowTitle(string newTitle)
|
||||||
|
{
|
||||||
|
this.Title = newTitle;
|
||||||
|
}
|
||||||
|
// 在 MainWindow 内部
|
||||||
|
/// <summary>
|
||||||
|
/// 按钮点击触发文件页面
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void OnFilePageButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
FilePage filePage = new FilePage();
|
||||||
|
NavigationWindow navWin = new NavigationWindow();
|
||||||
|
|
||||||
|
navWin.Width = 810;
|
||||||
|
navWin.Height = 600;
|
||||||
|
navWin.ResizeMode = ResizeMode.NoResize;
|
||||||
|
navWin.Content = filePage;
|
||||||
|
navWin.ShowsNavigationUI = false;
|
||||||
|
navWin.Title = "记录列表";
|
||||||
|
|
||||||
|
|
||||||
|
// ✅ 新增:设定父窗口、样式与居中弹出
|
||||||
|
navWin.Owner = Application.Current.MainWindow; // 绑定主窗口
|
||||||
|
navWin.WindowStartupLocation = WindowStartupLocation.CenterOwner; // 居中弹出
|
||||||
|
navWin.WindowStyle = WindowStyle.ToolWindow;
|
||||||
|
|
||||||
|
// ✅ 改这里:Show() 改为 ShowDialog() 实现模态窗口
|
||||||
|
navWin.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 按钮点击触发配置页面
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void OnConfigPageButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ConfigPage configPage = new ConfigPage();
|
||||||
|
NavigationWindow navWin = new NavigationWindow();
|
||||||
|
navWin.Content = configPage;
|
||||||
|
navWin.ShowsNavigationUI = false;
|
||||||
|
navWin.Width = 972;
|
||||||
|
navWin.Height = 648;
|
||||||
|
navWin.Title = "配置";
|
||||||
|
navWin.ResizeMode = ResizeMode.NoResize;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ✅ 新增:设定父窗口、样式与居中弹出
|
||||||
|
navWin.Owner = Application.Current.MainWindow; // 绑定主窗口
|
||||||
|
navWin.WindowStartupLocation = WindowStartupLocation.CenterOwner; // 居中弹出
|
||||||
|
navWin.WindowStyle = WindowStyle.ToolWindow;
|
||||||
|
|
||||||
|
// ✅ 改这里:Show() 改为 ShowDialog() 实现模态窗口
|
||||||
|
navWin.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 按钮点击触发标准基准页面
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void OnStandardPageButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
StandardPage standardPage = new StandardPage();
|
||||||
|
NavigationWindow navWin = new NavigationWindow();
|
||||||
|
navWin.Width = 1440;
|
||||||
|
navWin.Height = 960;
|
||||||
|
navWin.ResizeMode = ResizeMode.NoResize;
|
||||||
|
navWin.Content = standardPage;
|
||||||
|
navWin.ShowsNavigationUI = false;
|
||||||
|
navWin.Title = "主标定";
|
||||||
|
|
||||||
|
|
||||||
|
// ✅ 新增:设定父窗口、样式与居中弹出
|
||||||
|
navWin.Owner = Application.Current.MainWindow; // 绑定主窗口
|
||||||
|
navWin.WindowStartupLocation = WindowStartupLocation.CenterOwner; // 居中弹出
|
||||||
|
navWin.WindowStyle = WindowStyle.ToolWindow;
|
||||||
|
|
||||||
|
// ✅ 改这里:Show() 改为 ShowDialog() 实现模态窗口
|
||||||
|
navWin.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 按钮点击触发Gauge页面
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void OnGaugePageButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
GaugePage gaugePage = new GaugePage();
|
||||||
|
NavigationWindow navWin = new NavigationWindow();
|
||||||
|
navWin.Content = gaugePage;
|
||||||
|
navWin.ShowsNavigationUI = false;
|
||||||
|
navWin.Width = 1080;
|
||||||
|
navWin.Height = 720;
|
||||||
|
navWin.Title = "Gauge R&&R";
|
||||||
|
|
||||||
|
// ✅ 新增:设定父窗口、样式与居中弹出
|
||||||
|
navWin.Owner = Application.Current.MainWindow; // 绑定主窗口
|
||||||
|
navWin.WindowStartupLocation = WindowStartupLocation.CenterOwner; // 居中弹出
|
||||||
|
navWin.WindowStyle = WindowStyle.ToolWindow;
|
||||||
|
|
||||||
|
// ✅ 改这里:Show() 改为 ShowDialog() 实现模态窗口
|
||||||
|
navWin.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 按钮点击触发CgCgk页面
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void OnCgCgkPageButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
CgCgkPage cgCgkPage = new CgCgkPage();
|
||||||
|
NavigationWindow navWin = new NavigationWindow();
|
||||||
|
navWin.Content = cgCgkPage;
|
||||||
|
navWin.ShowsNavigationUI = false;
|
||||||
|
navWin.Title = "CgCgk";
|
||||||
|
|
||||||
|
|
||||||
|
// ✅ 新增:设定父窗口、样式与居中弹出
|
||||||
|
navWin.Owner = Application.Current.MainWindow; // 绑定主窗口
|
||||||
|
navWin.WindowStartupLocation = WindowStartupLocation.CenterOwner; // 居中弹出
|
||||||
|
navWin.WindowStyle = WindowStyle.ToolWindow;
|
||||||
|
|
||||||
|
// ✅ 改这里:Show() 改为 ShowDialog() 实现模态窗口
|
||||||
|
navWin.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 按钮点击触发系统设置页面
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void OnSysSetPageButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SysSetPage sysSetPage = new SysSetPage();
|
||||||
|
NavigationWindow navWin = new NavigationWindow();
|
||||||
|
navWin.Width = 810;
|
||||||
|
navWin.Height = 600;
|
||||||
|
navWin.ResizeMode = ResizeMode.NoResize;
|
||||||
|
navWin.Content = sysSetPage;
|
||||||
|
navWin.ShowsNavigationUI = false;
|
||||||
|
navWin.Title = "系统设置";
|
||||||
|
|
||||||
|
|
||||||
|
// ✅ 新增:设定父窗口、样式与居中弹出
|
||||||
|
navWin.Owner = Application.Current.MainWindow; // 绑定主窗口
|
||||||
|
navWin.WindowStartupLocation = WindowStartupLocation.CenterOwner; // 居中弹出
|
||||||
|
navWin.WindowStyle = WindowStyle.ToolWindow;
|
||||||
|
|
||||||
|
// ✅ 改这里:Show() 改为 ShowDialog() 实现模态窗口
|
||||||
|
navWin.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 按钮点击触发关闭页面
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void OnCloseMainWindowButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 测试按钮
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void OnDemoButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
//LineBarChartDemo lineBarChartDemo = new LineBarChartDemo();
|
||||||
|
//lineBarChartDemo.Show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,8 +8,34 @@
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="src\public\Icons\main1-file-icon.png" />
|
||||||
|
<None Remove="src\public\Icons\main2-config-icon.png" />
|
||||||
|
<None Remove="src\public\Icons\main3-standard-icon.png" />
|
||||||
|
<None Remove="src\public\Icons\main4-detection-icon.png" />
|
||||||
|
<None Remove="src\public\Icons\main5-gauge-icon.png" />
|
||||||
|
<None Remove="src\public\Icons\main6-cgCgk-icon.png" />
|
||||||
|
<None Remove="src\public\Icons\main7-sysSet-icon.png" />
|
||||||
|
<None Remove="src\public\Icons\main8-exit-icon.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="src\public\Icons\main6-cgCgk-icon.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="src\public\Icons\main1-file-icon.png" />
|
||||||
|
<Resource Include="src\public\Icons\main2-config-icon.png" />
|
||||||
|
<Resource Include="src\public\Icons\main3-standard-icon.png" />
|
||||||
|
<Resource Include="src\public\Icons\main4-detection-icon.png" />
|
||||||
|
<Resource Include="src\public\Icons\main5-gauge-icon.png" />
|
||||||
|
<Resource Include="src\public\Icons\main7-sysSet-icon.png" />
|
||||||
|
<Resource Include="src\public\Icons\main8-exit-icon.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="HslCommunication" Version="12.5.1" />
|
<PackageReference Include="HslCommunication" Version="12.5.1" />
|
||||||
|
<PackageReference Include="LiveCharts.Wpf" Version="0.9.7" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.205" />
|
<PackageReference Include="SqlSugarCore" Version="5.1.4.205" />
|
||||||
|
|
@ -22,4 +48,8 @@
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="新文件夹\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
214
src/components/SensorChart.xaml
Normal file
|
|
@ -0,0 +1,214 @@
|
||||||
|
<UserControl x:Class="WpfApp.src.components.SensorChart"
|
||||||
|
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:DesignWidth="200" Height="482">
|
||||||
|
<Border Background="White" BorderBrush="#CCCCCC" BorderThickness="1">
|
||||||
|
<Grid Margin="0,0,0,-1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 标题栏 -->
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
Text="{Binding SensorName, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Background="{Binding HeaderBackground, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
|
||||||
|
|
||||||
|
<!-- 图表区域 -->
|
||||||
|
<Canvas Grid.Row="1" Background="White" Margin="20,20,20,3" Name="ChartCanvas">
|
||||||
|
<!-- 柱状图容器边框 - 左边界线 -->
|
||||||
|
<Line X1="40" Y1="20" X2="40" Y2="420" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<!-- 右边界线 -->
|
||||||
|
<Line X1="120" Y1="20" X2="120" Y2="420" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<!-- 顶部边界线 -->
|
||||||
|
<Line X1="40" Y1="20" X2="120" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<!-- 底部边界线 -->
|
||||||
|
<Line X1="40" Y1="420" X2="120" Y2="420" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
|
||||||
|
<!-- 大刻度线和标签 - 从40到-40,每5个单位一个刻度 -->
|
||||||
|
<!-- 40 -->
|
||||||
|
<Line X1="120" Y1="20" X2="130" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="15" Text="40" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- 35 -->
|
||||||
|
<Line X1="40" Y1="45" X2="130" Y2="45" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="40" Text="35" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- 30 -->
|
||||||
|
<Line X1="40" Y1="70" X2="130" Y2="70" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="65" Text="30" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- 25 -->
|
||||||
|
<Line X1="40" Y1="95" X2="130" Y2="95" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="90" Text="25" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- 20 -->
|
||||||
|
<Line X1="40" Y1="120" X2="130" Y2="120" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="115" Text="20" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- 15 -->
|
||||||
|
<Line X1="40" Y1="145" X2="130" Y2="145" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="140" Text="15" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- 10 -->
|
||||||
|
<Line X1="40" Y1="170" X2="130" Y2="170" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="165" Text="10" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- 5 -->
|
||||||
|
<Line X1="40" Y1="195" X2="130" Y2="195" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="190" Text="5" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- 0 -->
|
||||||
|
<Line X1="40" Y1="220" X2="130" Y2="220" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="215" Text="0" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- -5 -->
|
||||||
|
<Line X1="40" Y1="245" X2="130" Y2="245" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="240" Text="-5" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- -10 -->
|
||||||
|
<Line X1="40" Y1="270" X2="130" Y2="270" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="265" Text="-10" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- -15 -->
|
||||||
|
<Line X1="40" Y1="295" X2="130" Y2="295" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="290" Text="-15" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- -20 -->
|
||||||
|
<Line X1="40" Y1="320" X2="130" Y2="320" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="315" Text="-20" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- -25 -->
|
||||||
|
<Line X1="40" Y1="345" X2="130" Y2="345" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="340" Text="-25" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- -30 -->
|
||||||
|
<Line X1="40" Y1="370" X2="130" Y2="370" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="365" Text="-30" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- -35 -->
|
||||||
|
<Line X1="40" Y1="395" X2="130" Y2="395" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="390" Text="-35" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- -40 -->
|
||||||
|
<Line X1="120" Y1="420" X2="130" Y2="420" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<TextBlock Canvas.Left="135" Canvas.Top="415" Text="-40" FontSize="10"/>
|
||||||
|
|
||||||
|
<!-- 小刻度线 - 每个大刻度之间3个小刻度 -->
|
||||||
|
<!-- 40到35之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="26.25" X2="125" Y2="26.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="32.5" X2="125" Y2="32.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="38.75" X2="125" Y2="38.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- 35到30之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="51.25" X2="125" Y2="51.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="57.5" X2="125" Y2="57.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="63.75" X2="125" Y2="63.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- 30到25之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="76.25" X2="125" Y2="76.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="82.5" X2="125" Y2="82.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="88.75" X2="125" Y2="88.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- 25到20之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="101.25" X2="125" Y2="101.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="107.5" X2="125" Y2="107.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="113.75" X2="125" Y2="113.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- 20到15之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="126.25" X2="125" Y2="126.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="132.5" X2="125" Y2="132.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="138.75" X2="125" Y2="138.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- 15到10之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="151.25" X2="125" Y2="151.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="157.5" X2="125" Y2="157.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="163.75" X2="125" Y2="163.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- 10到5之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="176.25" X2="125" Y2="176.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="182.5" X2="125" Y2="182.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="188.75" X2="125" Y2="188.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- 5到0之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="201.25" X2="125" Y2="201.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="207.5" X2="125" Y2="207.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="213.75" X2="125" Y2="213.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- 0到-5之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="226.25" X2="125" Y2="226.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="232.5" X2="125" Y2="232.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="238.75" X2="125" Y2="238.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- -5到-10之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="251.25" X2="125" Y2="251.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="257.5" X2="125" Y2="257.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="263.75" X2="125" Y2="263.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- -10到-15之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="276.25" X2="125" Y2="276.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="282.5" X2="125" Y2="282.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="288.75" X2="125" Y2="288.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- -15到-20之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="301.25" X2="125" Y2="301.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="307.5" X2="125" Y2="307.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="313.75" X2="125" Y2="313.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- -20到-25之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="326.25" X2="125" Y2="326.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="332.5" X2="125" Y2="332.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="338.75" X2="125" Y2="338.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- -25到-30之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="351.25" X2="125" Y2="351.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="357.5" X2="125" Y2="357.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="363.75" X2="125" Y2="363.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- -30到-35之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="376.25" X2="125" Y2="376.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="382.5" X2="125" Y2="382.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="388.75" X2="125" Y2="388.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- -35到-40之间的小刻度 -->
|
||||||
|
<Line X1="40" Y1="401.25" X2="125" Y2="401.25" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="407.5" X2="125" Y2="407.5" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
<Line X1="40" Y1="413.75" X2="125" Y2="413.75" Stroke="Black" StrokeThickness="0.5"/>
|
||||||
|
|
||||||
|
<!-- 柱状图数据 - 紧贴左右边界 -->
|
||||||
|
<Rectangle Name="DataBar"
|
||||||
|
Canvas.Left="40"
|
||||||
|
Canvas.Top="{Binding BarTop, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||||
|
Width="80"
|
||||||
|
Height="{Binding BarHeight, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||||
|
Fill="Blue"
|
||||||
|
Opacity="0.7"/>
|
||||||
|
|
||||||
|
<!-- 红色标记线 -->
|
||||||
|
<ItemsControl Name="RedLines" ItemsSource="{Binding RedLinePositions, RelativeSource={RelativeSource AncestorType=UserControl}}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<Canvas/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Line X1="40" Y1="{Binding}" X2="120" Y2="{Binding}" Stroke="Red" StrokeThickness="2"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
<ItemsControl.ItemContainerStyle>
|
||||||
|
<Style TargetType="ContentPresenter">
|
||||||
|
<Setter Property="Canvas.Top" Value="0"/>
|
||||||
|
<Setter Property="Canvas.Left" Value="0"/>
|
||||||
|
</Style>
|
||||||
|
</ItemsControl.ItemContainerStyle>
|
||||||
|
</ItemsControl>
|
||||||
|
</Canvas>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</UserControl>
|
||||||
243
src/components/SensorChart.xaml.cs
Normal file
|
|
@ -0,0 +1,243 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace WpfApp.src.components
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// SensorChart.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class SensorChart : UserControl, INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public SensorChart()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
DataContext = this;
|
||||||
|
|
||||||
|
// 设置默认值
|
||||||
|
SensorName = "传感器";
|
||||||
|
HeaderBackground = new SolidColorBrush(Color.FromRgb(230, 243, 255)); // #E6F3FF
|
||||||
|
Value = 0;
|
||||||
|
RedLineValues = new List<double>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
protected virtual void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 依赖属性
|
||||||
|
|
||||||
|
// 传感器名称
|
||||||
|
public static readonly DependencyProperty SensorNameProperty =
|
||||||
|
DependencyProperty.Register("SensorName", typeof(string), typeof(SensorChart),
|
||||||
|
new PropertyMetadata("传感器", OnSensorNameChanged));
|
||||||
|
|
||||||
|
public string SensorName
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(SensorNameProperty); }
|
||||||
|
set { SetValue(SensorNameProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnSensorNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var control = d as SensorChart;
|
||||||
|
control?.OnPropertyChanged(nameof(SensorName));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标题背景色
|
||||||
|
public static readonly DependencyProperty HeaderBackgroundProperty =
|
||||||
|
DependencyProperty.Register("HeaderBackground", typeof(Brush), typeof(SensorChart),
|
||||||
|
new PropertyMetadata(new SolidColorBrush(Color.FromRgb(230, 243, 255)), OnHeaderBackgroundChanged));
|
||||||
|
|
||||||
|
public Brush HeaderBackground
|
||||||
|
{
|
||||||
|
get { return (Brush)GetValue(HeaderBackgroundProperty); }
|
||||||
|
set { SetValue(HeaderBackgroundProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnHeaderBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var control = d as SensorChart;
|
||||||
|
control?.OnPropertyChanged(nameof(HeaderBackground));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 数值
|
||||||
|
public static readonly DependencyProperty ValueProperty =
|
||||||
|
DependencyProperty.Register("Value", typeof(double), typeof(SensorChart),
|
||||||
|
new PropertyMetadata(0.0, OnValueChanged));
|
||||||
|
|
||||||
|
public double Value
|
||||||
|
{
|
||||||
|
get { return (double)GetValue(ValueProperty); }
|
||||||
|
set { SetValue(ValueProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var control = d as SensorChart;
|
||||||
|
control?.UpdateBarPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 红线数值列表
|
||||||
|
public static readonly DependencyProperty RedLineValuesProperty =
|
||||||
|
DependencyProperty.Register("RedLineValues", typeof(List<double>), typeof(SensorChart),
|
||||||
|
new PropertyMetadata(new List<double>(), OnRedLineValuesChanged));
|
||||||
|
|
||||||
|
public List<double> RedLineValues
|
||||||
|
{
|
||||||
|
get { return (List<double>)GetValue(RedLineValuesProperty); }
|
||||||
|
set { SetValue(RedLineValuesProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnRedLineValuesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var control = d as SensorChart;
|
||||||
|
control?.UpdateRedLinePositions();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 计算属性
|
||||||
|
|
||||||
|
private double _barTop;
|
||||||
|
public double BarTop
|
||||||
|
{
|
||||||
|
get { return _barTop; }
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
_barTop = value;
|
||||||
|
OnPropertyChanged(nameof(BarTop));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double _barHeight;
|
||||||
|
public double BarHeight
|
||||||
|
{
|
||||||
|
get { return _barHeight; }
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
_barHeight = value;
|
||||||
|
OnPropertyChanged(nameof(BarHeight));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<double> _redLinePositions = new List<double>();
|
||||||
|
public List<double> RedLinePositions
|
||||||
|
{
|
||||||
|
get { return _redLinePositions; }
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
_redLinePositions = value;
|
||||||
|
OnPropertyChanged(nameof(RedLinePositions));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 私有方法
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 将数值转换为Y坐标位置
|
||||||
|
/// 刻度范围:40 到 -40,对应Y坐标:20 到 420
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">数值</param>
|
||||||
|
/// <returns>Y坐标</returns>
|
||||||
|
private double ValueToY(double value)
|
||||||
|
{
|
||||||
|
// 限制数值范围
|
||||||
|
value = Math.Max(-40, Math.Min(40, value));
|
||||||
|
|
||||||
|
// 线性映射:40对应Y=20,-40对应Y=420
|
||||||
|
// Y = 220 - value * 5
|
||||||
|
return 220 - value * 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新柱状图位置
|
||||||
|
/// </summary>
|
||||||
|
private void UpdateBarPosition()
|
||||||
|
{
|
||||||
|
if (Value >= 0)
|
||||||
|
{
|
||||||
|
// 正值:从0线向上
|
||||||
|
BarTop = ValueToY(Value);
|
||||||
|
BarHeight = ValueToY(0) - ValueToY(Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 负值:从0线向下
|
||||||
|
BarTop = ValueToY(0);
|
||||||
|
BarHeight = ValueToY(Value) - ValueToY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新红线位置
|
||||||
|
/// </summary>
|
||||||
|
private void UpdateRedLinePositions()
|
||||||
|
{
|
||||||
|
var positions = new List<double>();
|
||||||
|
if (RedLineValues != null)
|
||||||
|
{
|
||||||
|
foreach (var value in RedLineValues)
|
||||||
|
{
|
||||||
|
positions.Add(ValueToY(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RedLinePositions = positions;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 公共方法
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置传感器数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">传感器名称</param>
|
||||||
|
/// <param name="value">数值</param>
|
||||||
|
/// <param name="redLines">红线数值列表</param>
|
||||||
|
/// <param name="headerColor">标题背景色</param>
|
||||||
|
public void SetSensorData(string name, double value, List<double> redLines = null, Color? headerColor = null)
|
||||||
|
{
|
||||||
|
SensorName = name;
|
||||||
|
Value = value;
|
||||||
|
|
||||||
|
if (redLines != null)
|
||||||
|
{
|
||||||
|
RedLineValues = new List<double>(redLines);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (headerColor.HasValue)
|
||||||
|
{
|
||||||
|
HeaderBackground = new SolidColorBrush(headerColor.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加红线
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">红线数值</param>
|
||||||
|
public void AddRedLine(double value)
|
||||||
|
{
|
||||||
|
var lines = new List<double>(RedLineValues) { value };
|
||||||
|
RedLineValues = lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清除所有红线
|
||||||
|
/// </summary>
|
||||||
|
public void ClearRedLines()
|
||||||
|
{
|
||||||
|
RedLineValues = new List<double>();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
src/public/Icons/main1-file-icon.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
src/public/Icons/main2-config-icon.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
src/public/Icons/main3-standard-icon.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
src/public/Icons/main4-detection-icon.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
src/public/Icons/main5-gauge-icon.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
src/public/Icons/main6-cgCgk-icon.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
src/public/Icons/main7-sysSet-icon.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
src/public/Icons/main8-exit-icon.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
15
src/view/CgCgkPage.xaml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<Page x:Class="WpfApp.src.view.CgCgkPage"
|
||||||
|
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"
|
||||||
|
xmlns:local="clr-namespace:WpfApp.src.view"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
Title="CgCgkPage">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Button Content="CgCgkPage"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
28
src/view/CgCgkPage.xaml.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace WpfApp.src.view
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// CgCgkPage.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class CgCgkPage : Page
|
||||||
|
{
|
||||||
|
public CgCgkPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
243
src/view/ConfigPage.xaml
Normal file
|
|
@ -0,0 +1,243 @@
|
||||||
|
<Page x:Class="WpfApp.src.view.ConfigPage"
|
||||||
|
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="800" d:DesignWidth="1200"
|
||||||
|
Title="ConfigPage">
|
||||||
|
|
||||||
|
<Grid Background="#F0F0F0">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<!-- 主内容 -->
|
||||||
|
<RowDefinition Height="60"/>
|
||||||
|
<!-- 底部按钮固定高度 -->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 主内容区域 -->
|
||||||
|
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" Margin="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<!-- 左侧1:1 -->
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<!-- 右侧1:1 -->
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 左侧区域 -->
|
||||||
|
<Grid Grid.Column="0">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="1*"/>
|
||||||
|
<!-- 产品名称 -->
|
||||||
|
<RowDefinition Height="3*"/>
|
||||||
|
<!-- 传感器选择 -->
|
||||||
|
<RowDefinition Height="7*"/>
|
||||||
|
<!-- 公差设定 -->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 产品名称 -->
|
||||||
|
<Border Grid.Row="0" Background="White" BorderBrush="#CCCCCC" BorderThickness="1" Margin="5" Padding="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="产品名称" FontWeight="Bold" VerticalAlignment="Center" Margin="0,0,10,0"/>
|
||||||
|
<TextBox Grid.Column="1" Text="DFPV C15TE" Height="30" Background="#E6F3FF" VerticalContentAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 传感器选择 -->
|
||||||
|
<Border Grid.Row="1" Background="White" BorderBrush="#CCCCCC" BorderThickness="1" Margin="5" Padding="10">
|
||||||
|
<StackPanel>
|
||||||
|
<Border Background="#4472C4" Padding="5" Margin="0,0,0,10">
|
||||||
|
<TextBlock Text="传感器选择" Foreground="White" FontWeight="Bold" HorizontalAlignment="Left"/>
|
||||||
|
</Border>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<CheckBox Grid.Row="0" Grid.Column="0" Content="数字传感器1" IsChecked="True" Margin="5"/>
|
||||||
|
<CheckBox Grid.Row="0" Grid.Column="1" Content="数字传感器2" IsChecked="True" Margin="5"/>
|
||||||
|
<CheckBox Grid.Row="1" Grid.Column="0" Content="数字传感器3" IsChecked="True" Margin="5"/>
|
||||||
|
<CheckBox Grid.Row="1" Grid.Column="1" Content="数字传感器4" Margin="5"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 公差设定 -->
|
||||||
|
<Border Grid.Row="2" Background="White" BorderBrush="#CCCCCC" BorderThickness="1" Margin="5" Padding="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Border Grid.Row="0" Background="#4472C4" Padding="5" Margin="0,0,0,10">
|
||||||
|
<TextBlock Text="公差设定" Foreground="White" FontWeight="Bold" HorizontalAlignment="Left"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 传感器标签页 -->
|
||||||
|
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,0,0,10">
|
||||||
|
<Button x:Name="SensorTab1" Content="传感器1" Width="80" Height="30" Background="#E6F3FF" Click="SensorTab_Click" Tag="1"/>
|
||||||
|
<Button x:Name="SensorTab2" Content="传感器2" Width="80" Height="30" Background="#F0F0F0" Click="SensorTab_Click" Tag="2"/>
|
||||||
|
<Button x:Name="SensorTab3" Content="传感器3" Width="80" Height="30" Background="#F0F0F0" Click="SensorTab_Click" Tag="3"/>
|
||||||
|
<Button x:Name="SensorTab4" Content="传感器4" Width="80" Height="30" Background="#F0F0F0" Click="SensorTab_Click" Tag="4"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 公差数值输入 -->
|
||||||
|
<StackPanel Grid.Row="2" x:Name="ToleranceInputPanel">
|
||||||
|
<Grid Margin="0,10">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="120"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="0" Text="最大公差(微米)" VerticalAlignment="Center" Margin="0,5"/>
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="1" x:Name="MaxToleranceTextBox" Text="9.00" Height="30" Margin="5" Background="#E6F3FF"/>
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" Text="基准尺寸(毫米)" VerticalAlignment="Center" Margin="0,5"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" x:Name="BaseToleranceTextBox" Text="72.9410" Height="30" Margin="5" Background="#E6F3FF"/>
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="0" Text="最小公差(微米)" VerticalAlignment="Center" Margin="0,5"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" x:Name="MinToleranceTextBox" Text="-9.00" Height="30" Margin="5" Background="#E6F3FF"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 右侧区域 -->
|
||||||
|
<Grid Grid.Column="1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="3*"/>
|
||||||
|
<!-- 主传感器选择 -->
|
||||||
|
<RowDefinition Height="7*"/>
|
||||||
|
<!-- 等级信息设定 -->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 主传感器选择 -->
|
||||||
|
<Border Grid.Row="0" Background="White" BorderBrush="#CCCCCC" BorderThickness="1" Margin="5" Padding="10">
|
||||||
|
<StackPanel>
|
||||||
|
<Border Background="#4472C4" Padding="5" Margin="0,0,0,10">
|
||||||
|
<TextBlock Text="主传感器选择" Foreground="White" FontWeight="Bold" HorizontalAlignment="Left"/>
|
||||||
|
</Border>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<RadioButton Grid.Row="0" Grid.Column="0" Content="数字传感器1" IsChecked="True" GroupName="MainSensor" Margin="5"/>
|
||||||
|
<RadioButton Grid.Row="0" Grid.Column="1" Content="数字传感器2" GroupName="MainSensor" Margin="5"/>
|
||||||
|
<RadioButton Grid.Row="1" Grid.Column="0" Content="数字传感器3" GroupName="MainSensor" Margin="5"/>
|
||||||
|
<RadioButton Grid.Row="1" Grid.Column="1" Content="数字传感器4" GroupName="MainSensor" Margin="5"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 等级信息设定 -->
|
||||||
|
<Border Grid.Row="1" Background="White" BorderBrush="#CCCCCC" BorderThickness="1" Margin="5" Padding="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<!-- 标题 -->
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<!-- 分页栏 -->
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<!-- 内容区 -->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 标题 -->
|
||||||
|
<Border Grid.Row="0" Background="#4472C4" Padding="5" Margin="0,0,0,10">
|
||||||
|
<TextBlock Text="等级信息设定(毫米)" Foreground="White" FontWeight="Bold" HorizontalAlignment="Left"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 等级标签页 -->
|
||||||
|
<Grid Grid.Row="1" Margin="0,0,0,10">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Button Grid.Column="0" x:Name="LevelTabUnder" Content="Under" Height="30" Background="#E6F3FF" Tag="Under"/>
|
||||||
|
<Button Grid.Column="1" x:Name="LevelTabA" Content="A" Height="30" Background="#F0F0F0" Tag="A"/>
|
||||||
|
<Button Grid.Column="2" x:Name="LevelTabB" Content="B" Height="30" Background="#F0F0F0" Tag="B"/>
|
||||||
|
<Button Grid.Column="3" x:Name="LevelTabC" Content="C" Height="30" Background="#F0F0F0" Tag="C"/>
|
||||||
|
<Button Grid.Column="4" x:Name="LevelTabD" Content="D" Height="30" Background="#F0F0F0" Tag="D"/>
|
||||||
|
<Button Grid.Column="5" x:Name="LevelTabE" Content="E" Height="30" Background="#F0F0F0" Tag="E"/>
|
||||||
|
<Button Grid.Column="6" x:Name="LevelTabF" Content="F" Height="30" Background="#F0F0F0" Tag="F"/>
|
||||||
|
<Button Grid.Column="7" x:Name="LevelTabG" Content="G" Height="30" Background="#F0F0F0" Tag="G"/>
|
||||||
|
<Button Grid.Column="8" x:Name="LevelTabOver" Content="Over" Height="30" Background="#F0F0F0" Tag="Over"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 等级信息输入区 -->
|
||||||
|
<StackPanel Grid.Row="2" x:Name="LevelInfoPanel" HorizontalAlignment="Center">
|
||||||
|
<Grid Margin="0,5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="60"/>
|
||||||
|
<ColumnDefinition Width="40"/>
|
||||||
|
<ColumnDefinition Width="120"/>
|
||||||
|
<ColumnDefinition Width="60"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 按钮行 -->
|
||||||
|
<Button Grid.Row="0" Grid.Column="0" Content="低" Width="50" Height="25"
|
||||||
|
Background="#333333" Foreground="White" HorizontalAlignment="Center" Margin="0,30,0,0"/>
|
||||||
|
<Button Grid.Row="0" Grid.Column="2" Content="高" Width="50" Height="25"
|
||||||
|
Background="#333333" Foreground="White" HorizontalAlignment="Center" Margin="0,30,0,0"/>
|
||||||
|
<Button Grid.Row="0" Grid.Column="3" Content="标记" Width="50" Height="25"
|
||||||
|
Background="#333333" Foreground="White" HorizontalAlignment="Center" Margin="0,30,0,0"/>
|
||||||
|
|
||||||
|
<!-- 数值行 -->
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" Text="下限" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,30,0,0" />
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="1" Text="<" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="16" Margin="0,30,0,0"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="2" Text="-0.0090" Height="30" Background="#E6F3FF" HorizontalAlignment="Center" Width="100" Margin="0,30,0,0"/>
|
||||||
|
<Border Grid.Row="1" Grid.Column="3" Background="#CCCCCC" Height="30" Width="50" Margin="0,30,0,0">
|
||||||
|
<TextBlock Text="NG" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
<!-- 底部按钮区域 -->
|
||||||
|
<Border Grid.Row="1" Background="#E0E0E0" BorderBrush="#CCCCCC" BorderThickness="0,1,0,0">
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="20,0">
|
||||||
|
<Button Content="保存" Width="80" Height="35" Background="#90EE90" Margin="10,0"/>
|
||||||
|
<Button Content="取消" Width="80" Height="35" Background="#F0F0F0" Margin="10,0"/>
|
||||||
|
<Button Content="完成" Width="80" Height="35" Background="#F0F0F0" Margin="10,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
137
src/view/ConfigPage.xaml.cs
Normal file
|
|
@ -0,0 +1,137 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace WpfApp.src.view
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ConfigPage.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class ConfigPage : Page
|
||||||
|
{
|
||||||
|
// 传感器数据字典,存储每个传感器的公差设定值
|
||||||
|
private Dictionary<int, SensorToleranceData> sensorData;
|
||||||
|
|
||||||
|
public ConfigPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
InitializeSensorData();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化传感器数据
|
||||||
|
private void InitializeSensorData()
|
||||||
|
{
|
||||||
|
sensorData = new Dictionary<int, SensorToleranceData>
|
||||||
|
{
|
||||||
|
{ 1, new SensorToleranceData { MaxTolerance = "9.00", BaseTolerance = "72.9410", MinTolerance = "-9.00" } },
|
||||||
|
{ 2, new SensorToleranceData { MaxTolerance = "8.50", BaseTolerance = "72.8500", MinTolerance = "-8.50" } },
|
||||||
|
{ 3, new SensorToleranceData { MaxTolerance = "7.80", BaseTolerance = "72.7800", MinTolerance = "-7.80" } },
|
||||||
|
{ 4, new SensorToleranceData { MaxTolerance = "6.90", BaseTolerance = "72.6900", MinTolerance = "-6.90" } }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 传感器标签页点击事件处理
|
||||||
|
private void SensorTab_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Button clickedButton = sender as Button;
|
||||||
|
if (clickedButton == null) return;
|
||||||
|
|
||||||
|
int sensorIndex = int.Parse(clickedButton.Tag.ToString());
|
||||||
|
|
||||||
|
// 保存当前传感器的数据
|
||||||
|
SaveCurrentSensorData();
|
||||||
|
|
||||||
|
// 更新标签页样式
|
||||||
|
UpdateTabStyles(sensorIndex);
|
||||||
|
|
||||||
|
// 加载选中传感器的数据
|
||||||
|
LoadSensorData(sensorIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存当前传感器的数据
|
||||||
|
private void SaveCurrentSensorData()
|
||||||
|
{
|
||||||
|
// 获取当前选中的传感器索引
|
||||||
|
int currentSensorIndex = GetCurrentSelectedSensorIndex();
|
||||||
|
|
||||||
|
if (sensorData.ContainsKey(currentSensorIndex))
|
||||||
|
{
|
||||||
|
sensorData[currentSensorIndex].MaxTolerance = MaxToleranceTextBox.Text;
|
||||||
|
sensorData[currentSensorIndex].BaseTolerance = BaseToleranceTextBox.Text;
|
||||||
|
sensorData[currentSensorIndex].MinTolerance = MinToleranceTextBox.Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前选中的传感器索引
|
||||||
|
private int GetCurrentSelectedSensorIndex()
|
||||||
|
{
|
||||||
|
if (SensorTab1.Background is SolidColorBrush brush1 && brush1.Color == ((SolidColorBrush)new BrushConverter().ConvertFrom("#E6F3FF")).Color)
|
||||||
|
return 1;
|
||||||
|
if (SensorTab2.Background is SolidColorBrush brush2 && brush2.Color == ((SolidColorBrush)new BrushConverter().ConvertFrom("#E6F3FF")).Color)
|
||||||
|
return 2;
|
||||||
|
if (SensorTab3.Background is SolidColorBrush brush3 && brush3.Color == ((SolidColorBrush)new BrushConverter().ConvertFrom("#E6F3FF")).Color)
|
||||||
|
return 3;
|
||||||
|
if (SensorTab4.Background is SolidColorBrush brush4 && brush4.Color == ((SolidColorBrush)new BrushConverter().ConvertFrom("#E6F3FF")).Color)
|
||||||
|
return 4;
|
||||||
|
return 1; // 默认返回传感器1
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新标签页样式
|
||||||
|
private void UpdateTabStyles(int selectedIndex)
|
||||||
|
{
|
||||||
|
// 重置所有标签页样式
|
||||||
|
SensorTab1.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F0F0F0"));
|
||||||
|
SensorTab2.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F0F0F0"));
|
||||||
|
SensorTab3.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F0F0F0"));
|
||||||
|
SensorTab4.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F0F0F0"));
|
||||||
|
|
||||||
|
// 设置选中标签页样式
|
||||||
|
switch (selectedIndex)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
SensorTab1.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E6F3FF"));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
SensorTab2.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E6F3FF"));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
SensorTab3.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E6F3FF"));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
SensorTab4.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E6F3FF"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载传感器数据
|
||||||
|
private void LoadSensorData(int sensorIndex)
|
||||||
|
{
|
||||||
|
if (sensorData.ContainsKey(sensorIndex))
|
||||||
|
{
|
||||||
|
var data = sensorData[sensorIndex];
|
||||||
|
MaxToleranceTextBox.Text = data.MaxTolerance;
|
||||||
|
BaseToleranceTextBox.Text = data.BaseTolerance;
|
||||||
|
MinToleranceTextBox.Text = data.MinTolerance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 传感器公差数据类
|
||||||
|
public class SensorToleranceData
|
||||||
|
{
|
||||||
|
public string MaxTolerance { get; set; }
|
||||||
|
public string BaseTolerance { get; set; }
|
||||||
|
public string MinTolerance { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
101
src/view/FilePage.xaml
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
<Page x:Class="WpfApp.src.view.FilePage"
|
||||||
|
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"
|
||||||
|
xmlns:local="clr-namespace:WpfApp.src.view"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
Title="记录列表">
|
||||||
|
|
||||||
|
<Grid Background="#E6F3FF">
|
||||||
|
<!-- 定义行 -->
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 顶部搜索区域 -->
|
||||||
|
<Grid Grid.Row="0" Margin="10,5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="60"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="80"/>
|
||||||
|
<ColumnDefinition Width="80"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Text="名称" VerticalAlignment="Center"
|
||||||
|
FontSize="14" Foreground="#333333"/>
|
||||||
|
<TextBox Grid.Column="1" Name="SearchTextBox" Margin="5,0"
|
||||||
|
VerticalAlignment="Center" Height="30"
|
||||||
|
BorderBrush="#CCCCCC" BorderThickness="1"/>
|
||||||
|
<Button Grid.Column="2" Content="查找" Margin="5,0" Height="30"
|
||||||
|
Background="#4A90E2" Foreground="White" BorderThickness="0"
|
||||||
|
FontSize="12" Click="SearchButton_Click"/>
|
||||||
|
<Button Grid.Column="3" Content="删除" Margin="5,0" Height="30"
|
||||||
|
Background="#E74C3C" Foreground="White" BorderThickness="0"
|
||||||
|
FontSize="12" Click="DeleteButton_Click"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 主要列表区域 -->
|
||||||
|
<Border Grid.Row="1" Margin="10,5" BorderBrush="#FFFFE0" BorderThickness="1"
|
||||||
|
Background="#FFFFE0">
|
||||||
|
<ListBox Name="RecordListBox"
|
||||||
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||||
|
BorderThickness="0"
|
||||||
|
SelectionMode="Single">
|
||||||
|
<ListBox.ItemContainerStyle>
|
||||||
|
<Style TargetType="ListBoxItem">
|
||||||
|
<Setter Property="Padding" Value="0"/>
|
||||||
|
<Setter Property="Margin" Value="0"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ListBoxItem">
|
||||||
|
<Border Name="ItemBorder"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
Padding="8,4">
|
||||||
|
<ContentPresenter/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter TargetName="ItemBorder" Property="Background" Value="#4169E1"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="ItemBorder" Property="Background" Value="#6495ED"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</ListBox.ItemContainerStyle>
|
||||||
|
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding}" Foreground="Black" FontSize="12"
|
||||||
|
FontFamily="Consolas" Padding="5,2"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 底部按钮区域 -->
|
||||||
|
<Grid Grid.Row="2" Margin="10,5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="80"/>
|
||||||
|
<ColumnDefinition Width="80"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Button Grid.Column="1" Content="选择" Margin="5,0" Height="35"
|
||||||
|
Background="#4A90E2" Foreground="White" BorderThickness="0"
|
||||||
|
FontSize="14" Click="SelectButton_Click"/>
|
||||||
|
<Button Grid.Column="2" Content="关闭" Margin="5,0" Height="35"
|
||||||
|
Background="#95A5A6" Foreground="White" BorderThickness="0"
|
||||||
|
FontSize="14" Click="CloseButton_Click"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
153
src/view/FilePage.xaml.cs
Normal file
|
|
@ -0,0 +1,153 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace WpfApp.src.view
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// FilePage.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class FilePage : Page
|
||||||
|
{
|
||||||
|
public FilePage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
LoadSampleData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadSampleData()
|
||||||
|
{
|
||||||
|
// 清空现有项目
|
||||||
|
RecordListBox.Items.Clear();
|
||||||
|
|
||||||
|
// 添加示例数据
|
||||||
|
var records = new List<string>
|
||||||
|
{
|
||||||
|
"1. GGG[2021-11-17 7:39:50]",
|
||||||
|
"2. MTU SG2000[2021-12-2 7:41:55]",
|
||||||
|
"3. JX493ZQ4[2022-1-8 11:22:42]",
|
||||||
|
"4. JX493ZQ5A[2022-2-15 1:26:38]",
|
||||||
|
"5. FOTON D01[2022-9-1 9:06:43]",
|
||||||
|
"6. PUMA2.0[2022-9-15 8:47:59]",
|
||||||
|
"7. PUMA2.2[2022-9-21 7:50:39]",
|
||||||
|
"8. SAIC D20[2022-10-10 8:27:46]",
|
||||||
|
"9. WEICHAI WP2H[2023-3-30 8:46:02]",
|
||||||
|
"10. JMC PUMA UPG 2.0[2023-7-10 17:07:07]",
|
||||||
|
"11. BFCEC ISF2.8L F2020 NS6[2023-7-10 17:21:50]",
|
||||||
|
"12. 12[2023-8-21 14:44:10]",
|
||||||
|
"13. GME T4[2023-10-2 8:55:38]",
|
||||||
|
"14. GW EN01[2023-10-4 8:12:50]",
|
||||||
|
"15. GAC P26 2.0PMI[2023-11-9 7:44:42]",
|
||||||
|
"16. NU PE2.0 TGDI[2024-5-2 11:07:36]",
|
||||||
|
"17. M254 E20[2024-7-2 10:08:06]",
|
||||||
|
"18. NU PE2.0MPI[2024-10-29 10:45:14]"
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
RecordListBox.Items.Add(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SearchButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
string searchText = SearchTextBox.Text.Trim();
|
||||||
|
if (string.IsNullOrEmpty(searchText))
|
||||||
|
{
|
||||||
|
LoadSampleData(); // 重新加载所有数据
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 过滤数据
|
||||||
|
RecordListBox.Items.Clear();
|
||||||
|
var allRecords = new List<string>
|
||||||
|
{
|
||||||
|
"1. GGG[2021-11-17 7:39:50]",
|
||||||
|
"2. MTU SG2000[2021-12-2 7:41:55]",
|
||||||
|
"3. JX493ZQ4[2022-1-8 11:22:42]",
|
||||||
|
"4. JX493ZQ5A[2022-2-15 1:26:38]",
|
||||||
|
"5. FOTON D01[2022-9-1 9:06:43]",
|
||||||
|
"6. PUMA2.0[2022-9-15 8:47:59]",
|
||||||
|
"7. PUMA2.2[2022-9-21 7:50:39]",
|
||||||
|
"8. SAIC D20[2022-10-10 8:27:46]",
|
||||||
|
"9. WEICHAI WP2H[2023-3-30 8:46:02]",
|
||||||
|
"10. JMC PUMA UPG 2.0[2023-7-10 17:07:07]",
|
||||||
|
"11. BFCEC ISF2.8L F2020 NS6[2023-7-10 17:21:50]",
|
||||||
|
"12. 12[2023-8-21 14:44:10]",
|
||||||
|
"13. GME T4[2023-10-2 8:55:38]",
|
||||||
|
"14. GW EN01[2023-10-4 8:12:50]",
|
||||||
|
"15. GAC P26 2.0PMI[2023-11-9 7:44:42]",
|
||||||
|
"16. NU PE2.0 TGDI[2024-5-2 11:07:36]",
|
||||||
|
"17. M254 E20[2024-7-2 10:08:06]",
|
||||||
|
"18. NU PE2.0MPI[2024-10-29 10:45:14]"
|
||||||
|
};
|
||||||
|
|
||||||
|
var filteredRecords = allRecords.Where(r => r.ToLower().Contains(searchText.ToLower())).ToList();
|
||||||
|
foreach (var record in filteredRecords)
|
||||||
|
{
|
||||||
|
RecordListBox.Items.Add(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeleteButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (RecordListBox.SelectedItem != null)
|
||||||
|
{
|
||||||
|
var result = MessageBox.Show("确定要删除选中的记录吗?", "确认删除",
|
||||||
|
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||||
|
|
||||||
|
if (result == MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
RecordListBox.Items.Remove(RecordListBox.SelectedItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先选择要删除的记录。", "提示",
|
||||||
|
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (RecordListBox.SelectedItem != null)
|
||||||
|
{
|
||||||
|
string selectedRecord = RecordListBox.SelectedItem.ToString();
|
||||||
|
MessageBox.Show($"已选择记录:{selectedRecord}", "选择确认",
|
||||||
|
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
|
||||||
|
// 这里可以添加实际的选择逻辑,比如返回到主界面或执行其他操作
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先选择一条记录。", "提示",
|
||||||
|
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// 关闭当前页面或返回上一页
|
||||||
|
if (NavigationService.CanGoBack)
|
||||||
|
{
|
||||||
|
NavigationService.GoBack();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果无法返回,可以关闭窗口或执行其他操作
|
||||||
|
Window.GetWindow(this)?.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
267
src/view/GaugePage.xaml
Normal file
|
|
@ -0,0 +1,267 @@
|
||||||
|
<Page x:Class="WpfApp.src.view.GaugePage"
|
||||||
|
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"
|
||||||
|
xmlns:local="clr-namespace:WpfApp.src.view"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="800" d:DesignWidth="1200"
|
||||||
|
Title="GaugePage">
|
||||||
|
|
||||||
|
<Grid Background="White" >
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="60"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 主要内容区域 -->
|
||||||
|
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" Margin="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 顶部信息输入区域 -->
|
||||||
|
<Border Grid.Row="0" Background="White" BorderBrush="#CCCCCC" Margin="5" Padding="15">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 一行四等分 -->
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 第一行 -->
|
||||||
|
<Grid Grid.Row="0" Grid.Column="0" Margin="5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="70"/>
|
||||||
|
<!-- 标题固定宽 -->
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<!-- 输入框自适应 -->
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="零件名称" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||||
|
<TextBox Grid.Column="1" Height="25" Background="#E6F3FF" VerticalAlignment="Center" Margin="0,0,25,0"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="0" Grid.Column="1" Margin="5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="70"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="量具编号" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||||
|
<TextBox Grid.Column="1" Height="25" Background="#E6F3FF" VerticalAlignment="Center" Margin="0,0,25,0"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="0" Grid.Column="2" Margin="5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="70"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="量具名称" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||||
|
<TextBox Grid.Column="1" Height="25" Background="#E6F3FF" VerticalAlignment="Center" Margin="0,0,25,0"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="0" Grid.Column="3" Margin="5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="70"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="量具地址" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||||
|
<TextBox Grid.Column="1" Height="25" Background="#E6F3FF" VerticalAlignment="Center" Margin="0,0,25,0"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 第二行 -->
|
||||||
|
<Grid Grid.Row="1" Grid.Column="0" Margin="5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="70"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="操作者A" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||||
|
<TextBox Grid.Column="1" Height="25" Background="#E6F3FF" VerticalAlignment="Center" Margin="0,0,25,0"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="1" Grid.Column="1" Margin="5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="70"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="操作者B" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||||
|
<TextBox Grid.Column="1" Height="25" Background="#E6F3FF" VerticalAlignment="Center" Margin="0,0,25,0"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="1" Grid.Column="2" Margin="5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="70"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="操作者C" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||||
|
<TextBox Grid.Column="1" Height="25" Background="#E6F3FF" VerticalAlignment="Center" Margin="0,0,25,0"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="1" Grid.Column="3" Margin="5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="100"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="过程总变差(6σ)" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||||
|
<TextBox Grid.Column="1" Height="25" Background="#E6F3FF" VerticalAlignment="Center" />
|
||||||
|
<TextBlock Grid.Column="2" Text="mm" VerticalAlignment="Center" Margin="5,0,0,0"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 传感器其它参数配置区域 -->
|
||||||
|
|
||||||
|
<GroupBox Header="其它参数" Margin="5" FontWeight="Bold" Grid.Row="1" Background="White">
|
||||||
|
<Grid>
|
||||||
|
<!-- 行定义:表头 + 三个传感器 -->
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 列定义:左侧传感器列 + 四等分输入框 -->
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="70"/>
|
||||||
|
<!-- 传感器列 -->
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<!-- 特性 -->
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<!-- 基本尺寸 -->
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<!-- 上偏差 -->
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<!-- 下偏差 -->
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 表头 -->
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="1" Text="特性" HorizontalAlignment="Center" FontWeight="Bold" Margin="5"/>
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="2" Text="基本尺寸" HorizontalAlignment="Center" FontWeight="Bold" Margin="5"/>
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="3" Text="上偏差" HorizontalAlignment="Center" FontWeight="Bold" Margin="5"/>
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="4" Text="下偏差" HorizontalAlignment="Center" FontWeight="Bold" Margin="5"/>
|
||||||
|
|
||||||
|
<!-- 传感器1 -->
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" Text="传感器1:" VerticalAlignment="Center" Margin="5" Width="70"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Height="25" Margin="5,5,25,5" Background="#E6F3FF" />
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="2" Height="25" Margin="5,5,25,5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="3" Height="25" Margin="5,5,25,5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="4" Height="25" Margin="5,5,25,5" Background="#E6F3FF"/>
|
||||||
|
|
||||||
|
<!-- 传感器2 -->
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="0" Text="传感器2:" VerticalAlignment="Center" Margin="5" Width="70"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" Height="25" Margin="5,5,25,5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="2" Height="25" Margin="5,5,25,5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="3" Height="25" Margin="5,5,25,5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="4" Height="25" Margin="5,5,25,5" Background="#E6F3FF"/>
|
||||||
|
|
||||||
|
<!-- 传感器3 -->
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="0" Text="传感器3:" VerticalAlignment="Center" Margin="5" Width="70"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Height="25" Margin="5,5,25,5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="2" Height="25" Margin="5,5,25,5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="3" Height="25" Margin="5,5,25,5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="4" Height="25" Margin="5,5,25,5" Background="#E6F3FF"/>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 传感器选择和操作者选择区域 -->
|
||||||
|
<Border Grid.Row="2" Background="White" BorderBrush="#CCCCCC" >
|
||||||
|
<Grid Margin="0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 传感器选择 -->
|
||||||
|
<GroupBox Header="传感器选择" Grid.Column="0" Margin="10,0,160,0" FontWeight="Bold">
|
||||||
|
<Grid Margin="0,5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<RadioButton Content="传感器1" IsChecked="True" GroupName="Sensor" Grid.Column="0" HorizontalAlignment="Center"/>
|
||||||
|
<RadioButton Content="传感器2" GroupName="Sensor" Grid.Column="1" HorizontalAlignment="Center"/>
|
||||||
|
<RadioButton Content="传感器3" GroupName="Sensor" Grid.Column="2" HorizontalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
|
||||||
|
<!-- 操作者选择 -->
|
||||||
|
<GroupBox Header="操作者选择" Grid.Column="1" Margin="160,0,10,0" FontWeight="Bold">
|
||||||
|
<Grid Margin="0,5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<RadioButton Content="A" IsChecked="True" GroupName="Operator" Grid.Column="0" HorizontalAlignment="Center"/>
|
||||||
|
<RadioButton Content="B" GroupName="Operator" Grid.Column="1" HorizontalAlignment="Center"/>
|
||||||
|
<RadioButton Content="C" GroupName="Operator" Grid.Column="2" HorizontalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 数据表格区域 -->
|
||||||
|
<Border Grid.Row="3" Background="White" BorderBrush="#CCCCCC" BorderThickness="1" Margin="5" Padding="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 数据表格 十等分 DataGrid -->
|
||||||
|
<DataGrid Grid.Row="1"
|
||||||
|
x:Name="DataInputGrid"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
CanUserAddRows="True"
|
||||||
|
CanUserDeleteRows="True"
|
||||||
|
GridLinesVisibility="All"
|
||||||
|
HeadersVisibility="All"
|
||||||
|
Background="White"
|
||||||
|
AlternatingRowBackground="#F8F8F8"
|
||||||
|
MinHeight="200">
|
||||||
|
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="1" Binding="{Binding Column1}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="2" Binding="{Binding Column2}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="3" Binding="{Binding Column3}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="4" Binding="{Binding Column4}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="5" Binding="{Binding Column5}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="6" Binding="{Binding Column6}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="7" Binding="{Binding Column7}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="8" Binding="{Binding Column8}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="9" Binding="{Binding Column9}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="10" Binding="{Binding Column10}" Width="*"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
<!-- 底部按钮区域 -->
|
||||||
|
<Border Grid.Row="1" Background="#E0E0E0" BorderBrush="#CCCCCC" BorderThickness="0,1,0,0">
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="20,0">
|
||||||
|
<Button Content="导出报表" Width="80" Height="35" Background="#90EE90" Margin="10,0"/>
|
||||||
|
<Button Content="参数设定" Width="80" Height="35" Background="#F0F0F0" Margin="10,0"/>
|
||||||
|
<Button Content="取消" Width="80" Height="35" Background="#F0F0F0" Margin="10,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
28
src/view/GaugePage.xaml.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace WpfApp.src.view
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// GaugePage.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class GaugePage : Page
|
||||||
|
{
|
||||||
|
public GaugePage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
259
src/view/StandardPage.xaml
Normal file
|
|
@ -0,0 +1,259 @@
|
||||||
|
<Page x:Class="WpfApp.src.view.StandardPage"
|
||||||
|
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"
|
||||||
|
xmlns:local="clr-namespace:WpfApp.src.components"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="600" d:DesignWidth="1000"
|
||||||
|
Title="StandardPage">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<!--<Grid>-->
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="60"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="80"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 标题区域 -->
|
||||||
|
<Border Grid.Row="0" Background="#4A90E2" Margin="10,10,10,0" CornerRadius="5">
|
||||||
|
<TextBlock Text="主标定" FontSize="24" FontWeight="Bold" Foreground="White"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 传感器区域 -->
|
||||||
|
<Grid Grid.Row="1" Margin="10">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 传感器1 -->
|
||||||
|
<Border Grid.Column="0" Background="#F8F6E7" Margin="5" CornerRadius="8" Padding="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 传感器标题 -->
|
||||||
|
<Border Grid.Row="0" Background="#4A90E2" CornerRadius="5">
|
||||||
|
<TextBlock Text="传感器1" FontSize="16" FontWeight="Bold" Foreground="White"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 输入值 -->
|
||||||
|
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="输入值" FontSize="12" Foreground="Black" Width="50" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="LightBlue" CornerRadius="3" Padding="5,2" MinWidth="80">
|
||||||
|
<TextBlock Text="72.936" FontSize="12" Foreground="Black" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 传感器值 -->
|
||||||
|
<StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="传感器值" FontSize="12" Foreground="Black" Width="50" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="LightBlue" CornerRadius="3" Padding="5,2" MinWidth="80">
|
||||||
|
<TextBlock Text="0.7205" FontSize="12" Foreground="Black" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 设定值 -->
|
||||||
|
<StackPanel Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="设定值" FontSize="12" Foreground="Black" Width="50" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="LightGreen" CornerRadius="3" Padding="5,2" MinWidth="80">
|
||||||
|
<TextBlock Text="0.7205" FontSize="12" Foreground="Black" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 柱状图区域 -->
|
||||||
|
<Border Grid.Row="4" Background="#F8F6E7" CornerRadius="5" Margin="0,10,0,0" Padding="5">
|
||||||
|
|
||||||
|
<!-- 传感器1 - 蓝色柱状图,类似图片中的样式 -->
|
||||||
|
<local:SensorChart Grid.Column="0"
|
||||||
|
x:Name="Sensor1"
|
||||||
|
SensorName="传感器1"
|
||||||
|
Value="-40"
|
||||||
|
Margin="5,5,5,-1"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 传感器2 -->
|
||||||
|
<Border Grid.Column="1" Background="#F8F6E7" Margin="5" CornerRadius="8" Padding="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 传感器标题 -->
|
||||||
|
<Border Grid.Row="0" Background="#4A90E2" CornerRadius="5">
|
||||||
|
<TextBlock Text="传感器2" FontSize="16" FontWeight="Bold" Foreground="White"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 输入值 -->
|
||||||
|
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="输入值" FontSize="12" Foreground="Black" Width="50" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="LightBlue" CornerRadius="3" Padding="5,2" MinWidth="80">
|
||||||
|
<TextBlock Text="0" FontSize="12" Foreground="Black" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 传感器值 -->
|
||||||
|
<StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="传感器值" FontSize="12" Foreground="Black" Width="50" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="LightBlue" CornerRadius="3" Padding="5,2" MinWidth="80">
|
||||||
|
<TextBlock Text="0.0000" FontSize="12" Foreground="Black" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 设定值 -->
|
||||||
|
<StackPanel Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="设定值" FontSize="12" Foreground="Black" Width="50" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="LightGreen" CornerRadius="3" Padding="5,2" MinWidth="80">
|
||||||
|
<TextBlock Text="0.0000" FontSize="12" Foreground="Black" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 柱状图区域 -->
|
||||||
|
<Border Grid.Row="4" Background="#F8F6E7" CornerRadius="5" Margin="0,10,0,0" Padding="5">
|
||||||
|
<!-- 传感器1 - 蓝色柱状图,类似图片中的样式 -->
|
||||||
|
<local:SensorChart Grid.Column="0"
|
||||||
|
x:Name="Sensor2"
|
||||||
|
SensorName="传感器2"
|
||||||
|
Value="-40"
|
||||||
|
Margin="5,5,5,-1"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 传感器3 -->
|
||||||
|
<Border Grid.Column="2" Background="#F8F6E7" Margin="5" CornerRadius="8" Padding="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 传感器标题 -->
|
||||||
|
<Border Grid.Row="0" Background="#4A90E2" CornerRadius="5">
|
||||||
|
<TextBlock Text="传感器3" FontSize="16" FontWeight="Bold" Foreground="White"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 输入值 -->
|
||||||
|
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="输入值" FontSize="12" Foreground="Black" Width="50" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="LightBlue" CornerRadius="3" Padding="5,2" MinWidth="80">
|
||||||
|
<TextBlock Text="72.168" FontSize="12" Foreground="Black" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 传感器值 -->
|
||||||
|
<StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="传感器值" FontSize="12" Foreground="Black" Width="50" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="LightBlue" CornerRadius="3" Padding="5,2" MinWidth="80">
|
||||||
|
<TextBlock Text="0.7352" FontSize="12" Foreground="Black" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 设定值 -->
|
||||||
|
<StackPanel Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="设定值" FontSize="12" Foreground="Black" Width="50" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="LightGreen" CornerRadius="3" Padding="5,2" MinWidth="80">
|
||||||
|
<TextBlock Text="0.7352" FontSize="12" Foreground="Black" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 柱状图区域 -->
|
||||||
|
<Border Grid.Row="4" Background="#F8F6E7" CornerRadius="5" Margin="0,10,0,0" Padding="5">
|
||||||
|
<!-- 传感器1 - 蓝色柱状图,类似图片中的样式 -->
|
||||||
|
<local:SensorChart Grid.Column="0"
|
||||||
|
x:Name="Sensor3"
|
||||||
|
SensorName="传感器3"
|
||||||
|
Value="-40"
|
||||||
|
Margin="5,5,5,-1"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 传感器4 -->
|
||||||
|
<Border Grid.Column="3" Background="#F8F6E7" Margin="5" CornerRadius="8" Padding="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 传感器标题 -->
|
||||||
|
<Border Grid.Row="0" Background="#4A90E2" CornerRadius="5">
|
||||||
|
<TextBlock Text="传感器4" FontSize="16" FontWeight="Bold" Foreground="White"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 输入值 -->
|
||||||
|
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="输入值" FontSize="12" Foreground="Black" Width="50" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="LightBlue" CornerRadius="3" Padding="5,2" MinWidth="80">
|
||||||
|
<TextBlock Text="0" FontSize="12" Foreground="Black" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 传感器值 -->
|
||||||
|
<StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="传感器值" FontSize="12" Foreground="Black" Width="50" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="LightBlue" CornerRadius="3" Padding="5,2" MinWidth="80">
|
||||||
|
<TextBlock Text="0.0000" FontSize="12" Foreground="Black" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 设定值 -->
|
||||||
|
<StackPanel Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="设定值" FontSize="12" Foreground="Black" Width="50" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="LightGreen" CornerRadius="3" Padding="5,2" MinWidth="80">
|
||||||
|
<TextBlock Text="0.0000" FontSize="12" Foreground="Black" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 柱状图区域 -->
|
||||||
|
<Border Grid.Row="4" Background="#F8F6E7" CornerRadius="5" Margin="0,10,0,0" Padding="5">
|
||||||
|
<!-- 传感器1 - 蓝色柱状图,类似图片中的样式 -->
|
||||||
|
<local:SensorChart Grid.Column="0"
|
||||||
|
x:Name="Sensor4"
|
||||||
|
SensorName="传感器4"
|
||||||
|
Value="-40"
|
||||||
|
Margin="5,5,5,-1"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 底部按钮区域 -->
|
||||||
|
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Center" Margin="0,0,20,0">
|
||||||
|
<Button Content="开始标定" Width="100" Height="40" Margin="10,0"
|
||||||
|
Background="#4A90E2" Foreground="White" FontSize="14" FontWeight="Bold"
|
||||||
|
BorderBrush="Transparent"/>
|
||||||
|
<Button Content="关闭" Width="80" Height="40" Margin="10,0"
|
||||||
|
Background="#4A90E2" Foreground="White" FontSize="14" FontWeight="Bold"
|
||||||
|
BorderBrush="Transparent"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
28
src/view/StandardPage.xaml.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace WpfApp.src.view
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// StandardPage.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class StandardPage : Page
|
||||||
|
{
|
||||||
|
public StandardPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
283
src/view/SysSetPage.xaml
Normal file
|
|
@ -0,0 +1,283 @@
|
||||||
|
<Page x:Class="WpfApp.src.view.SysSetPage"
|
||||||
|
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"
|
||||||
|
xmlns:local="clr-namespace:WpfApp.src.view"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
Title="SysSetPage">
|
||||||
|
|
||||||
|
<Grid Background="#F0F0F0">
|
||||||
|
<!-- 标题栏 -->
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 标题 -->
|
||||||
|
<Border Grid.Row="0" Background="#4472C4" CornerRadius="5,5,0,0">
|
||||||
|
<TextBlock Text="系统设置(传感器设置)"
|
||||||
|
Foreground="White"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Bold"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Margin="10,0"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- TabControl -->
|
||||||
|
<TabControl Grid.Row="1" Background="White" BorderThickness="1" BorderBrush="#CCCCCC">
|
||||||
|
<!-- 设置页面 -->
|
||||||
|
<TabItem Header="设置" FontSize="12">
|
||||||
|
<Grid Background="White" Margin="10">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 通道选择 -->
|
||||||
|
<GroupBox Header="通道选择" FontWeight="Bold">
|
||||||
|
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,10">
|
||||||
|
<TextBlock Text="通道:" VerticalAlignment="Center" Margin="0,0,10,0" FontSize="12"/>
|
||||||
|
<ComboBox Name="ChannelComboBox"
|
||||||
|
Width="300"
|
||||||
|
Height="25"
|
||||||
|
FontSize="12"
|
||||||
|
SelectedIndex="0">
|
||||||
|
<ComboBoxItem Content="OrbitPCICard1,Channel1 ,Type:3"/>
|
||||||
|
<ComboBoxItem Content="OrbitPCICard1,Channel2 ,Type:3"/>
|
||||||
|
<ComboBoxItem Content="OrbitPCICard1,Channel3 ,Type:3"/>
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox>
|
||||||
|
|
||||||
|
<!-- 传感器配置区域 -->
|
||||||
|
<Border Grid.Row="2" Background="White" BorderBrush="#CCCCCC" BorderThickness="1" Margin="5" Padding="15">
|
||||||
|
<GroupBox Header="传感器配置" FontWeight="Bold" FontSize="13">
|
||||||
|
<Grid Margin="10">
|
||||||
|
<!-- 行定义 -->
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- 列定义:左列为传感器名 + 三等分输入列 -->
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="69"/>
|
||||||
|
<!-- 左列传感器 -->
|
||||||
|
<ColumnDefinition Width="2*"/>
|
||||||
|
<!-- ID -->
|
||||||
|
<ColumnDefinition Width="1*"/>
|
||||||
|
<!-- 冲程 -->
|
||||||
|
<ColumnDefinition Width="4*"/>
|
||||||
|
<!-- 名称 -->
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 第一组标题 -->
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="1" Text="ID" HorizontalAlignment="Center" FontWeight="Bold" Margin="5"/>
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="2" Text="冲程" HorizontalAlignment="Center" FontWeight="Bold" Margin="5"/>
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="3" Text="名称" HorizontalAlignment="Center" FontWeight="Bold" Margin="5"/>
|
||||||
|
|
||||||
|
<!-- 第一组输入 -->
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" Text="传感器1:" VerticalAlignment="Center" Margin="5,0"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Height="25" Margin="5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="2" Height="25" Margin="5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="3" Height="25" Margin="5" Background="#E6F3FF"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="0" Text="传感器2:" VerticalAlignment="Center" Margin="5,0"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" Height="25" Margin="5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="2" Height="25" Margin="5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="3" Height="25" Margin="5" Background="#E6F3FF"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="0" Text="传感器3:" VerticalAlignment="Center" Margin="5,0"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Height="25" Margin="5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="2" Height="25" Margin="5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="3" Height="25" Margin="5" Background="#E6F3FF"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="4" Grid.Column="0" Text="传感器4:" VerticalAlignment="Center" Margin="5,0"/>
|
||||||
|
<TextBox Grid.Row="4" Grid.Column="1" Height="25" Margin="5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="4" Grid.Column="2" Height="25" Margin="5" Background="#E6F3FF"/>
|
||||||
|
<TextBox Grid.Row="4" Grid.Column="3" Height="25" Margin="5" Background="#E6F3FF"/>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 按钮区域 -->
|
||||||
|
<Grid Grid.Row="3" Margin="0,10,0,0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<!-- 左侧按钮 -->
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<!-- 右侧按钮 -->
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 左侧:第一个按钮左对齐 -->
|
||||||
|
<Button Name="SelectSensorButton"
|
||||||
|
Content="读取传感器"
|
||||||
|
Width="80" Height="25"
|
||||||
|
FontSize="12"
|
||||||
|
Margin="0,0,10,0"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Click="SelectSensorButton_Click"/>
|
||||||
|
|
||||||
|
<!-- 右侧:其余按钮右对齐 -->
|
||||||
|
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Button Name="SaveButton" Content="保存" Width="60" Height="25" Margin="0,0,10,0" FontSize="12" Click="SaveButton_Click"/>
|
||||||
|
<Button Name="CancelButton" Content="取消" Width="60" Height="25" Margin="0,0,10,0" FontSize="12" Click="CancelButton_Click"/>
|
||||||
|
<Button Name="ConfirmButton" Content="确定" Width="60" Height="25" FontSize="12" Click="ConfirmButton_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
<!-- 测试页面 -->
|
||||||
|
<TabItem Header="测试" FontSize="12" Height="19" VerticalAlignment="Top">
|
||||||
|
<Grid Background="White" Margin="10">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 传感器设置表格 -->
|
||||||
|
<GroupBox Header="传感器配置" FontWeight="Bold" FontSize="13">
|
||||||
|
<Grid Margin="10">
|
||||||
|
<!-- 行定义 -->
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- 列定义(12等分逻辑) -->
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="0"/>
|
||||||
|
<!-- 预留空列 -->
|
||||||
|
<ColumnDefinition Width="3*"/>
|
||||||
|
<!-- 名字:ID -->
|
||||||
|
<ColumnDefinition Width="3*"/>
|
||||||
|
<!-- 刻度值 -->
|
||||||
|
<ColumnDefinition Width="6*"/>
|
||||||
|
<!-- 实际值 -->
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 第一组标题 -->
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="1" Text="名称:ID" HorizontalAlignment="Center" FontWeight="Bold" Margin="5"/>
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="2" Text="刻度值" HorizontalAlignment="Center" FontWeight="Bold" Margin="5"/>
|
||||||
|
<!--<TextBlock Grid.Row="0" Grid.Column="3" Text="实际值" HorizontalAlignment="Center" FontWeight="Bold" Margin="5"/>-->
|
||||||
|
<!-- 刻度尺标题区域 -->
|
||||||
|
<Canvas Grid.Row="0" Grid.Column="3" Height="40" Width="360" Background="White">
|
||||||
|
<!-- 刻度尺顶线 -->
|
||||||
|
<Line X1="0" Y1="10" X2="360" Y2="10" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
|
||||||
|
<!-- 刻度线(大刻度每40像素一个,小刻度每10像素一个) -->
|
||||||
|
<Line X1="0" Y1="10" X2="0" Y2="25" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
|
||||||
|
<!-- 小刻度 -->
|
||||||
|
<Line X1="10" Y1="10" X2="10" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="20" Y1="10" X2="20" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="30" Y1="10" X2="30" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<!-- 大刻度 -->
|
||||||
|
<Line X1="40" Y1="10" X2="40" Y2="25" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<!-- 重复下一个区间 -->
|
||||||
|
<Line X1="50" Y1="10" X2="50" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="60" Y1="10" X2="60" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="70" Y1="10" X2="70" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="80" Y1="10" X2="80" Y2="25" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
|
||||||
|
<Line X1="90" Y1="10" X2="90" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="100" Y1="10" X2="100" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="110" Y1="10" X2="110" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="120" Y1="10" X2="120" Y2="25" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
|
||||||
|
<Line X1="130" Y1="10" X2="130" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="140" Y1="10" X2="140" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="150" Y1="10" X2="150" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="160" Y1="10" X2="160" Y2="25" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
|
||||||
|
<Line X1="170" Y1="10" X2="170" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="180" Y1="10" X2="180" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="190" Y1="10" X2="190" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="200" Y1="10" X2="200" Y2="25" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
|
||||||
|
<Line X1="210" Y1="10" X2="210" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="220" Y1="10" X2="220" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="230" Y1="10" X2="230" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="240" Y1="10" X2="240" Y2="25" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
|
||||||
|
<Line X1="250" Y1="10" X2="250" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="260" Y1="10" X2="260" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="270" Y1="10" X2="270" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="280" Y1="10" X2="280" Y2="25" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
|
||||||
|
<Line X1="290" Y1="10" X2="290" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="300" Y1="10" X2="300" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="310" Y1="10" X2="310" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="320" Y1="10" X2="320" Y2="25" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
|
||||||
|
<Line X1="330" Y1="10" X2="330" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="340" Y1="10" X2="340" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="350" Y1="10" X2="350" Y2="20" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="360" Y1="10" X2="360" Y2="25" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<!-- 可以继续按规律扩展到整条刻度尺 -->
|
||||||
|
|
||||||
|
<Line X1="360" Y1="10" X2="360" Y2="25" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
|
||||||
|
|
||||||
|
</Canvas>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 第一组输入 -->
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="1" Height="25" Margin="5" Text="A1:130PC32609"
|
||||||
|
TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="2" Height="25" Margin="5" Background="#E6F3FF" Text="0.73211"/>
|
||||||
|
<ProgressBar Grid.Row="1" Grid.Column="3" Height="20" Margin="5"
|
||||||
|
Minimum="0" Maximum="1" Value="0.73" Foreground="#2196F3"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="1" Height="25" Margin="5" Text="A2:130PC32610"
|
||||||
|
TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="2" Height="25" Margin="5" Background="#E6F3FF" Text="0.70211"/>
|
||||||
|
<ProgressBar Grid.Row="2" Grid.Column="3" Height="20" Margin="5"
|
||||||
|
Minimum="0" Maximum="1" Value="0.70211" Foreground="#2196F3"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="1" Height="25" Margin="5" Text="A3:130PC32611"
|
||||||
|
TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="2" Height="25" Margin="5" Background="#E6F3FF" Text="0.00000"/>
|
||||||
|
<ProgressBar Grid.Row="3" Grid.Column="3" Height="20" Margin="5"
|
||||||
|
Minimum="0" Maximum="1" Value="0.00000" Foreground="#2196F3"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="4" Grid.Column="1" Height="25" Margin="5" Text=""
|
||||||
|
TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="4" Grid.Column="2" Height="25" Margin="5" Background="#E6F3FF" Text="0.00000"/>
|
||||||
|
<ProgressBar Grid.Row="4" Grid.Column="3" Height="20" Margin="5"
|
||||||
|
Minimum="0" Maximum="1" Value="0.00000" Foreground="#2196F3"/>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
|
||||||
|
</TabControl>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
102
src/view/SysSetPage.xaml.cs
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace WpfApp.src.view
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// SysSetPage.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class SysSetPage : Page
|
||||||
|
{
|
||||||
|
public ObservableCollection<SensorSettingItem> SensorSettings { get; set; }
|
||||||
|
public ObservableCollection<SensorConfigItem> SensorConfigs { get; set; }
|
||||||
|
|
||||||
|
public SysSetPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
InitializeData();
|
||||||
|
DataContext = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeData()
|
||||||
|
{
|
||||||
|
// 初始化传感器设置数据
|
||||||
|
SensorSettings = new ObservableCollection<SensorSettingItem>
|
||||||
|
{
|
||||||
|
new SensorSettingItem { Name = "A1:130BC32P09", ScaleValue = "0.71777", Progress = 0.71777 },
|
||||||
|
new SensorSettingItem { Name = "A2:130BC32P10", ScaleValue = "0.00000", Progress = 0.0 },
|
||||||
|
new SensorSettingItem { Name = "A3:130BC32P08", ScaleValue = "0.73578", Progress = 0.73578 },
|
||||||
|
new SensorSettingItem { Name = "", ScaleValue = "0.00000", Progress = 0.0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
// 初始化传感器配置数据
|
||||||
|
SensorConfigs = new ObservableCollection<SensorConfigItem>
|
||||||
|
{
|
||||||
|
new SensorConfigItem { Sensor1Id = "130BC32P09", Id = "5", Range = "5", Name = "A1" },
|
||||||
|
new SensorConfigItem { Sensor1Id = "130BC32P10", Id = "5", Range = "5", Name = "A2" },
|
||||||
|
new SensorConfigItem { Sensor1Id = "130BC32P08", Id = "6", Range = "6", Name = "A3" },
|
||||||
|
new SensorConfigItem { Sensor1Id = "", Id = "", Range = "", Name = "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
// 绑定数据到DataGrid
|
||||||
|
//SensorSettingsGrid.ItemsSource = SensorSettings;
|
||||||
|
//SensorConfigGrid.ItemsSource = SensorConfigs;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectSensorButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// 选择传感器按钮点击事件
|
||||||
|
MessageBox.Show("选择传感器功能待实现");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// 保存按钮点击事件
|
||||||
|
MessageBox.Show("保存成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CancelButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// 取消按钮点击事件
|
||||||
|
MessageBox.Show("已取消");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfirmButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// 确定按钮点击事件
|
||||||
|
MessageBox.Show("确定");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 传感器设置数据模型
|
||||||
|
public class SensorSettingItem
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string ScaleValue { get; set; }
|
||||||
|
public double Progress { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 传感器配置数据模型
|
||||||
|
public class SensorConfigItem
|
||||||
|
{
|
||||||
|
public string Sensor1Id { get; set; }
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Range { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||