public static double ConvertBack(string str) { //double tmp = double.TryParse(str); double.TryParse(str, out double tmp); SpeedUnit speedUnit = SpeedUnit.FromMillimeterPerSecond(tmp); var unitType = UnitObserverFacade.Instance.SpeedUnitObserver.UnitType; switch (unitType) { case UnitSpeedTypes.Millimeter_Second: speedUnit = SpeedUnit.FromMillimeterPerSecond(tmp); break; case UnitSpeedTypes.Meter_Second: speedUnit = SpeedUnit.FromMeterPerSecond(tmp); break; case UnitSpeedTypes.Meter_Minute: speedUnit = SpeedUnit.FromMeterPerMinute(tmp); break; case UnitSpeedTypes.Millimeter_Minute: speedUnit = SpeedUnit.FromMillimeterPerMinute(tmp); break; } return(speedUnit.AsMillimeterPerSecond); }