Пример #1
0
        void FetchData(IAsyncResult result)
        {
            HttpWebResponse response = (HttpWebResponse)httpWebRequest.EndGetResponse(result);
            XDocument       xdoc     = XDocument.Load(response.GetResponseStream());

            var fetchResult =
                (from _career in xdoc.Descendants("carreer")
                 select new Career()
            {
                Description = _career.ElementAnyNS("description") != null ? _career.ElementAnyNS("description").Value : "",
                Link =
                    (from _link in xdoc.Descendants("link")
                     select new Link()
                {
                    Title = _link.ElementAnyNS("title") != null ? _link.ElementAnyNS("title").Value : "",
                    Url = _link.ElementAnyNS("url") != null ? _link.ElementAnyNS("url").Value : ""
                }).ToList(),
                Job =
                    (from _job in xdoc.Descendants("job")
                     select new JobOffer()
                {
                    Id = _job.ElementAnyNS("id") != null ? _job.ElementAnyNS("id").Value : "",
                    Location = _job.ElementAnyNS("location") != null ? _job.ElementAnyNS("location").Value : "",
                    Title = _job.ElementAnyNS("title") != null ? _job.ElementAnyNS("title").Value : "",
                    Description = _job.ElementAnyNS("description") != null ? _job.ElementAnyNS("description").Value : "",
                    Contact = _job.ElementAnyNS("contact") != null ? _job.ElementAnyNS("contact").Value : ""
                }).ToList()
            });

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ContentProviderResultCallback callback = (ContentProviderResultCallback)result.AsyncState;
                callback(fetchResult.First());
            });
        }
Пример #2
0
        void FetchData(IAsyncResult result)
        {
            HttpWebResponse response = (HttpWebResponse)httpWebRequest.EndGetResponse(result);
            XDocument       xdoc     = XDocument.Load(response.GetResponseStream());

            var fetchResult =
                (from _contact in xdoc.Descendants("contact")
                 select new Contact()
            {
                Name = _contact.ElementAnyNS("name") != null ? _contact.ElementAnyNS("name").Value : "",
                Role = _contact.ElementAnyNS("role") != null ? _contact.ElementAnyNS("role").Value : "",
                Bio = _contact.ElementAnyNS("bio") != null ? _contact.ElementAnyNS("bio").Value : "",
                Pictureurl = _contact.ElementAnyNS("pictureurl") != null ? _contact.ElementAnyNS("pictureurl").Value : "",
                Mail = _contact.ElementAnyNS("mail") != null ? _contact.ElementAnyNS("mail").Value : "",
                Phone = _contact.ElementAnyNS("phone") != null ? _contact.ElementAnyNS("phone").Value : "",
                Webaddresses =
                    (from _webaddresses in xdoc.Descendants("webaddresses")
                     select new WebAddress()
                {
                    Title = _webaddresses.ElementAnyNS("title") != null ? _webaddresses.ElementAnyNS("title").Value : "",
                    Url = _webaddresses.ElementAnyNS("url") != null ? _webaddresses.ElementAnyNS("url").Value : ""
                }).ToList()
            });

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ContentProviderResultCallback callback = (ContentProviderResultCallback)result.AsyncState;
                callback(fetchResult.First());
            });
        }
Пример #3
0
        void FetchData(IAsyncResult result)
        {
            try
            {
                HttpWebResponse response = (HttpWebResponse)httpWebRequest.EndGetResponse(result);
                XDocument       xdoc     = XDocument.Load(response.GetResponseStream());

                var fetchResult = (from item in xdoc.Descendants("contact")
                                   select new Contact()
                {
                    Name = item.ElementAnyNS("name").Value,
                    Role = item.ElementAnyNS("role").Value,
                    Bio = item.ElementAnyNS("bio").Value,
                    Pictureurl = item.ElementAnyNS("pictureurl").Value,
                    Mail = item.ElementAnyNS("mail").Value,
                    Phone = item.ElementAnyNS("phone").Value
                });
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    ContentProviderResultCallback callback = (ContentProviderResultCallback)result.AsyncState;
                    callback(fetchResult.First());
                });
            }
            catch (WebException)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    System.Windows.MessageBox.Show("Sorry - couldn't load data.");
                });
            }
        }
        void FetchData(IAsyncResult result)
        {
            HttpWebResponse response = (HttpWebResponse)httpWebRequest.EndGetResponse(result);
            XDocument       xdoc     = XDocument.Load(response.GetResponseStream());

            var fetchResult = (from item in xdoc.Descendants("events")
                               select new AllEvents()
            {
                News = (from news in item.Descendants("news")
                        select new Event()
                {
                    Id = news.Element("id").Value,
                    Kind = news.ElementAnyNS("kind").Value,
                    Title = news.ElementAnyNS("title").Value,
                    Date = news.ElementAnyNS("date").Value,
                    Location = news.ElementAnyNS("location").Value,
                    Description = news.ElementAnyNS("description").Value,
                    Contact = news.ElementAnyNS("contact").Value,
                    Link = news.ElementAnyNS("url").Value
                }).ToList(),
                Activity = (from activity in item.Descendants("activity")
                            select new Event()
                {
                    Id = activity.Element("id").Value,
                    Kind = activity.ElementAnyNS("kind").Value,
                    Title = activity.ElementAnyNS("title").Value,
                    Date = activity.ElementAnyNS("date").Value,
                    Location = activity.ElementAnyNS("location").Value,
                    Description = activity.ElementAnyNS("description").Value,
                    Contact = activity.ElementAnyNS("contact").Value,
                    Link = activity.ElementAnyNS("url").Value
                }).ToList(),
                Workshop = (from workshop in item.Descendants("workshop")
                            select new Event()
                {
                    Id = workshop.Element("id").Value,
                    Kind = workshop.ElementAnyNS("kind").Value,
                    Title = workshop.ElementAnyNS("title").Value,
                    Date = workshop.ElementAnyNS("date").Value,
                    Location = workshop.ElementAnyNS("location").Value,
                    Description = workshop.ElementAnyNS("description").Value,
                    Contact = workshop.ElementAnyNS("contact").Value,
                    Link = workshop.ElementAnyNS("url").Value,
                    Speakers = (from speakers in workshop.Descendants("speakers")
                                select new Contact()
                    {
                        Name = speakers.Element("name").Value,
                        Role = speakers.Element("role").Value
                    }).ToList()
                }).ToList()
            });

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ContentProviderResultCallback callback = (ContentProviderResultCallback)result.AsyncState;
                callback(fetchResult.First());
            });
        }
Пример #5
0
        void FetchData(IAsyncResult result)
        {
            HttpWebResponse response = (HttpWebResponse)httpWebRequest.EndGetResponse(result);
            XDocument       xdoc     = XDocument.Load(response.GetResponseStream());

            var fetchResult =
                (from _company in xdoc.Descendants("company")
                 select new Company()
            {
                Description = _company.ElementAnyNS("description") != null ? _company.ElementAnyNS("description").Value : "",
                Office =
                    (from _office in xdoc.Descendants("office")
                     select new Office()
                {
                    Id = _office.ElementAnyNS("id") != null ? _office.ElementAnyNS("id").Value : "",
                    Location = _office.ElementAnyNS("location") != null ? _office.ElementAnyNS("location").Value : "",
                    Summary = _office.ElementAnyNS("summary") != null ? _office.ElementAnyNS("summary").Value : "",
                    Pictureurl = _office.ElementAnyNS("pictureurl") != null ? _office.ElementAnyNS("pictureurl").Value : "",
                    Contact =
                        (from _contact in xdoc.Descendants("contact")
                         select new Contact()
                    {
                        Name = _contact.ElementAnyNS("name") != null ? _contact.ElementAnyNS("name").Value : "",
                        Role = _contact.ElementAnyNS("role") != null ? _contact.ElementAnyNS("role").Value : "",
                        Bio = _contact.ElementAnyNS("bio") != null ? _contact.ElementAnyNS("bio").Value : "",
                        Pictureurl = _contact.ElementAnyNS("pictureurl") != null ? _contact.ElementAnyNS("pictureurl").Value : "",
                        Mail = _contact.ElementAnyNS("mail") != null ? _contact.ElementAnyNS("mail").Value : "",
                        Phone = _contact.ElementAnyNS("phone") != null ? _contact.ElementAnyNS("phone").Value : "",
                        Webaddresses =
                            (from _webaddresses in xdoc.Descendants("webaddresses")
                             select new WebAddress()
                        {
                            Title = _webaddresses.ElementAnyNS("title") != null ? _webaddresses.ElementAnyNS("title").Value : "",
                            Url = _webaddresses.ElementAnyNS("url") != null ? _webaddresses.ElementAnyNS("url").Value : ""
                        }).ToList()
                    }).First(),
                    Phone = _office.ElementAnyNS("phone") != null ? _office.ElementAnyNS("phone").Value : "",
                    Mail = _office.ElementAnyNS("mail") != null ? _office.ElementAnyNS("mail").Value : "",
                    Address = _office.ElementAnyNS("address") != null ? _office.ElementAnyNS("address").Value : "",
                    Geo = _office.ElementAnyNS("geo") != null ? _office.ElementAnyNS("geo").Value : ""
                }).ToList()
            });

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ContentProviderResultCallback callback = (ContentProviderResultCallback)result.AsyncState;
                callback(fetchResult.First());
            });
        }
Пример #6
0
        void FetchData(IAsyncResult result)
        {
            HttpWebResponse response = (HttpWebResponse)httpWebRequest.EndGetResponse(result);
            XDocument       xdoc     = XDocument.Load(response.GetResponseStream());

            var fetchResult =
                (from _blogItem in xdoc.Descendants("item")
                 select new BlogItem()
            {
                Guid = _blogItem.ElementAnyNS("guid") != null ? _blogItem.ElementAnyNS("guid").Value : "",
                Title = _blogItem.ElementAnyNS("title") != null ? _blogItem.ElementAnyNS("title").Value : "",
                Link = _blogItem.ElementAnyNS("link") != null ? _blogItem.ElementAnyNS("link").Value : "",
                Description = _blogItem.ElementAnyNS("description") != null ? _blogItem.ElementAnyNS("description").Value : "",
                Creator = _blogItem.ElementAnyNS("creator") != null ? _blogItem.ElementAnyNS("creator").Value : ""
            });

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ContentProviderResultCallback callback = (ContentProviderResultCallback)result.AsyncState;
                callback(fetchResult.First());
            });
        }
Пример #7
0
 public void LoadData(ContentProviderResultCallback resultCallback, string name)
 {
     httpWebRequest = HttpWebRequest.CreateHttp("http://www.itemis.de/applause/people/de/" + name.URLEncode() + ".xml");
     httpWebRequest.BeginGetResponse(new AsyncCallback(FetchData), resultCallback);
 }
 public void LoadData(ContentProviderResultCallback resultCallback)
 {
     httpWebRequest = HttpWebRequest.CreateHttp(DATA_URL);
     httpWebRequest.BeginGetResponse(new AsyncCallback(FetchData), resultCallback);
 }
 public void LoadData(ContentProviderResultCallback resultCallback)
 {
     httpWebRequest = HttpWebRequest.CreateHttp(DATA_URL);
     httpWebRequest.BeginGetResponse(new AsyncCallback(FetchData), resultCallback);
 }
 public void LoadData(ContentProviderResultCallback resultCallback, string id)
 {
     httpWebRequest = HttpWebRequest.CreateHttp("http://www.itemis.de/language=de/~xml.applause/" + id);
     httpWebRequest.BeginGetResponse(new AsyncCallback(FetchData), resultCallback);
 }
 public void LoadData(ContentProviderResultCallback resultCallback, string name)
 {
     httpWebRequest = HttpWebRequest.CreateHttp("http://www.itemis.de/applause/people/de/" + name.URLEncode() + ".xml");
     httpWebRequest.BeginGetResponse(new AsyncCallback(FetchData), resultCallback);
 }
Пример #12
0
 public void LoadData(ContentProviderResultCallback resultCallback, BlogItem b)
 {
     httpWebRequest = HttpWebRequest.CreateHttp("http://feedsanitizer.appspot.com" + "/sanitize?url=http%3A%2F%2Fblogs.itemis.de%2F%3Fshowfeed%3D1&format=rss&id=" + b.Guid.URLEncode());
     httpWebRequest.BeginGetResponse(new AsyncCallback(FetchData), resultCallback);
 }
 // send url parameters as vararg parameter? might make it easier to generate the code!
 public void LoadData(string name, ContentProviderResultCallback resultCallback)
 {
     httpWebRequest = HttpWebRequest.CreateHttp(BuildDataURL(name));
     httpWebRequest.BeginGetResponse(new AsyncCallback(FetchData), resultCallback);
 }
Пример #14
0
 public void LoadData(ContentProviderResultCallback resultCallback)
 {
     httpWebRequest = HttpWebRequest.CreateHttp("http://feedsanitizer.appspot.com" + "/sanitize?url=http%3A%2F%2Fblogs.itemis.de%2F%3Fshowfeed%3D1&format=rss");
     httpWebRequest.BeginGetResponse(new AsyncCallback(FetchData), resultCallback);
 }
 public void LoadData(ContentProviderResultCallback resultCallback)
 {
     httpWebRequest = HttpWebRequest.CreateHttp("http://www.itemis.de/language=de/~xml.timeline/37606");
     httpWebRequest.BeginGetResponse(new AsyncCallback(FetchData), resultCallback);
 }
        void FetchData(IAsyncResult result)
        {
            HttpWebResponse response = (HttpWebResponse)httpWebRequest.EndGetResponse(result);
            XDocument       xdoc     = XDocument.Load(response.GetResponseStream());

            var fetchResult =
                (from _allEvents in xdoc.Descendants("events")
                 select new AllEvents()
            {
                News =
                    (from _news in xdoc.Descendants("news")
                     select new Event()
                {
                    Id = _news.ElementAnyNS("id") != null ? _news.ElementAnyNS("id").Value : "",
                    Kind = _news.ElementAnyNS("kind") != null ? _news.ElementAnyNS("kind").Value : "",
                    Title = _news.ElementAnyNS("title") != null ? _news.ElementAnyNS("title").Value : "",
                    Date = _news.ElementAnyNS("date") != null ? _news.ElementAnyNS("date").Value : "",
                    Location = _news.ElementAnyNS("location") != null ? _news.ElementAnyNS("location").Value : "",
                    Description = _news.ElementAnyNS("description") != null ? _news.ElementAnyNS("description").Value : "",
                    Contact = _news.ElementAnyNS("contact") != null ? _news.ElementAnyNS("contact").Value : "",
                    Url = _news.ElementAnyNS("url") != null ? _news.ElementAnyNS("url").Value : "",
                    Speakers =
                        (from _speakers in xdoc.Descendants("speakers")
                         select new Contact()
                    {
                        Name = _speakers.ElementAnyNS("name") != null ? _speakers.ElementAnyNS("name").Value : "",
                        Role = _speakers.ElementAnyNS("role") != null ? _speakers.ElementAnyNS("role").Value : "",
                        Bio = _speakers.ElementAnyNS("bio") != null ? _speakers.ElementAnyNS("bio").Value : "",
                        Pictureurl = _speakers.ElementAnyNS("pictureurl") != null ? _speakers.ElementAnyNS("pictureurl").Value : "",
                        Mail = _speakers.ElementAnyNS("mail") != null ? _speakers.ElementAnyNS("mail").Value : "",
                        Phone = _speakers.ElementAnyNS("phone") != null ? _speakers.ElementAnyNS("phone").Value : "",
                        Webaddresses =
                            (from _webaddresses in xdoc.Descendants("webaddresses")
                             select new WebAddress()
                        {
                            Title = _webaddresses.ElementAnyNS("title") != null ? _webaddresses.ElementAnyNS("title").Value : "",
                            Url = _webaddresses.ElementAnyNS("url") != null ? _webaddresses.ElementAnyNS("url").Value : ""
                        }).ToList()
                    }).ToList()
                }).ToList(),
                Activity =
                    (from _activity in xdoc.Descendants("activity")
                     select new Event()
                {
                    Id = _activity.ElementAnyNS("id") != null ? _activity.ElementAnyNS("id").Value : "",
                    Kind = _activity.ElementAnyNS("kind") != null ? _activity.ElementAnyNS("kind").Value : "",
                    Title = _activity.ElementAnyNS("title") != null ? _activity.ElementAnyNS("title").Value : "",
                    Date = _activity.ElementAnyNS("date") != null ? _activity.ElementAnyNS("date").Value : "",
                    Location = _activity.ElementAnyNS("location") != null ? _activity.ElementAnyNS("location").Value : "",
                    Description = _activity.ElementAnyNS("description") != null ? _activity.ElementAnyNS("description").Value : "",
                    Contact = _activity.ElementAnyNS("contact") != null ? _activity.ElementAnyNS("contact").Value : "",
                    Url = _activity.ElementAnyNS("url") != null ? _activity.ElementAnyNS("url").Value : "",
                    Speakers =
                        (from _speakers in xdoc.Descendants("speakers")
                         select new Contact()
                    {
                        Name = _speakers.ElementAnyNS("name") != null ? _speakers.ElementAnyNS("name").Value : "",
                        Role = _speakers.ElementAnyNS("role") != null ? _speakers.ElementAnyNS("role").Value : "",
                        Bio = _speakers.ElementAnyNS("bio") != null ? _speakers.ElementAnyNS("bio").Value : "",
                        Pictureurl = _speakers.ElementAnyNS("pictureurl") != null ? _speakers.ElementAnyNS("pictureurl").Value : "",
                        Mail = _speakers.ElementAnyNS("mail") != null ? _speakers.ElementAnyNS("mail").Value : "",
                        Phone = _speakers.ElementAnyNS("phone") != null ? _speakers.ElementAnyNS("phone").Value : "",
                        Webaddresses =
                            (from _webaddresses in xdoc.Descendants("webaddresses")
                             select new WebAddress()
                        {
                            Title = _webaddresses.ElementAnyNS("title") != null ? _webaddresses.ElementAnyNS("title").Value : "",
                            Url = _webaddresses.ElementAnyNS("url") != null ? _webaddresses.ElementAnyNS("url").Value : ""
                        }).ToList()
                    }).ToList()
                }).ToList(),
                Workshop =
                    (from _workshop in xdoc.Descendants("workshop")
                     select new Event()
                {
                    Id = _workshop.ElementAnyNS("id") != null ? _workshop.ElementAnyNS("id").Value : "",
                    Kind = _workshop.ElementAnyNS("kind") != null ? _workshop.ElementAnyNS("kind").Value : "",
                    Title = _workshop.ElementAnyNS("title") != null ? _workshop.ElementAnyNS("title").Value : "",
                    Date = _workshop.ElementAnyNS("date") != null ? _workshop.ElementAnyNS("date").Value : "",
                    Location = _workshop.ElementAnyNS("location") != null ? _workshop.ElementAnyNS("location").Value : "",
                    Description = _workshop.ElementAnyNS("description") != null ? _workshop.ElementAnyNS("description").Value : "",
                    Contact = _workshop.ElementAnyNS("contact") != null ? _workshop.ElementAnyNS("contact").Value : "",
                    Url = _workshop.ElementAnyNS("url") != null ? _workshop.ElementAnyNS("url").Value : "",
                    Speakers =
                        (from _speakers in xdoc.Descendants("speakers")
                         select new Contact()
                    {
                        Name = _speakers.ElementAnyNS("name") != null ? _speakers.ElementAnyNS("name").Value : "",
                        Role = _speakers.ElementAnyNS("role") != null ? _speakers.ElementAnyNS("role").Value : "",
                        Bio = _speakers.ElementAnyNS("bio") != null ? _speakers.ElementAnyNS("bio").Value : "",
                        Pictureurl = _speakers.ElementAnyNS("pictureurl") != null ? _speakers.ElementAnyNS("pictureurl").Value : "",
                        Mail = _speakers.ElementAnyNS("mail") != null ? _speakers.ElementAnyNS("mail").Value : "",
                        Phone = _speakers.ElementAnyNS("phone") != null ? _speakers.ElementAnyNS("phone").Value : "",
                        Webaddresses =
                            (from _webaddresses in xdoc.Descendants("webaddresses")
                             select new WebAddress()
                        {
                            Title = _webaddresses.ElementAnyNS("title") != null ? _webaddresses.ElementAnyNS("title").Value : "",
                            Url = _webaddresses.ElementAnyNS("url") != null ? _webaddresses.ElementAnyNS("url").Value : ""
                        }).ToList()
                    }).ToList()
                }).ToList()
            });

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ContentProviderResultCallback callback = (ContentProviderResultCallback)result.AsyncState;
                callback(fetchResult.First());
            });
        }
Пример #17
0
 public void LoadData(ContentProviderResultCallback resultCallback, string id)
 {
     httpWebRequest = HttpWebRequest.CreateHttp("http://www.itemis.de/language=de/~xml.applause/" + id);
     httpWebRequest.BeginGetResponse(new AsyncCallback(FetchData), resultCallback);
 }
 public void LoadData(ContentProviderResultCallback resultCallback)
 {
     httpWebRequest = HttpWebRequest.CreateHttp("http://www.itemis.de/language=de/~xml.timeline/37606");
     httpWebRequest.BeginGetResponse(new AsyncCallback(FetchData), resultCallback);
 }
Пример #19
0
 // send url parameters as vararg parameter? might make it easier to generate the code!
 public void LoadData(string name, ContentProviderResultCallback resultCallback)
 {
     httpWebRequest = HttpWebRequest.CreateHttp(BuildDataURL(name));
     httpWebRequest.BeginGetResponse(new AsyncCallback(FetchData), resultCallback);
 }