This commit is contained in:
xyy
2026-04-12 20:22:21 +08:00
parent e774c2374c
commit 690a7b587a
4 changed files with 47 additions and 6 deletions

View File

@@ -42,7 +42,7 @@ namespace MembranePoreTester.ViewModels
});
}
public List<TestLiquid> Liquids => TestLiquid.Predefined;
public IReadOnlyList<TestLiquid> Liquids => TestLiquid.Predefined;
public List<string> PressureUnits => new() { "Pa", "cmHg", "psi" };
public List<string> MembraneTypes => new() { "平板膜", "中空纤维膜" };

View File

@@ -243,11 +243,22 @@ namespace MembranePoreTester.ViewModels
{
// 当 Record 替换时(例如从数据库加载),重新订阅其 DataPoints 集合
HookDataPointsCollection(_record?.DataPoints);
// 同步液体选择
if (_record?.Liquid != null)
{
var matchedLiquid = Liquids.FirstOrDefault(l => l.Name == _record.Liquid.Name);
SelectedLiquid = matchedLiquid ?? _record.Liquid;
}
else
{
SelectedLiquid = Liquids.FirstOrDefault();
}
}
}
}
public List<TestLiquid> Liquids => TestLiquid.Predefined;
public IReadOnlyList<TestLiquid> Liquids => TestLiquid.Predefined;
public List<string> PressureUnits => new() { "Pa", "cmHg", "psi" };
public List<string> MembraneTypes => new() { "平板膜", "中空纤维膜" };
@@ -944,6 +955,20 @@ namespace MembranePoreTester.ViewModels
});
}
// 同步液体选择
if (Record.Liquid != null)
{
var matchedLiquid = Liquids.FirstOrDefault(l => l.Name == Record.Liquid.Name);
SelectedLiquid = matchedLiquid ?? Record.Liquid;
}
else
{
SelectedLiquid = Liquids.FirstOrDefault();
}
// 重新计算平均孔径和分布(触发计算命令)
Calculate();
}