Exemplo n.º 1
0
        public static FacbookEvent Deserealize(dynamic eventObject)
        {
            FacbookEvent fbEvent = new FacbookEvent();

            fbEvent.Id        = eventObject.eid;
            fbEvent.Name      = eventObject.name;
            fbEvent.StartTime = DateTime.Parse((string)eventObject.start_time);

            if (!(eventObject.venue is Facebook.JsonArray))
            {
                fbEvent.Venue = FacebookVenue.Deserealize(eventObject.venue);
            }

            fbEvent.AttendingCount = (int)eventObject.attending_count;
            fbEvent.EventUrl       = @"https://www.facebook.com/events/" + fbEvent.Id;

            return(fbEvent);
        }
Exemplo n.º 2
0
        public void GetEvents()
        {
            var client = new FacebookClient("CAACEdEose0cBAMymCBZA1VTV5bTjWWoyihmMD3hNz3jULulBiHWqsBO5JHLJtqahZBCwkUb0JZC3ZAAbUqZCiyFJsrpn4wC1aHZBOvyCoNiNgrgRLfAQOj3tRZCGoaWwnYZCuFhoUjLIWsc9sobXZBZABgaGcM5ffKlIvzCGJDfzo5ugZDZD");

            var result = client.GetTaskAsync("fql",
                                             new
            {
                q = FacebookRequests.GetTopEvents
            });

            result.Wait();
            dynamic rawEvents = result.Result;

            rawEvents = rawEvents[0];

            List <FacbookEvent> events = new List <FacbookEvent>();

            foreach (dynamic e in rawEvents)
            {
                events.Add(FacbookEvent.Deserealize(e));
            }
        }