Esempio n. 1
0
        /// <summary>
        /// Populates this <see cref="AerobicWeeklyGoal"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the aerobic goal data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// an aerobic-session node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator aerobicWeeklyNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode(
                    "aerobic-weekly");

            Validator.ThrowInvalidIfNull(aerobicWeeklyNav, Resources.AerobicWeeklyUnexpectedNode);

            _session = new AerobicBase();
            _session.ParseXml(aerobicWeeklyNav.SelectSingleNode("session"));

            _recurrence =
                aerobicWeeklyNav.SelectSingleNode("recurrence").ValueAsInt;
        }
Esempio n. 2
0
 /// <summary>
 /// Creates a new instance of the <see cref="AerobicWeeklyGoal"/> class
 /// with the specified session data.
 /// </summary>
 ///
 /// <param name="session">
 /// An aerobic session that defines the goal.
 /// </param>
 ///
 /// <param name="recurrence">
 /// The number of occurrences of the session required in a week to
 /// meet the goal.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="session"/> parameter is <b>null</b>.
 /// </exception>
 ///
 /// <exception cref="ArgumentOutOfRangeException">
 /// The <paramref name="recurrence"/> parameter is negative or zero.
 /// </exception>
 ///
 public AerobicWeeklyGoal(AerobicBase session, int recurrence)
     : base(TypeId)
 {
     AerobicSession = session;
     Recurrence     = recurrence;
 }