private static void PopulateEvent(EventGroup eventGroup, XmlNode _eventNode) { if (_eventNode.NodeType != XmlNodeType.Comment) { Event _event = new Event(); _event.Id = Int32.Parse(_eventNode.Attributes["id"].InnerText); _event.Name = _eventNode.Attributes["time"].InnerText + " - " + _eventNode.Attributes["name"].InnerText; _event.Date = _eventNode.Attributes["date"].InnerText; _event.Time = _eventNode.Attributes["time"].InnerText; // Populate Selections foreach (XmlNode _selectionNode in _eventNode) { PopulateSelection(_event, _selectionNode); } PopulateResults(_eventNode, _event); eventGroup.Events.Add(_event); } }
private void RefreshCouponsView() { // If the selected Eventgroups / event isn't still downloading if (selectedEventid != -1 && selectedEventGroupid != -1) { switch (OC.OnlineMode) { case true: { SelectedCoupon = OC.Coupons[selectedCouponId]; SelectedEventGroup = SelectedCoupon.EventGroups[selectedEventGroupid]; SelectedEvent = SelectedEventGroup.Events[selectedEventid]; } break; case false: { SelectedCoupon = OC.Coupons.FirstOrDefault(); SelectedEventGroup = SelectedCoupon.EventGroups.FirstOrDefault(); SelectedEvent = SelectedEventGroup.Events.FirstOrDefault(); } break; } } }
private void PopulateEventGroup(SportCoupon coupon, XmlNode _eventGroupNode) { EventGroup eventGroup = new EventGroup(); eventGroup.Id = Int32.Parse(_eventGroupNode.Attributes["id"].InnerText); eventGroup.Name = _eventGroupNode.Attributes["name"].InnerText; // Populate Events foreach (XmlNode _eventNode in _eventGroupNode) { PopulateEvent(eventGroup, _eventNode); } App.Current.Dispatcher.Invoke((Action)delegate { // if EventGroup isn't on coupon, add it if (coupon.EventGroups.Count < eventGroup.Id + 1) { coupon.EventGroups.Add(eventGroup); AddStatusUpdate("New Event downloaded. Adding to " + coupon.Name + " coupon", eventGroup.Name); } // Else update the current eventgroup on the coupon else { AddStatusUpdate("Update Found for " + coupon.Name, eventGroup.Name); coupon.EventGroups[eventGroup.Id] = eventGroup; } RefreshCouponsView(); coupon.LastDownload = DateTime.Now; }); }