private void lvwEpisodes_ContextMenuHook(ContextMenuStrip ContextMenu, PodcastEpisode Item) { ToolStripMenuItem tsi = new ToolStripMenuItem("Play"); tsi.Click += (s, ee) => { playEpisode(Item); }; tsi.Enabled = Item.Playable; ContextMenu.Items.Add(tsi); tsi = new ToolStripMenuItem("&Find in Library"); tsi.Click += (s, ee) => { controller.ShowTrack(Item.Track, true); }; tsi.Enabled = Item.Track != null; ContextMenu.Items.Add(tsi); ContextMenu.Items.Add(new ToolStripSeparator()); tsi = new ToolStripMenuItem("Mark As"); ToolStripMenuItem tsi2 = new ToolStripMenuItem("Unplayed"); tsi2.Click += (s, ee) => { Item.SetDownloadStatus(PodcastDownloadStatus.Unplayed); }; tsi2.Enabled = (Item.DownloadStatus == PodcastDownloadStatus.Played); tsi.DropDownItems.Add(tsi2); tsi2 = new ToolStripMenuItem("Played"); tsi2.Click += (s, ee) => { Item.SetDownloadStatus(PodcastDownloadStatus.Played); }; tsi2.Enabled = (Item.DownloadStatus == PodcastDownloadStatus.Unplayed); tsi.DropDownItems.Add(tsi2); ContextMenu.Items.Add(tsi); }
public static void Download(PodcastEpisode PE) { cancelDownload = false; if (PE != null && PE.IsDownloadable) { PE.SetDownloadStatus(PodcastDownloadStatus.QueuedForDownload); lock (syncQueueLock) { if (!syncQueue.Contains(PE)) { syncQueue.Add(PE); Clock.DoOnNewThread(startSync, 100); } } } }
private void removeEpisode(PodcastEpisode PE) { List <frmTaskDialog.Option> options = new List <frmTaskDialog.Option>(); if (PE.Playable || PE.IsDownloading) // only ask if there's already some data { options.Add(new frmTaskDialog.Option("Remove Podcast Entry", "Remove this episode from the episode list but leave the audio file in your library.", 1)); options.Add(new frmTaskDialog.Option("Remove All", "Remove this episode from the list and delete the audio file.", 2)); options.Add(new frmTaskDialog.Option("Cancel", "Don't remove this episode.", 0)); frmTaskDialog od = new frmTaskDialog("Remove Podcast Episode", "Choose an option for removing a podcast episode:", options); od.ShowDialog(this); switch (od.ResultIndex) { case 0: return; case 1: break; case 2: if (PE.Track != null) { Database.RemoveFromLibrary(new List <Track>() { PE.Track }); TrackWriter.AddToDeleteList(PE.Track.FilePath); TrackWriter.DeleteItems(); PE.Track = null; } break; } } PE.SetDownloadStatus(PodcastDownloadStatus.Deleted); lvwEpisodes.RemoveItem(PE); }