Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Distance"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal Distance(EditDeserializer editDeserializer)
        {
            double           distance = editDeserializer.ReadDouble(DataField.Value);
            DistanceUnitType unitType = (DistanceUnitType)editDeserializer.ReadByte(DataField.Unit);

            m_EnteredUnit    = EditingController.GetUnits(unitType);
            m_ObservedMetric = m_EnteredUnit.ToMetric(distance);

            if (editDeserializer.IsNextField(DataField.Fixed))
            {
                m_IsFixed = editDeserializer.ReadBool(DataField.Fixed);
            }
            else
            {
                m_IsFixed = false;
            }

            if (editDeserializer.IsNextField(DataField.Flipped))
            {
                IsAnnotationFlipped = editDeserializer.ReadBool(DataField.Flipped);
            }
            else
            {
                IsAnnotationFlipped = false;
            }
        }