更新UI
This commit is contained in:
44
COFTester/Models/ReciprocatingFrictionRecord.cs
Normal file
44
COFTester/Models/ReciprocatingFrictionRecord.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace COFTester.Models;
|
||||
|
||||
public sealed class ReciprocatingFrictionRecord
|
||||
{
|
||||
public int Index { get; init; }
|
||||
|
||||
public double? StaticCoefficient { get; init; }
|
||||
|
||||
public double? KineticCoefficient { get; init; }
|
||||
|
||||
public double? StaticForceN { get; init; }
|
||||
|
||||
public double? KineticForceN { get; init; }
|
||||
|
||||
public bool HasData => StaticCoefficient.HasValue ||
|
||||
KineticCoefficient.HasValue ||
|
||||
StaticForceN.HasValue ||
|
||||
KineticForceN.HasValue;
|
||||
|
||||
public string StaticCoefficientLabel => FormatValue(StaticCoefficient, "F3");
|
||||
|
||||
public string KineticCoefficientLabel => FormatValue(KineticCoefficient, "F3");
|
||||
|
||||
public string StaticForceLabel => FormatValue(StaticForceN, "F3");
|
||||
|
||||
public string KineticForceLabel => FormatValue(KineticForceN, "F3");
|
||||
|
||||
public static ReciprocatingFrictionRecord Empty(int index)
|
||||
{
|
||||
return new ReciprocatingFrictionRecord
|
||||
{
|
||||
Index = index
|
||||
};
|
||||
}
|
||||
|
||||
private static string FormatValue(double? value, string format)
|
||||
{
|
||||
return value is { } number && double.IsFinite(number)
|
||||
? number.ToString(format, CultureInfo.InvariantCulture)
|
||||
: "--";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user