This commit is contained in:
xyy
2026-06-16 21:18:46 +08:00
parent 8c0af19f02
commit 4489514b5d
7 changed files with 163 additions and 47 deletions

View File

@@ -1,20 +1,38 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace AciTester.Models;
public partial class StageData : ObservableObject
namespace AciTester.Models
{
[ObservableProperty]
private string stageName = string.Empty;
public partial class StageData : ObservableObject
{
[ObservableProperty]
private string stageName;
[ObservableProperty]
private double cutoffDiameter; // 截止直径 (μm)
[ObservableProperty]
private double cutoffDiameter;
[ObservableProperty]
private double initialWeight; // 测前质量 (g)
private double _initialWeight;
public double InitialWeight
{
get => _initialWeight;
set
{
if (SetProperty(ref _initialWeight, value))
OnPropertyChanged(nameof(NetWeight)); // 关键:通知净重变化
}
}
[ObservableProperty]
private double finalWeight; // 测后质量 (g)
private double _finalWeight;
public double FinalWeight
{
get => _finalWeight;
set
{
if (SetProperty(ref _finalWeight, value))
OnPropertyChanged(nameof(NetWeight)); // 关键:通知净重变化
}
}
public double NetWeight => finalWeight - initialWeight;
// 计算属性,不存储
public double NetWeight => FinalWeight - InitialWeight;
}
}