private void removeSubscription(PodcastSubscription PS) { if (!Locked) { List <frmTaskDialog.Option> options = new List <frmTaskDialog.Option>(); options.Add(new frmTaskDialog.Option("Remove Entire Podcast", "Remove the subscription and delete all downloaded tracks from my library.", 1)); options.Add(new frmTaskDialog.Option("Unsubscribe Only", "Remove the subscription but don't delete any downloaded tracks.", 2)); options.Add(new frmTaskDialog.Option("Cancel", "Leave the podcast subscription in place.", 0)); frmTaskDialog od = new frmTaskDialog("Remove Podcast Subscription", "Choose options for removing a podcast:", options); od.ShowDialog(this); switch (od.ResultIndex) { case 1: removeSubscriptionFromListView(PS); PS.DeleteSubscriptionFiles(InvalidateAll); break; case 2: removeSubscriptionFromListView(PS); PS.Close(InvalidateAll); break; default: break; } } }
public void DownloadNewEpisodes() { List <PodcastEpisode> ppe; lock (episodeLock) { ppe = episodes.ToList(); } if (ppe.Count > 0) { ppe.Sort((a, b) => b.Date.CompareTo(a.Date)); ppe = ppe.TakeWhile(p => p.DownloadStatus == PodcastDownloadStatus.NotDownloaded).ToList(); foreach (PodcastEpisode pe in ppe) { PodcastSubscription.Download(pe); } if (DataChanged != null) { DataChanged(this); } } }
private void downloadSubscription(PodcastSubscription PS) { if (!this.Locked) { Clock.DoOnNewThread(PS.DownloadThisSubscription); } }
public QPodcastDetails(PodcastSubscription Subscription, Callback Done) : base() { this.ps = Subscription; this.doneCallback = Done; lblTitle = new QLabel("Title"); lblURL = new QLabel("URL"); lblGenre = new QLabel("Mark New Episodes with Genre"); txtTitle = new QTextBox(); txtTitle.Width = 1000; // prevent scrolling when text set txtTitle.Text = ps.Name; txtURL = new QTextBox(); txtURL.Text = ps.URL; btnOK = new QButton("Save", false, false); btnCancel = new QButton("Cancel", false, false); AddButton(btnOK, ok); AddButton(btnCancel, cancel); cboGenre = new QComboBox(true); List <string> genres = Database.GetGenres(); if (!genres.Contains(ps.DefaultGenre, StringComparer.OrdinalIgnoreCase)) { genres.Add(ps.DefaultGenre); } genres.Sort(); cboGenre.Items.AddRange(genres.ToArray()); cboGenre.SelectedIndex = genres.FindIndex(g => String.Compare(g, ps.DefaultGenre, StringComparison.OrdinalIgnoreCase) == 0); this.Controls.Add(lblTitle); this.Controls.Add(lblURL); this.Controls.Add(txtTitle); this.Controls.Add(txtURL); this.Controls.Add(lblGenre); this.Controls.Add(cboGenre); buttonWidth = Math.Max(btnOK.Width, btnCancel.Width); btnOK.Width = buttonWidth; btnCancel.Width = buttonWidth; this.Height = calcHeight(); int tabIndex = 0; lblTitle.TabIndex = tabIndex++; txtTitle.TabIndex = tabIndex++; lblURL.TabIndex = tabIndex++; txtURL.TabIndex = tabIndex++; lblGenre.TabIndex = tabIndex++; cboGenre.TabIndex = tabIndex++; btnOK.TabIndex = tabIndex++; btnCancel.TabIndex = tabIndex++; setWrapAroundTabControl(tabIndex, txtTitle, null); }
private void removeSubscriptionFromListView(PodcastSubscription PS) { if (PS == lvwSubscriptions.SelectedItem) { lvwEpisodes.Clear(); } lvwSubscriptions.RemoveItem(PS); }
private void populateEpisodes(PodcastSubscription p) { if (p != null) { txtURL.Text = p.URL; p.PopulateAndSortWithNewEpisodes(lvwEpisodes); InvalidateAll(); } }
private void addPendingSubscription() { PodcastSubscription p = pendingPodcastSubscription; pendingPodcastSubscription = null; lvwSubscriptions.AddItem(p, true, true); lvwSubscriptions.SelectedItem = p; lvwSubscriptions.EnsureSelectedItemVisible(); setupSubscriptionDataChangedCallback(p); populateEpisodes(p); }
private void downloadEpisode(PodcastEpisode PE) { if (PE.IsQueuedOrDownloading) { PodcastSubscription.CancelDownload(PE); } else { Clock.DoOnNewThread(PE.QueueForDownload); } }
private static void setupSubscriptionDataChangedCallback(PodcastSubscription PS) { PS.DataChanged += (s) => { instance.lvwSubscriptions.InvalidateThreadSafe(); if (PS == instance.lvwSubscriptions.SelectedItem) { instance.lvwEpisodes.InvalidateThreadSafe(); } Clock.DoOnMainThread(instance.updateStopDownloadButtonEnable); }; }
public override bool Equals(object obj) { PodcastSubscription other = obj as PodcastSubscription; if (other == null) { return(false); } else { return(String.Compare(this.URL, other.URL, StringComparison.OrdinalIgnoreCase) == 0); } }
public void DownloadLatestEpisode() { PodcastEpisode pe = this.LatestEpisode; if (pe != null && pe.IsQueueable) { PodcastSubscription.Download(pe); if (DataChanged != null) { DataChanged(this); } } }
private void lvwSubscriptions_ContextMenuHook(ContextMenuStrip ContextMenu, PodcastSubscription PS) { ToolStripMenuItem tsi = new ToolStripMenuItem("&Restore Deleted Episode Entries"); tsi.Click += (s, ee) => { List <PodcastEpisode> ppe = PS.Episodes.ToList(); foreach (PodcastEpisode pe in ppe) { if (pe.IsDeleted) { if (pe.Track == null) { pe.SetDownloadStatus(PodcastDownloadStatus.NotDownloaded); } else { pe.SetDownloadStatus(PodcastDownloadStatus.Unplayed); } } } if (lvwSubscriptions.SelectedItem == PS) { populateEpisodes(PS); } }; tsi.Enabled = PS.HasDeletedEpisodes; ContextMenu.Items.Add(tsi); tsi = new ToolStripMenuItem("Check for New Episodes"); tsi.Click += (s, ee) => { checkForNewEpisodes(PS); //PS.UpdateEpisodeInfo(); //if (lvwSubscriptions.SelectedItem == PS) // populateEpisodes(PS); }; ContextMenu.Items.Add(tsi); ContextMenu.Items.Add(new ToolStripSeparator()); tsi = new ToolStripMenuItem("Visit Podcast Web Site..."); tsi.Click += (s, ee) => { Net.BrowseTo(PS.ReferenceURL); }; tsi.Enabled = PS.ReferenceURL.Length > 0; ContextMenu.Items.Add(tsi); }
private void lvwEpisodes_DoubleClickCallback(PodcastEpisode SelectedItem) { if (!Locked) { if (SelectedItem.Playable) { Controller.GetInstance().Play(SelectedItem); } else { PodcastSubscription.Download(SelectedItem); lvwEpisodes.Invalidate(); } } }
private void showSubscriptionEditPanel(PodcastSubscription PS) { if (!this.Locked) { if (PS != null) { this.Locked = true; pnlSubscriptionDetails = new QPodcastDetails(PS, removePanel); this.Controls.Add(pnlSubscriptionDetails); Clock.DoOnMainThread(arrangeControls); keyPreviewChange(); pnlSubscriptionDetails.Focus(); } } }
public void DownloadThisSubscription() { List <PodcastEpisode> ppe; lock (episodeLock) { ppe = this.episodes.FindAll(e => !e.IsDeleted); } ppe.Sort((a, b) => (b.Date.CompareTo(a.Date))); foreach (PodcastEpisode pe in ppe) { PodcastSubscription.Download(pe); } if (DataChanged != null) { DataChanged(this); } }
public PodcastEpisode(string Title, string GUID, string Description, string URL, DateTime Date, int Duration, DateTime DownloadDate, PodcastDownloadStatus DownloadStatus, Track Track, PodcastSubscription Subscription) { this.Title = Title; this.GUID = GUID; this.Description = Description; this.Date = Date; this.Duration = Duration; this.URL = URL; this.DownloadStatus = DownloadStatus; this.Subscription = Subscription; this.DownloadDate = DownloadDate; this.Track = Track; updateDisplayValues(); }
private void go() { if (lvwSubscriptions.HasItem(s => String.Compare(s.URL, txtURL.Text.Trim(), StringComparison.OrdinalIgnoreCase) == 0)) { Controller.ShowPriorityMessage("Podcast subscription already loaded."); } else { Controller.ShowPriorityMessage("Downloading podcast information..."); PodcastSubscription p = new PodcastSubscription(txtURL.Text.Trim()); if (p.Loaded) { pendingPodcastSubscription = p; Clock.DoOnMainThread(addPendingSubscription); Controller.ShowPriorityMessage("Podcast information downloaded."); } else { Controller.ShowPriorityMessage("Podcast audio information not found."); } } }
private void stopDownloads() { PodcastSubscription.StopDownloads(); InvalidateAll(); Controller.ShowMessage("Podcast downloads stopped."); }
public void QueueForDownload() { PodcastSubscription.Download(this); }
private void lvwSubscriptions_DoubleClickCallback(PodcastSubscription SelectedItem) { checkForNewEpisodes(SelectedItem); }
private void checkForNewEpisodes(PodcastSubscription PS) { Controller.ShowMessage("Checking for podcast updates..."); Clock.DoOnNewThread(PS.UpdateEpisodeInfo); }