// Overridden from IUnits public Unit DefaultUnitFor(ESensorType sensorType) { switch (sensorType) { case ESensorType.Length: return(length); case ESensorType.Pressure: return(pressure); case ESensorType.Temperature: return(temperature); case ESensorType.Vacuum: return(vacuum); default: return(sensorType.GetDefaultUnit()); } }
/// <summary> /// Resolves the default unit for the given sensor type. /// </summary> /// <returns>The unit for.</returns> /// <param name="prefs">Prefs.</param> /// <param name="sensorType">Sensor type.</param> public static Unit DefaultUnitFor(this IUnitPreferences prefs, ESensorType sensorType) { switch (sensorType) { case ESensorType.Length: return(prefs.length); case ESensorType.Pressure: return(prefs.pressure); case ESensorType.Temperature: return(prefs.temperature); case ESensorType.Vacuum: return(prefs.vacuum); default: return(sensorType.GetDefaultUnit()); } }