Exemplo n.º 1
0
        private void GetFilesToDownload()
        {
            try
            {
                osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient();

                // Set the web service url
                ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(PlayerConfiguration.configVodigiWebserviceURL));
 
                string xml = ws.Player_GetMediaToDownload(PlayerConfiguration.configAccountID);
                downloads = new List<Download>();
                images = new List<Image>();
                videos = new List<Video>();
                musics = new List<Music>();
 
                XDocument xmldoc = XDocument.Parse(xml);
 
                images = (from Image in xmldoc.Descendants("Image") 
                          select new Image
                           {
                              ImageID = Convert.ToInt32(Image.Attribute("ImageID").Value),
                              StoredFilename = Convert.ToString(Image.Attribute("StoredFilename").Value),
                              ImageName = Utility.DecodeXMLString(Image.Attribute("ImageName").Value),
                          }
                ).ToList();
 
                videos = (from Video in xmldoc.Descendants("Video")
                          select new Video
                          {
                              VideoID = Convert.ToInt32(Video.Attribute("VideoID").Value),
                              StoredFilename = Convert.ToString(Video.Attribute("StoredFilename").Value),
                              VideoName = Utility.DecodeXMLString(Video.Attribute("VideoName").Value)
                          }
 
                ).ToList();
 
                musics = (from Music in xmldoc.Descendants("Music") 
                          select new Music
                          {
                              MusicID = Convert.ToInt32(Music.Attribute("MusicID").Value),
                              StoredFilename = Convert.ToString(Music.Attribute("StoredFilename").Value),
                              MusicName = Utility.DecodeXMLString(Music.Attribute("MusicName").Value),
                          }
 
                ).ToList();
 
                foreach (Image image in images)
                {
                    Download download = new Download();
                    download.FileType = "Image";
                    download.StoredFilename = image.StoredFilename;
                    downloads.Add(download);
                }
 
                foreach (Video video in videos)
                {
                    Download download = new Download();
                    download.FileType = "Video";
                    download.StoredFilename = video.StoredFilename;
                    downloads.Add(download);
                }
 
                foreach (Music music in musics)
                {
                    Download download = new Download();
                    download.FileType = "Music";
                    download.StoredFilename = music.StoredFilename;
                    downloads.Add(download);
                }
            }
            catch { } 
        }
Exemplo n.º 2
0
        private void GetFilesToDownload()
        {
            try
            {
                osVodigiWS.osVodigiServiceSoapClient ws = new osVodigiWS.osVodigiServiceSoapClient();

                // Set the web service url
                ws.Endpoint.Address = new System.ServiceModel.EndpointAddress(new Uri(PlayerConfiguration.configVodigiWebserviceURL));

                string xml = ws.Player_GetMediaToDownload(PlayerConfiguration.configAccountID);
                downloads = new List <Download>();
                images    = new List <Image>();
                videos    = new List <Video>();
                musics    = new List <Music>();

                XDocument xmldoc = XDocument.Parse(xml);

                images = (from Image in xmldoc.Descendants("Image")
                          select new Image
                {
                    ImageID = Convert.ToInt32(Image.Attribute("ImageID").Value),
                    StoredFilename = Convert.ToString(Image.Attribute("StoredFilename").Value),
                    ImageName = Utility.DecodeXMLString(Image.Attribute("ImageName").Value),
                }
                          ).ToList();

                videos = (from Video in xmldoc.Descendants("Video")
                          select new Video
                {
                    VideoID = Convert.ToInt32(Video.Attribute("VideoID").Value),
                    StoredFilename = Convert.ToString(Video.Attribute("StoredFilename").Value),
                    VideoName = Utility.DecodeXMLString(Video.Attribute("VideoName").Value)
                }

                          ).ToList();

                musics = (from Music in xmldoc.Descendants("Music")
                          select new Music
                {
                    MusicID = Convert.ToInt32(Music.Attribute("MusicID").Value),
                    StoredFilename = Convert.ToString(Music.Attribute("StoredFilename").Value),
                    MusicName = Utility.DecodeXMLString(Music.Attribute("MusicName").Value),
                }

                          ).ToList();

                foreach (Image image in images)
                {
                    Download download = new Download();
                    download.FileType       = "Image";
                    download.StoredFilename = image.StoredFilename;
                    downloads.Add(download);
                }

                foreach (Video video in videos)
                {
                    Download download = new Download();
                    download.FileType       = "Video";
                    download.StoredFilename = video.StoredFilename;
                    downloads.Add(download);
                }

                foreach (Music music in musics)
                {
                    Download download = new Download();
                    download.FileType       = "Music";
                    download.StoredFilename = music.StoredFilename;
                    downloads.Add(download);
                }
            }
            catch { }
        }