This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user