更新数据接口

This commit is contained in:
GukSang.Jin
2026-06-02 18:14:01 +08:00
parent 27439505a9
commit fee2310977
11 changed files with 1401 additions and 205 deletions

View File

@@ -1,6 +1,7 @@
<suki:SukiWindow xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.ViewModels"
xmlns:model="using:Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.Models"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
xmlns:suki="using:SukiUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -197,13 +198,13 @@
<TextBox Grid.Column="3" Text="{Binding OperatorName}" Watermark="请输入"/>
<TextBlock Grid.Row="1" Text="鞋码区间" VerticalAlignment="Center" Foreground="{StaticResource TextSecondaryBrush}"/>
<ComboBox Grid.Row="1" Grid.Column="1" SelectedIndex="0">
<ComboBox Grid.Row="1" Grid.Column="1" SelectedIndex="{Binding SelectedShoeSizeIndex}">
<ComboBoxItem Content="250(含)以上 - 400N"/>
<ComboBoxItem Content="205-250 - 350N"/>
<ComboBoxItem Content="205以下 - 160N"/>
</ComboBox>
<TextBlock Grid.Row="1" Grid.Column="2" Text="润滑介质" VerticalAlignment="Center" Foreground="{StaticResource TextSecondaryBrush}"/>
<ComboBox Grid.Row="1" Grid.Column="3" SelectedIndex="0">
<ComboBox Grid.Row="1" Grid.Column="3" SelectedIndex="{Binding SelectedLubricantIndex}">
<ComboBoxItem Content="干态"/>
<ComboBoxItem Content="湿态 - 蒸馏水"/>
<ComboBoxItem Content="湿态 - 洗涤剂"/>
@@ -211,7 +212,7 @@
</ComboBox>
<TextBlock Grid.Row="2" Text="测试模式" VerticalAlignment="Center" Foreground="{StaticResource TextSecondaryBrush}"/>
<ComboBox Grid.Row="2" Grid.Column="1" SelectedIndex="2">
<ComboBox Grid.Row="2" Grid.Column="1" SelectedIndex="{Binding SelectedModeIndex}">
<ComboBoxItem Content="后跟测试模式"/>
<ComboBoxItem Content="前掌测试模式"/>
<ComboBoxItem Content="水平测试模式"/>
@@ -222,11 +223,11 @@
<Grid Grid.Column="1" RowDefinitions="Auto,Auto,Auto" ColumnDefinitions="Auto,*" RowSpacing="10" ColumnSpacing="10">
<TextBlock Text="报告名称" VerticalAlignment="Center" Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBox Grid.Column="1" Text="{Binding ReportName}" Watermark="例: 白羊座防滑性能报告"/>
<TextBox Grid.Column="1" Text="{Binding ReportName}" Watermark="例: 防滑性能报告"/>
<TextBlock Grid.Row="1" Text="样品特征" VerticalAlignment="Center" Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SampleFeature}" Watermark="鞋底材料、花纹、尺码"/>
<TextBlock Grid.Row="2" Text="地面材质" VerticalAlignment="Center" Foreground="{StaticResource TextSecondaryBrush}"/>
<ComboBox Grid.Row="2" Grid.Column="1" SelectedIndex="0">
<ComboBox Grid.Row="2" Grid.Column="1" SelectedIndex="{Binding SelectedSurfaceIndex}">
<ComboBoxItem Content="瓷砖"/>
<ComboBoxItem Content="木地板"/>
<ComboBoxItem Content="石材"/>
@@ -280,7 +281,7 @@
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto">
<ItemsControl ItemsSource="{Binding Samples}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:TestSample">
<DataTemplate x:DataType="model:TestSample">
<Border BorderBrush="{StaticResource LineBrush}" BorderThickness="0,0,0,1" Padding="0,6">
<Grid ColumnDefinitions="50,98,72,72">
<TextBlock Text="{Binding Index}" HorizontalAlignment="Center" FontSize="15" Foreground="#334155"/>
@@ -327,7 +328,7 @@
<Button Content="复位" Classes="action" Command="{Binding ClearCommand}"/>
<Button Grid.Column="1" Content="测试" Classes="success action" Command="{Binding StartTestCommand}"/>
<Button Grid.Row="1" Content="停止" Classes="danger action" Command="{Binding StopTestCommand}"/>
<Button Grid.Row="1" Grid.Column="1" Content="生成报告" Classes="primary action" Command="{Binding ExportReportCommand}"/>
<Button Grid.Row="1" Grid.Column="1" Content="导出Excel" Classes="primary action" Command="{Binding ExportReportCommand}"/>
</Grid>
<StackPanel Grid.Row="2" Spacing="8">
@@ -346,6 +347,34 @@
</Grid>
</StackPanel>
<ScrollViewer Grid.Row="4"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled"
ClipToBounds="True">
<StackPanel Spacing="8">
<TextBlock Text="标准数据" FontWeight="SemiBold"/>
<Border Classes="metric">
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto" ColumnDefinitions="*,Auto" RowSpacing="7">
<TextBlock Text="设备状态" Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBlock Grid.Column="1" Text="{Binding DeviceStatus}" FontWeight="SemiBold"/>
<TextBlock Grid.Row="1" Text="正压力(N)" Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding VerticalPressure}" FontWeight="SemiBold"/>
<TextBlock Grid.Row="2" Text="摩擦力(N)" Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding HorizontalForce}" FontWeight="SemiBold"/>
<TextBlock Grid.Row="3" Text="位移(mm)" Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Distance}" FontWeight="SemiBold"/>
<TextBlock Grid.Row="4" Text="实时系数" Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding FrictionCoefficient}" FontWeight="SemiBold"/>
<TextBlock Grid.Row="5" Text="静摩擦系数" Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding StaticCoefficient}" FontWeight="SemiBold" Foreground="#5B21B6"/>
<TextBlock Grid.Row="6" Text="动摩擦系数" Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding DynamicCoefficient}" FontWeight="SemiBold" Foreground="#047857"/>
</Grid>
</Border>
<TextBlock Text="{Binding ResultSummary}" TextWrapping="Wrap" Classes="caption"/>
</StackPanel>
</ScrollViewer>
</Grid>
</Border>
</Grid>
@@ -353,7 +382,7 @@
<Grid IsVisible="{Binding IsSettingsDialogOpen}"
Background="#800F172A">
<Border Width="680"
<Border Width="760"
Background="{StaticResource PanelBrush}"
BorderBrush="{StaticResource LineBrush}"
BorderThickness="1"
@@ -374,7 +403,7 @@
</Grid>
<Grid Grid.Row="1"
RowDefinitions="Auto,Auto,Auto,8,Auto,Auto"
RowDefinitions="Auto,Auto,Auto,Auto,Auto,8,Auto,Auto,Auto"
ColumnDefinitions="Auto,150,Auto,24,Auto,150"
RowSpacing="10"
ColumnSpacing="12">
@@ -390,16 +419,34 @@
<TextBox Grid.Row="2" Grid.Column="1" Classes="setting-value" Text="{Binding TestSpeed, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Grid.Row="2" Grid.Column="2" Text="m/s" Classes="setting-unit" VerticalAlignment="Center"/>
<Border Grid.Row="3" Grid.ColumnSpan="6" Height="1" Background="{StaticResource LineBrush}" Margin="0,4"/>
<Label Grid.Row="3" Content="PLC串口" Classes="setting-label" VerticalAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="1" Classes="setting-value" Text="{Binding PlcPortName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Row="4" Content="正压力系数" Classes="setting-label" VerticalAlignment="Center"/>
<TextBox Grid.Row="4" Grid.Column="1" Classes="setting-value" Text="{Binding NormalPressureCoefficient, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Row="3" Grid.Column="4" Content="ADC串口" Classes="setting-label" VerticalAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="5" Classes="setting-value" Text="{Binding AdcPortName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Row="5" Content="摩擦1系数" Classes="setting-label" VerticalAlignment="Center"/>
<TextBox Grid.Row="5" Grid.Column="1" Classes="setting-value" Text="{Binding FrictionCoefficient1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Row="4" Content="波特率" Classes="setting-label" VerticalAlignment="Center"/>
<TextBox Grid.Row="4" Grid.Column="1" Classes="setting-value" Text="{Binding BaudRate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Row="5" Grid.Column="4" Content="摩擦2系数" Classes="setting-label" VerticalAlignment="Center"/>
<TextBox Grid.Row="5" Grid.Column="5" Classes="setting-value" Text="{Binding FrictionCoefficient2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Border Grid.Row="5" Grid.ColumnSpan="6" Height="1" Background="{StaticResource LineBrush}" Margin="0,4"/>
<Label Grid.Row="6" Content="正压力零点" Classes="setting-label" VerticalAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="1" Classes="setting-value" Text="{Binding NormalPressureZero, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Row="6" Grid.Column="4" Content="正压力系数" Classes="setting-label" VerticalAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="5" Classes="setting-value" Text="{Binding NormalPressureCoefficient, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Row="7" Content="摩擦1零点" Classes="setting-label" VerticalAlignment="Center"/>
<TextBox Grid.Row="7" Grid.Column="1" Classes="setting-value" Text="{Binding FrictionZero1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Row="7" Grid.Column="4" Content="摩擦1系数" Classes="setting-label" VerticalAlignment="Center"/>
<TextBox Grid.Row="7" Grid.Column="5" Classes="setting-value" Text="{Binding FrictionCoefficient1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Row="8" Content="摩擦2零点" Classes="setting-label" VerticalAlignment="Center"/>
<TextBox Grid.Row="8" Grid.Column="1" Classes="setting-value" Text="{Binding FrictionZero2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Row="8" Grid.Column="4" Content="摩擦2系数" Classes="setting-label" VerticalAlignment="Center"/>
<TextBox Grid.Row="8" Grid.Column="5" Classes="setting-value" Text="{Binding FrictionCoefficient2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
<Grid Grid.Row="2"

View File

@@ -1,4 +1,6 @@
using SukiUI.Controls;
using System;
using Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.ViewModels;
namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.Views
{
@@ -7,6 +9,15 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.Views
public MainWindow()
{
InitializeComponent();
Closed += OnClosed;
}
private void OnClosed(object? sender, EventArgs e)
{
if (DataContext is MainWindowViewModel viewModel)
{
viewModel.Dispose();
}
}
}
}