Пример #1
0
        /// <summary>
        /// Parses a personal event from its XML representation
        /// </summary>
        /// <param name="E">XML representation of personal event.</param>
        /// <returns>Personal event object.</returns>
        public override IPersonalEvent Parse(XmlElement E)
        {
            UserMood Result = new UserMood();

            foreach (XmlNode N in E.ChildNodes)
            {
                if (N is XmlElement E2)
                {
                    switch (E2.LocalName)
                    {
                    case "text":
                        Result.text = E2.InnerText;
                        break;

                    default:
                        if (Enum.TryParse <UserMoods>(E2.LocalName, out UserMoods Mood))
                        {
                            Result.mood = Mood;
                        }
                        else if (!Result.mood.HasValue)
                        {
                            Result.mood = UserMoods.undefined;
                        }
                        break;
                    }
                }
            }

            return(Result);
        }
Пример #2
0
 internal UserMoodEventArguments(UserMood Mood, PersonalEventNotificationEventArgs e) :
     base(e)
 {
     this.mood = Mood;
 }