Пример #1
0
        public static async Task <PlaylistFeed> GetPlaylistAsync()
        {
            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("https://www.rgrfm.be/rgr_dance/apps/playlist.php"));
                request.ContentType = "application/xhtml+xml";
                request.Method      = "GET";

                using (var response = await request.GetResponseAsync())
                {
                    using (var stream = response.GetResponseStream())
                    {
                        string content;
                        using (var reader = new StreamReader(stream))
                        {
                            content = reader.ReadToEnd();
                        }

                        var result = XmlSerializerService.Deserialize(content);
                        return(PlaylistFeed.FromXmlContract(result));
                    }
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
Пример #2
0
        public void PlaylistFeedConstructorTest()
        {
            Uri          uriBase  = null; // TODO: Initialize to an appropriate value
            IService     iService = null; // TODO: Initialize to an appropriate value
            PlaylistFeed target   = new PlaylistFeed(uriBase, iService);

            Assert.IsNotNull(target);
        }
Пример #3
0
        public void CreateFeedEntryTest()
        {
            Uri           uriBase  = null;                                // TODO: Initialize to an appropriate value
            IService      iService = null;                                // TODO: Initialize to an appropriate value
            PlaylistFeed  target   = new PlaylistFeed(uriBase, iService); // TODO: Initialize to an appropriate value
            PlaylistEntry entry    = target.CreateFeedEntry() as PlaylistEntry;

            Assert.IsNotNull(entry);
        }
Пример #4
0
 public void OnTaskComplete(PlaylistFeed playlist)
 {
     if (playlist == null)
     {
         return;
     }
     RunOnUiThread(() =>
     {
         _textViewSong1.Text = $"{playlist.Playlist[0].Artist} - {playlist.Playlist[0].Title}";
         _textViewSong2.Text = $"{playlist.Playlist[1].Artist} - {playlist.Playlist[1].Title}";
         _textViewSong3.Text = $"{playlist.Playlist[2].Artist} - {playlist.Playlist[2].Title}";
     });
 }