private void btEnregistrer_Click(object sender, EventArgs e) { string monTitre = tbTitre.Text; //récupère info string monInterprete = tbInterprète.Text; int maDuree = Convert.ToInt16(nudDurée.Text); Chanson maChanson = new Chanson(); //Créé une Chanson maChanson.SetTitre(monTitre); maChanson.SetInterprete(monInterprete); maChanson.SetDuree(maDuree); MesOutils.EffacerZonesDeTexte(this); maPlaylist.AjouterChanson(maChanson); //Ajoute dans l'ArrayList }
//Méthodes spécifiques de cette classe public void AjouterChanson(Chanson uneChanson) { playlist.Add(uneChanson); }
//Mutateurs public void SetChanson(Chanson uneChanson) { chanson = uneChanson; }
/* Interface */ // Récupérer objet serialisé public Playlist(SerializationInfo info, StreamingContext ctxt) { chanson = (Chanson)info.GetValue("Chanson", typeof(Chanson)); playlist = (List <Chanson>)info.GetValue("Playlist", typeof(List <Chanson>)); }