Exemplo n.º 1
0
        public PlaylistItem(String itemPath)
        {
            FileInfo fileInfo = new FileInfo(itemPath);
            if (!fileInfo.Exists)
            {
                throw new FileNotFoundException("The file was not found.", path);
            }
            name = fileInfo.Name;
            this.path = itemPath;

            try
            {
                TagLib.File f = TagLib.File.Create(path);
                BitmapImage bitmap = new BitmapImage();
                TagLib.IPicture pic = f.Tag.Pictures[0];
                MemoryStream ms = new MemoryStream(pic.Data.Data);
                bitmap.BeginInit();
                bitmap.StreamSource = ms;
                bitmap.EndInit();
                this.coverImage = bitmap;
                this.album = f.Tag.Album;
                this.title = f.Tag.Title;
                this.artist = f.Tag.AlbumArtists[0];
            }
            catch
            {
                Tool tool = new Tool();
                this.coverImage = new BitmapImage(new Uri(tool.imgPath + "unknown_artist_cover.jpg"));
                this.album = "Album Inconnu";
                this.title = "Titre Inconnu";
                this.artist = "Artiste Inconnu";
            }
        }
Exemplo n.º 2
0
 public MainWindow()
 {
     InitializeComponent();
     playlist = new Playlist(playlistBox);
     mediaModel = new MediaModel(mediaGrid.Margin);
     tool = new Tool();
     mediaModel.timerVideo.Tick += new EventHandler(timer_tick);
     volumeSlider.Maximum = 1;
     volumeSlider.Value = 1;
 }