private void ShowFilePath(bool showPath) { foreach (ListViewItem item in lvSoundFiles.Items) { Songs theSong = BLSongs.GetSongById((long)item.Tag); if (showPath) { item.Text = theSong.SongFilePath; } else { item.Text = theSong.SongFileName; } } }
private void btnPreview_Click(object sender, EventArgs e) { if (lvSoundFiles.SelectedItems.Count == 1) { Songs selectedSong = BLSongs.GetSongById((long)lvSoundFiles.SelectedItems[0].Tag); BLIO.Log("Attempting to preview sound file with id " + selectedSong.Id); if (btnPreview.Iconimage == imgPlay) { if (System.IO.File.Exists(selectedSong.SongFilePath)) { BLIO.Log("Sound file exists on the hard drive"); btnPreview.Iconimage = imgStop; myPlayer.URL = selectedSong.SongFilePath; mediaInfo = myPlayer.newMedia(myPlayer.URL); //Start the timer. the timer ticks when the song ends. The timer will then reset the picture of the play button if (mediaInfo.duration > 0) { tmrMusic.Interval = (int)(mediaInfo.duration * 1000); } else { tmrMusic.Interval = 1000; } tmrMusic.Start(); myPlayer.controls.play(); BLIO.Log("Playing sound."); } else { RemindMeMessageFormManager.MakeMessagePopup("Could not preview the selected song. Does it still exist?", 4); } } else { BLIO.Log("Stopping sound"); btnPreview.Iconimage = imgPlay; myPlayer.controls.stop(); tmrMusic.Stop(); } } }
private void btnRemoveFiles_Click(object sender, EventArgs e) { List <Songs> toRemoveSongs = new List <Songs>(); foreach (ListViewItem selectedItem in lvSoundFiles.SelectedItems) { toRemoveSongs.Add(BLSongs.GetSongById(Convert.ToInt32(selectedItem.Tag))); lvSoundFiles.Items.Remove(selectedItem); } BLSongs.RemoveSongs(toRemoveSongs); if (toRemoveSongs.Count > 0) { RemindMeMessageFormManager.MakeMessagePopup(toRemoveSongs.Count + " Files removed from RemindMe.", 4); } }