// Evenement de sauvegarde appelé quand on appuie sur le boutton de sauvegarde. la liste sera sauvegardée et une fenetre s'ouvrira pour indiquer à l'utilisateur qu"elle a bien eue lieu
        private void On_Saved(object sender, RoutedEventArgs e)
        {
            ConfirmWindowSave confirmWindowSave = new ConfirmWindowSave();
            PersistanceXml    ser = new PersistanceXml();

            ser.Serialize(LAlbum as LibraryAlbum);
            confirmWindowSave.ShowDialog();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Starts the app.
        /// </summary>
        public void Start()
        {
            int valid;

            _view.DisplayText("Bienvenue dans la gestion d'album !");

            var serdes  = new PersistanceXml();
            var library = new LibraryAlbum();
            var al1     = new Album("12345", "Black album", "Metallica", "Trash", 1991);
            var m1      = new Track("Nothing else matter", 5, 10, "Metallica", "Black album", "Power ballad", 1991, 1);

            var al2 = new Album("12346", "Ok Computer", "Radiohead", "Art rock", 1997);
            var m2  = new Track("Karma Police", 4, 33, "Radiohead", "Ok Computer", "Rock", 1997, 1);
            var m3  = new Track("Exit music(for a film)", 5, 22, "Radiohead", "Ok Computer", "Rock", 1997, 1);

            al1.AddTrack(m1);
            al2.AddTrack(m2);
            al2.AddTrack(m3);
            al1.TimeCalculator();
            al2.TimeCalculator();
            library.AddAlbum(al2);
            library.AddAlbum(al1);
            var  playlist = new Playlist();
            var  aff      = playlist.AddTrack("12346", "Karma Police", library);
            int  hour1    = 0;
            Time time1    = playlist.TimeCalculator(ref hour1);

            _view.DisplayTimeList(time1, hour1);
            do
            {
                valid = _view.DisplayMenu();

                switch (valid)
                {
                case 1:
                    _view.DisplayText("Voici la liste des albums enregistrés\nClé de l'album :\tTitre de l'album :\tDurée :\t\tArtist :\tGenre :\t\tAnnée :");
                    DisplayListAlbum(library);
                    break;

                //OK
                case 2:
                    ViewAlbum(library);
                    break;

                //OK
                case 3:
                    CreateAlbum(library);
                    break;

                //OK
                case 4:
                    DeleteAlb(library);
                    break;

                //OK
                case 5:
                    UpdateAlbum(library);
                    break;

                //OK
                case 6:
                    DeleteTrackLib(library);
                    break;

                //ok
                case 7:
                    AddTrackLib(library);
                    break;

                // ok
                case 8:
                    library = new LibraryAlbum(serdes.Deserialize());
                    break;

                //pas ok
                case 9:
                    serdes.Serialize(library);
                    break;

                //pas ok
                case 10:
                    AddTrackInList(library, playlist);
                    break;

                case 11:
                    DisplayPlaylist(playlist);
                    break;

                case 12:
                    ListBy(library);
                    break;

                case 13:
                    PlayListSorting(playlist);
                    break;

                default:
                    _view.DisplayText("Saisie incorrect !");
                    break;
                }
            } while (valid != 14);
        }