Exemplo n.º 1
0
        private void PreviewPodcatsBtn_Click(object sender, EventArgs e)
        {
            if (podcastUrlTxtBx.Text != "=")
            {
                sPodcastUrl = podcastUrlTxtBx.Text;
            }

            try
            {
                // Récupération du flux RSS
                RssFlow newRss = new RssFlow();
                newRss.create(sPodcastUrl);

                // Gestion des episodes
                Episode oCurrentEpisode;
                List<Episode> aAllEpisodes = new List<Episode>();
                for (int i = 0; i < newRss.items.GetLength(0); i++)
                {
                    if (newRss.items[i, 0] != null)
                    {
                        oCurrentEpisode = new Episode();
                        oCurrentEpisode.iId = 0;
                        oCurrentEpisode.sName = newRss.items[i, 0];
                        oCurrentEpisode.sUrl = newRss.items[i, 2];
                        oCurrentEpisode.sDesc = newRss.items[i, 1];
                        oCurrentEpisode.oDate = Convert.ToDateTime(newRss.items[i, 3]);

                        aAllEpisodes.Add(oCurrentEpisode);
                    }
                }

                // Création de l'objet Podcast
                Podcast oPodcastToDisplay = new Podcast();
                oPodcastToDisplay.initialize(0, newRss.link, newRss.title, newRss.desc, newRss.imageUrl, "", aAllEpisodes);

                //Affichage sur la vue
                pdcstNameTxtBx.Text = oPodcastToDisplay.sName;
                pdcstUrlTxtBx.Text = oPodcastToDisplay.sUrl;
                pdcstDescTxtBx.Text = oPodcastToDisplay.sDesc;
                PodcastEpisodesLstBx.DataSource = oPodcastToDisplay.getEpisodesNames();
                pdcstIconePctex.Image = Image.FromFile(oPodcastToDisplay.sImgPath);
                pdcstIconePctex.SizeMode = PictureBoxSizeMode.StretchImage;

                oCurrentPodcast = oPodcastToDisplay;

                AddPodcatsBtn.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Podcast non trouvé, veuillez verifier l'URL.");
                log.Error("Erreur addPodcast.cs: " + ex.ToString());
            }
        }
Exemplo n.º 2
0
        private void PreviewPodcatsBtn_Click(object sender, EventArgs e)
        {
            if (podcastUrlTxtBx.Text != "=")
            {
                sPodcastUrl = podcastUrlTxtBx.Text;
            }

            try
            {
                // Récupération du flux RSS
                RssFlow newRss = new RssFlow();
                newRss.create(sPodcastUrl);

                // Gestion des episodes
                Episode        oCurrentEpisode;
                List <Episode> aAllEpisodes = new List <Episode>();
                for (int i = 0; i < newRss.items.GetLength(0); i++)
                {
                    if (newRss.items[i, 0] != null)
                    {
                        oCurrentEpisode       = new Episode();
                        oCurrentEpisode.iId   = 0;
                        oCurrentEpisode.sName = newRss.items[i, 0];
                        oCurrentEpisode.sUrl  = newRss.items[i, 2];
                        oCurrentEpisode.sDesc = newRss.items[i, 1];
                        oCurrentEpisode.oDate = Convert.ToDateTime(newRss.items[i, 3]);

                        aAllEpisodes.Add(oCurrentEpisode);
                    }
                }

                // Création de l'objet Podcast
                Podcast oPodcastToDisplay = new Podcast();
                oPodcastToDisplay.initialize(0, newRss.link, newRss.title, newRss.desc, newRss.imageUrl, "", aAllEpisodes);

                //Affichage sur la vue
                pdcstNameTxtBx.Text             = oPodcastToDisplay.sName;
                pdcstUrlTxtBx.Text              = oPodcastToDisplay.sUrl;
                pdcstDescTxtBx.Text             = oPodcastToDisplay.sDesc;
                PodcastEpisodesLstBx.DataSource = oPodcastToDisplay.getEpisodesNames();
                pdcstIconePctex.Image           = Image.FromFile(oPodcastToDisplay.sImgPath);
                pdcstIconePctex.SizeMode        = PictureBoxSizeMode.StretchImage;

                oCurrentPodcast = oPodcastToDisplay;

                AddPodcatsBtn.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Podcast non trouvé, veuillez verifier l'URL.");
                log.Error("Erreur addPodcast.cs: " + ex.ToString());
            }
        }