public static double ConvertBack(string str) { //double tmp = double.Parse(str); double.TryParse(str, out double tmp); TimeUnit timeUnit = TimeUnit.FromMillisecond(tmp); var unitType = UnitObserverFacade.Instance.TimeUnitObserver.UnitType; switch (unitType) { case UnitTimeTypes.Millisecond: timeUnit = TimeUnit.FromMillisecond(tmp); break; case UnitTimeTypes.Second: timeUnit = TimeUnit.FromSecond(tmp); break; case UnitTimeTypes.Minute: timeUnit = TimeUnit.FromMinute(tmp); break; } return(timeUnit.AsMilliSecond); }