예제 #1
0
 static Temperature()
 {
     UnitTable = new UnitTable();
     UnitTable.SetBase(KnownUnits.Celsius, "°C");
     UnitTable.AddConverter(KnownUnits.Fahrenheit, "°F", value => (value - 32) / 1.8f, value => (value * 1.8f) + 32);
     UnitTable.AddConverter(KnownUnits.Kelvin, "°K", value => value + 273.15f, value => value - 273.15f);
 }
예제 #2
0
 static Duration()
 {
     __unitTable = new UnitTable();
     __unitTable.SetBase(KnownUnits.Seconds, "s");
     __unitTable.AddConverter(KnownUnits.Minutes, "m", value => value * 60, value => value / 60);
     __unitTable.AddConverter(KnownUnits.Hours, "h", value => value * 3600, value => value / 3600);
 }
예제 #3
0
파일: Voltage.cs 프로젝트: valoni/uScoober
 static Voltage()
 {
     UnitTable = new UnitTable();
     UnitTable.SetBase(KnownUnits.Volts, "V");
     UnitTable.AddConverter(KnownUnits.MilliVolts, "mV", value => value * 0.001f, value => value / 0.001f);
     UnitTable.AddConverter(KnownUnits.KiloVolts, "kV", value => value * 1000, value => value / 1000);
 }
예제 #4
0
파일: Length.cs 프로젝트: valoni/uScoober
        static Length()
        {
            UnitTable = new UnitTable();
            UnitTable.SetBase(KnownUnits.Meters, "m");
            UnitTable.AddConverter(KnownUnits.Millimeters, "mm", value => value * .001f, value => value / .001f);
            UnitTable.AddConverter(KnownUnits.Centimeters, "h", value => value * .01f, value => value / .01f);
            UnitTable.AddConverter(KnownUnits.Decimeters, "h", value => value * .1f, value => value / .1f);
            UnitTable.AddConverter(KnownUnits.Kilometers, "km", value => value * 1000, value => value / 1000);

            UnitTable.AddConverter(KnownUnits.Inches, "in", value => value * 0.0254f, value => value / 0.0254f);
            UnitTable.AddConverter(KnownUnits.Feet, "ft", value => value * 0.3048f, value => value / 0.3048f);
            UnitTable.AddConverter(KnownUnits.Yards, "yd", value => value * 0.9144f, value => value / 0.9144f);
            UnitTable.AddConverter(KnownUnits.Fathoms, "fath", value => value * 1.8288f, value => value / 1.8288f);
            UnitTable.AddConverter(KnownUnits.Miles, "mi", value => value * 1609.344f, value => value / 1609.344f);
            UnitTable.AddConverter(KnownUnits.NauticalMiles, "nmi", value => value * 1852.0f, value => value / 1852.0f);
        }