public static CheckInInfo Parse(XmlNode node) { CheckInInfo checkInInfo = new CheckInInfo(); if (node.SelectSingleNode("id") != null) { checkInInfo.Id = long.Parse(node.SelectSingleNode("id").InnerText); } if (node.SelectSingleNode("message") != null) { checkInInfo.Message = node.SelectSingleNode("message").InnerText; } if (node.SelectSingleNode("created") != null) { checkInInfo.Created = DateTime.Parse(node.SelectSingleNode("created").InnerText); } if (node.SelectSingleNode("venue") != null) { checkInInfo.Venue = Venue.Parse(node.SelectSingleNode("venue")); } if (node.SelectSingleNode("mayor") != null) { checkInInfo.Mayor = Mayor.Parse(node.SelectSingleNode("mayor")); } if (node.SelectSingleNode("badges") != null) { List<Badge> badges = new List<Badge>(); foreach (XmlNode n in node.SelectNodes("badges/badge")) { badges.Add(Badge.Parse(n)); } checkInInfo.Badges = badges.ToArray(); } if (node.SelectSingleNode("scoring") != null) { List<Score> scores = new List<Score>(); foreach (XmlNode n in node.SelectNodes("scoring/score")) { scores.Add(Score.Parse(n)); } checkInInfo.Scoring = scores.ToArray(); } if (node.SelectSingleNode("specials") != null) { List<Special> specials = new List<Special>(); foreach (XmlNode n in node.SelectNodes("specials/special")) { specials.Add(Special.Parse(n)); } checkInInfo.Specials = specials.ToArray(); } return checkInInfo; }
internal void LoadInfo(CheckInInfo info) { this.info = info; venueName.Text = info.Venue.Name; message.Text = info.Message; mayorMsg.Text = info.Mayor != null ? info.Mayor.Message : ""; if (info.Mayor != null && info.Mayor.User != null && !string.IsNullOrEmpty(info.Mayor.User.Photo)) { string url = info.Mayor.User.Photo; HttpWebRequest imgRequest = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse imgResponse = (HttpWebResponse)imgRequest.GetResponse(); Bitmap bmp = new Bitmap(imgResponse.GetResponseStream()); imgResponse.Close(); userPicture.SizeMode = PictureBoxSizeMode.StretchImage; userPicture.Image = bmp; } }