Force combination was added
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
@@ -11,33 +13,8 @@ namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||
{
|
||||
internal class Area : UnitBase
|
||||
{
|
||||
public override UnitTypes unitType { get => UnitTypes.Area; }
|
||||
public override IUnit currentUnit { get => CommonOperation.GetUnit(unitType, "mm2"); }
|
||||
public override string unitName { get => "Area"; }
|
||||
|
||||
public override string MeasureUnit => throw new NotImplementedException();
|
||||
|
||||
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
double val;
|
||||
if (value != null) { val = (double)value; }
|
||||
else { throw new Exception($"{unitName} value is null"); }
|
||||
val *= UnitConstatnts.Length * UnitConstatnts.Length;
|
||||
return val;
|
||||
}
|
||||
|
||||
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
double val;
|
||||
try
|
||||
{
|
||||
var strVal = value as string;
|
||||
val = CommonOperation.ConvertToDoubleChangeComma(strVal);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
val /= (UnitConstatnts.Length * UnitConstatnts.Length);
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user