Пример #1
0
        public override bool Parse(XElement xml)
        {
            if (xml == null)
            {
                return(false);
            }

            short        id          = 0;
            string       name        = string.Empty;
            string       descr       = string.Empty;
            BadgeSubject refersTo    = BadgeSubject.User;
            int          threshold   = 0;
            BadgeLevel   level       = BadgeLevel.Junior;
            string       iconPath    = string.Empty;
            DateTime     timestamp   = DateTime.Now;
            string       activedescr = string.Empty;

            xml.ParseNode("ID", ref id, false);
            xml.ParseNode("Name", ref name, false);
            xml.ParseNode("Descr", ref descr, false);
            xml.ParseNode <BadgeSubject>("RefersTo", ref refersTo, false);
            xml.ParseNode("Threshold", ref threshold, false);
            xml.ParseNode <BadgeLevel>("Level", ref level, false);
            xml.ParseNode("IconPath", ref iconPath, false);
            xml.ParseNode("Timestamp", ref timestamp, false);
            xml.ParseNode("ActiveDescr", ref activedescr, false);

            Init(id, name, descr, refersTo, threshold, level, iconPath, timestamp, activedescr);

            return(true);
        }
Пример #2
0
 /// <summary>
 /// This is the complete init method for this class.
 /// It should be used by the children classes in the constructor in order to correctly fill the properties of the object.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="name"></param>
 /// <param name="refersTo"></param>
 /// <param name="threshold"></param>
 /// <param name="level"></param>
 /// <param name="iconPath"></param>
 /// <param name="timestamp"></param>
 protected void Init(short id, string name, string descr, BadgeSubject refersTo, int threshold, BadgeLevel level,
                     string iconPath, DateTime timestamp, string activeDescr)
 {
     ID          = id;
     Name        = name;
     Descr       = descr;
     RefersTo    = refersTo;
     Threshold   = threshold;
     Level       = level;
     IconPath    = iconPath;
     Timestamp   = timestamp;
     ActiveDescr = activeDescr;
 }
Пример #3
0
 /// <summary>
 ///   This create a complete Badge
 /// </summary>
 /// <param name="id">Tag ID (from the dictionary)</param>
 /// <param name="name"></param>
 /// <param name="refersTo"></param>
 /// <param name="threshold"></param>
 /// <param name="level"></param>
 /// <param name="iconPath"></param>
 /// <param name="timestamp"></param>
 /// <param name="activeDescr"></param>
 /// --------------------------------------------------------------------------------------------------
 protected Badge(short id, string name, string descr, BadgeSubject refersTo, int threshold, BadgeLevel level,
                 string iconPath, DateTime timestamp, string activeDescr)
 {
     Init(id, name, descr, refersTo, threshold, level, iconPath, timestamp, activeDescr);
 }