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()); } }
private void displayPodcast(Podcast oPodcast, int iWidth, int iHeight) { // Groupbox du podcast GroupBox podcastGroupBox = new GroupBox(); podcastGroupBox.FlatStyle = FlatStyle.Flat; podcastGroupBox.Location = new Point(iWidth, iHeight); //podcastGroupBox.Anchor = (AnchorStyles.Top | AnchorStyles.Left); //podcastGroupBox.TabIndex = 1; //podcastGroupBox.TabStop = true; podcastGroupBox.Width = 700; podcastGroupBox.Height = 70; // Image du Podcast PictureBox podcastImgPictureBox = new PictureBox(); podcastImgPictureBox.Image = Image.FromFile(oPodcast.sImgPath); podcastImgPictureBox.SizeMode = PictureBoxSizeMode.StretchImage; podcastImgPictureBox.Location = new Point(10, 10); podcastImgPictureBox.Width = 61; podcastImgPictureBox.Height = 54; podcastGroupBox.Controls.Add(podcastImgPictureBox); // Nom du Podcast Label podcastNameLabel = new Label(); podcastNameLabel.Text = oPodcast.sName; podcastNameLabel.Font = new Font(podcastNameLabel.Font, FontStyle.Bold); podcastNameLabel.AutoSize = true; //podcastNameLabel.BackColor = Color.Red; podcastNameLabel.Location = new Point(80, 10); podcastGroupBox.Controls.Add(podcastNameLabel); // description Label podcastDescLabel = new Label(); podcastDescLabel.Text = oPodcast.sDesc; podcastDescLabel.AutoSize = true; //podcastDescLabel.BackColor = Color.Green; podcastDescLabel.Location = new Point(80, 35); podcastGroupBox.Controls.Add(podcastDescLabel); // Nombre de podcast non lus podcastGroupBox.Click += new EventHandler((sender1, e1) => groupBox_Click(sender1, e1, podcastGroupBox, oPodcast)); podcastListGroupBox.Controls.Add(podcastGroupBox); }
public List <Podcast> getAllPodcasts() { System.Data.SqlClient.SqlConnection conn = getConnectionData(); List <Podcast> aPodcastsList = new List <Podcast>(); String requete = ""; try { conn.Open(); requete = "SELECT PodcastId " + "FROM Podcasts"; SqlCommand command = new SqlCommand(requete, conn); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Podcast oCurrentPodcast = new Podcast(); oCurrentPodcast.initWithId(Convert.ToInt32(reader["PodcastId"])); aPodcastsList.Add(oCurrentPodcast); } reader.Close(); } catch (Exception ex) { MessageBox.Show("Erreur de connexion à la base de donnée!"); log.Error("--------------------\n" + "Requete: " + requete + "\n" + ex.ToString()); } finally { conn.Close(); } return(aPodcastsList); }
public List<Podcast> getAllPodcasts() { System.Data.SqlClient.SqlConnection conn = getConnectionData(); List<Podcast> aPodcastsList = new List<Podcast>(); String requete = ""; try { conn.Open(); requete = "SELECT PodcastId " + "FROM Podcasts"; SqlCommand command = new SqlCommand(requete, conn); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Podcast oCurrentPodcast = new Podcast(); oCurrentPodcast.initWithId(Convert.ToInt32(reader["PodcastId"])); aPodcastsList.Add(oCurrentPodcast); } reader.Close(); } catch (Exception ex) { MessageBox.Show("Erreur de connexion à la base de donnée!"); log.Error("--------------------\n" + "Requete: " + requete + "\n" + ex.ToString()); } finally { conn.Close(); } return aPodcastsList; }
private void groupBox_Click(object sender, System.EventArgs e, GroupBox podcastGroupBox, Podcast oPodcast) { ListBox podcastEpisodesListBox = new ListBox(); podcastEpisodesListBox.DataSource = oPodcast.getEpisodesNames(); podcastGroupBox.Controls.Add(podcastEpisodesListBox); MessageBox.Show("The click event!"); }