public void setDistance(decimal distance)
        {
            if (isDistance())
            {
                switch (ValueType)
                {
                case ResultDisplayDescription.DistanceMeters:
                    RawValue = DistanceHelper.fromMetersToMillimeters(distance);
                    return;

                case ResultDisplayDescription.DistanceMetersCentimeters:
                    RawValue = DistanceHelper.fromMetersToMillimeters(distance);
                    return;

                case ResultDisplayDescription.DistanceCentimeters:
                    RawValue = DistanceHelper.fromCentimetersToMillimeters(distance);
                    return;

                default:
                    throw new ArgumentException("Unknown result type");
                }
            }
            else
            {
                throw new ArgumentException("Can not set distance on a timed result");
            }
        }
        public string getResultString()
        {
            if (!HasValue())
            {
                return(string.Empty);
            }

            TimeSpan ts;

            // To Do when converting from Portable Library to Class Library the Math.Floor function caused an ambiguity between double and decimal.
            // As such I have explicitly case Second and Minuet and Millisecond to decimal

            switch (ValueType)
            {
            case ResultDisplayDescription.TimedMinuetsSeconds:
                ts = TimeSpan.FromMilliseconds(RawValue);
                return(string.Format("{0}:{1:00}", Math.Floor(ts.TotalMinutes), Math.Floor((decimal)ts.Seconds)));

            case ResultDisplayDescription.TimedMinuetsSecondsTenths:
                ts = TimeSpan.FromMilliseconds(RawValue);
                return(string.Format("{0}:{1:00}.{2:0}", Math.Floor(ts.TotalMinutes), Math.Floor((decimal)ts.Seconds), Math.Floor((decimal)ts.Milliseconds / 100)));

            case ResultDisplayDescription.TimedMinuetsSecondsHundreds:
                ts = TimeSpan.FromMilliseconds(RawValue);
                return(string.Format("{0}:{1:00}.{2:00}", Math.Floor(ts.TotalMinutes), Math.Floor((decimal)ts.Seconds), Math.Floor((decimal)ts.Milliseconds / 10)));

            case ResultDisplayDescription.TimedSecondsTenths:
                ts = TimeSpan.FromMilliseconds(RawValue);
                return(string.Format("{0}.{1:0}s", Math.Floor(ts.TotalSeconds), Math.Floor((decimal)ts.Milliseconds / 100)));

            case ResultDisplayDescription.TimedSecondsHundreds:
                ts = TimeSpan.FromMilliseconds(RawValue);
                return(string.Format("{0}.{1:00}s", Math.Floor(ts.TotalSeconds), Math.Floor((decimal)ts.Milliseconds / 10)));

            case ResultDisplayDescription.DistanceMeters:
                return(string.Format("{0:0}m", Decimal.Truncate((Decimal)(DistanceHelper.fromMillimetersToMeters(RawValue)))));

            case ResultDisplayDescription.DistanceMetersCentimeters:
                return(string.Format("{0:0.00}m", DistanceHelper.TruncateDecimal(DistanceHelper.fromMillimetersToMeters(RawValue), 2)));

            case ResultDisplayDescription.DistanceCentimeters:
                return(string.Format("{0:0}cm", Decimal.Truncate(DistanceHelper.fromMillimetersToCentimeters(RawValue))));



            //case ResultDisplayDescription.TimedMinuetsSeconds:
            //    ts = TimeSpan.FromMilliseconds(RawValue);
            //    return string.Format("{0}:{1:00}", Math.Floor(ts.TotalMinutes), Math.Floor(ts.Seconds));

            //case ResultDisplayDescription.TimedMinuetsSecondsTenths:
            //    ts = TimeSpan.FromMilliseconds(RawValue);
            //    return string.Format("{0}:{1:00}.{2:0}", Math.Floor(ts.TotalMinutes), Math.Floor(ts.Seconds), Math.Floor(ts.Milliseconds / 100));

            //case ResultDisplayDescription.TimedMinuetsSecondsHundreds:
            //    ts = TimeSpan.FromMilliseconds(RawValue);
            //    return string.Format("{0}:{1:00}.{2:00}", Math.Floor(ts.TotalMinutes), Math.Floor(ts.Seconds), Math.Floor(ts.Milliseconds / 10));

            //case ResultDisplayDescription.TimedSecondsTenths:
            //    ts = TimeSpan.FromMilliseconds(RawValue);
            //    return string.Format("{0}.{1:0}s", Math.Floor(ts.TotalSeconds), Math.Floor(ts.Milliseconds / 100));

            //case ResultDisplayDescription.TimedSecondsHundreds:
            //    ts = TimeSpan.FromMilliseconds(RawValue);
            //    return string.Format("{0}.{1:0}s", Math.Floor(ts.TotalSeconds), Math.Floor(ts.Milliseconds / 10));

            //case ResultDisplayDescription.DistanceMeters:
            //    return string.Format("{0:0}m", Decimal.Truncate((Decimal)(DistanceHelper.fromMillimetersToMeters(RawValue))));

            //case ResultDisplayDescription.DistanceMetersCentimeters:
            //    return string.Format("{0:0.00}m", DistanceHelper.TruncateDecimal( DistanceHelper.fromMillimetersToMeters(RawValue),2));

            //case ResultDisplayDescription.DistanceCentimeters:
            //    return string.Format("{0:0}cm", Decimal.Truncate(DistanceHelper.fromMillimetersToCentimeters(RawValue)));

            default:
                throw new ArgumentNullException("Value Type", "Value type not recognised");
            }
        }