private async void PlayButtonClick(object sender, MouseButtonEventArgs e) { if (FilePath.StartsWith("http") || File.Exists(FilePath)) { if (player.FileLoaded) { player.Queue.Clear(); } await player.PlayAsync(FilePath); } else { notificationHandler.Add(new Handlers.Notifications.Notification { ContentText = string.Format(Properties.Resources.NOTIFICATION_FILEGONE, FilePath), ButtonText = "Remove from library", OnButtonClicked = () => { library.Remove(FilePath); ((ListBox)Parent).Items.Remove(this); return(true); }, Type = NotificationType.Failure }); } }
public void SaveChanges(List <string> filePaths) { foreach (string path in filePaths) { var track = new Track(path) { Artist = ArtistBox.Text, Title = TitleBox.Text, Album = AlbumBox.Text, Genre = GenreBox.Text, Year = Convert.ToInt32(YearBox.Text), AlbumArtist = AlbumArtistBox.Text, Composer = ComposerBox.Text, TrackNumber = Convert.ToInt32(TrackNumBox.Text), DiscNumber = Convert.ToInt32(DiscNumBox.Text), Lyrics = new LyricsInfo() }; track.Lyrics.UnsynchronizedLyrics = UntimedLyricsBox.Text; track.EmbeddedPictures.Clear(); foreach (var cover in CoverArts) { track.EmbeddedPictures.Add(cover); } track.Save(); library?.Remove(path); // update library entry, if available library?.Import(path); } }