Exemple #1
0
        private void DoItemAdd(DateTime when, Mood mood,
                               Stress stress, Wellbeing wellbeing)
        {
            EmotionalStateModel emotion = new EmotionalStateModel();

            emotion.When      = when;
            emotion.Mood      = mood;
            emotion.Stress    = stress;
            emotion.Wellbeing = wellbeing;
            this.EmotionList.Add(emotion);
        }
Exemple #2
0
    public void IncrementWellbeingStat(Wellbeing stat, int value)
    {
        WellbeingValues[stat] += value;

        if (WellbeingValues[stat] > MaxWellbeingValue)
        {
            WellbeingValues[stat] = MaxWellbeingValue;
        }
        if (WellbeingValues[stat] < 0)
        {
            WellbeingValues[stat] = 0;
        }
    }
Exemple #3
0
    public void SetWellbeingStat(Wellbeing stat, int value)
    {
        if (value < 0)
        {
            value = 0;
        }
        if (value > MaxWellbeingValue)
        {
            value = MaxWellbeingValue;
        }

        WellbeingValues[stat] = value;
    }
        /// <summary>
        /// Populates this <see cref="Emotion"/> instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the emotion data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a emotion node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator emotionNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("emotion");

            Validator.ThrowInvalidIfNull(emotionNav, "EmotionUnexpectedNode");

            _when = new HealthServiceDateTime();
            _when.ParseXml(emotionNav.SelectSingleNode("when"));

            XPathNavigator moodNav =
                emotionNav.SelectSingleNode("mood");

            if (moodNav != null)
            {
                _mood = (Mood)moodNav.ValueAsInt;
            }

            XPathNavigator stressNav =
                emotionNav.SelectSingleNode("stress");

            if (stressNav != null)
            {
                _stress = (RelativeRating)stressNav.ValueAsInt;
            }

            XPathNavigator wellbeingNav =
                emotionNav.SelectSingleNode("wellbeing");

            if (wellbeingNav != null)
            {
                _wellbeing = (Wellbeing)wellbeingNav.ValueAsInt;
            }
        }
 private void DoItemAdd(DateTime when, Mood mood, 
     Stress stress, Wellbeing wellbeing, String note)
 {
     EmotionalStateModel emotion = new EmotionalStateModel();
     emotion.When = when;
     emotion.Mood = mood;
     emotion.Stress = stress;
     emotion.Wellbeing = wellbeing;
     emotion.Note = note;
     this.EmotionList.Add(emotion);
 }
Exemple #6
0
 public int GetWellbingStat(Wellbeing stat)
 {
     return(WellbeingValues[stat]);
 }