Пример #1
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     this.thisEvent = (Application.Current as App).selectedEvent;
     base.OnNavigatedTo(e);
 }
Пример #2
0
        void GetEventsResponse(IAsyncResult result)
        {
            HttpWebRequest request = result.AsyncState as HttpWebRequest;
            if (request != null)
            {
                try
                {
                    WebResponse response = request.EndGetResponse(result);
                    Stream outStream = response.GetResponseStream();
                    StreamReader reader = new StreamReader(outStream);
                    string xmlResult = reader.ReadToEnd();
                    XDocument xdoc = XDocument.Parse(xmlResult);

                    IEnumerable<XElement> items = xdoc.Descendants("item");
                    foreach (XElement item in items)
                    {
                        String eventName = item.Element("name") != null ? item.Element("name").Value : "";
                        String description = item.Element("description") != null? (RemoveHtmlTags(item.Element("description").Value)) : ""; 
                        String findUs = item.Element("how_to_find_us") != null ? item.Element("how_to_find_us").Value : "";
                        String eventUrl = item.Element("event_url").Value;
                        int yesRsvp = item.Element("yes_rsvp_count") != null ? int.Parse(item.Element("yes_rsvp_count").Value) : 99999;
                        int rsvpLimit = item.Element("rsvp_limit") != null ? int.Parse(item.Element("rsvp_limit").Value) : 99999;
                        int maybeRsvp = item.Element("maybe_rsvp_count") != null ? int.Parse(item.Element("maybe_rsvp_count").Value) : 99999;
                        double time = double.Parse(item.Element("time").Value);
                        double timeOffSet = double.Parse(item.Element("utc_offset").Value);
                        double eventDuration = item.Element("duration") != null ? double.Parse(item.Element("duration").Value) : 0;

                        long groupId = long.Parse(item.Element("group").Element("id").Value);

                        DateTime eventStartTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                        eventStartTime = eventStartTime.AddMilliseconds(time + timeOffSet);

                        DateTime eventEndTime = eventStartTime.AddMilliseconds(eventDuration);

                        XElement venueNode = item.Element("venue");

                        Venue venue = null;
                        if (venueNode != null)
                        {
                            venue = GetVenue(venueNode);
                        }
                       
                        Events newEvent = new Events(eventName, description, venue);
                        newEvent.eventURL = eventUrl;
                        newEvent.howToFindUs = findUs;
                        newEvent.yesRsvp = yesRsvp;
                        newEvent.rsvpLimit = rsvpLimit;
                        newEvent.maybeRsvp = maybeRsvp;
                        newEvent.eventStartTime = eventStartTime;
                        newEvent.eventEndTime = eventEndTime;
                        newEvent.groupId = groupId;

                        panoramaEvents.Add(newEvent);
                    }

                    Dispatcher.BeginInvoke(() =>
                    {
                        DispatchEventInfo();
                    });

                    (Application.Current as App).panoramaEvents = this.panoramaEvents;
                }
                catch (WebException e)
                {
                    return;
                }
            }
        }