protected override void OnInitialize() { base.OnInitialize(); new Twunch.Fetcher(twunches => Item = twunches.FirstOrDefault(x => x.Id == Id), true).Execute(new ActionExecutionContext()); }
private Twunch ReadTwunch(XmlReader reader) { var result = new Twunch(); reader.Read(); while (!reader.EOF) { switch (reader.Name) { case "id": result.Id = reader.ReadElementContentAsString(); break; case "title": result.Title = reader.ReadElementContentAsString(); break; case "address": result.Address = reader.ReadElementContentAsString(); break; case "note": result.Note = reader.ReadElementContentAsString(); break; case "map": result.MapUri = new Uri(reader.ReadElementContentAsString()); break; case "link": result.Link = new Uri(reader.ReadElementContentAsString()); break; case "date": { var d = DateTimeOffset.Now; DateTimeOffset.TryParseExact(reader.ReadElementContentAsString(), @"yyyyMMddTHHmmssZ", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out d); result.Date = d; break; } case "longitude": { double l = 0; string s = reader.ReadElementContentAsString(); double.TryParse(s, NumberStyles.Float, new CultureInfo("en-US"), out l); result.Longitude = l; break; } case "latitude": { double l = 0; string s = reader.ReadElementContentAsString(); double.TryParse(s, NumberStyles.Float, new CultureInfo("en-US"), out l); result.Latitude = l; break; } case "closed": result.Closed = reader.ReadElementContentAsBoolean(); break; case "participants": reader.ReadToFollowing("participant"); do { result.Participants.Add(reader.ReadElementContentAsString()); } while (reader.ReadToNextSibling("participant")); break; default: return result; } } return result; }
private Twunch ReadTwunch(XmlReader reader) { var result = new Twunch(); reader.Read(); while (!reader.EOF) { switch (reader.Name) { case "id": result.Id = reader.ReadElementContentAsString(); break; case "title": result.Title = reader.ReadElementContentAsString(); break; case "address": result.Address = reader.ReadElementContentAsString(); break; case "note": result.Note = reader.ReadElementContentAsString(); break; case "map": result.MapUri = new Uri(reader.ReadElementContentAsString()); break; case "link": result.Link = new Uri(reader.ReadElementContentAsString()); break; case "date": { var d = DateTimeOffset.Now; DateTimeOffset.TryParseExact(reader.ReadElementContentAsString(), @"yyyyMMddTHHmmssZ", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out d); result.Date = d; break; } case "longitude": { double l = 0; string s = reader.ReadElementContentAsString(); double.TryParse(s, NumberStyles.Float, new CultureInfo("en-US"), out l); result.Longitude = l; break; } case "latitude": { double l = 0; string s = reader.ReadElementContentAsString(); double.TryParse(s, NumberStyles.Float, new CultureInfo("en-US"), out l); result.Latitude = l; break; } case "closed": result.Closed = reader.ReadElementContentAsBoolean(); break; case "participants": reader.ReadToFollowing("participant"); do { result.Participants.Add(reader.ReadElementContentAsString()); } while (reader.ReadToNextSibling("participant")); break; default: return(result); } } return(result); }
public TwunchItemViewModel(Twunch source) { this.source = source; }