Measurements of units were added

This commit is contained in:
Evgeny Redikultsev
2022-11-26 17:33:21 +05:00
parent f849ee024a
commit c5e503252e
25 changed files with 293 additions and 61 deletions

View File

@@ -14,6 +14,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
public override string unitName { get => "Force"; }
public override string MeasureUnit => throw new NotImplementedException();
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
@@ -26,12 +28,15 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
if (value != null)
try
{
var strVal = value as string;
double.TryParse(strVal, out val);
val = CommonOperation.ConvertToDoubleChangeComma(strVal);
}
catch
{
return null;
}
else { throw new Exception($"{unitName} value is null"); }
val /= coeffficient;
return val;
}