Exemple #1
0
        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;
                }
            }
        }
Exemple #2
0
        private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (podCastManager.DownloadInProgress && e.CloseReason != CloseReason.WindowsShutDown)
            {
                List <frmTaskDialog.Option> options = new List <frmTaskDialog.Option>();
                options.Add(new frmTaskDialog.Option("Stop Podcast Download", "QuuxPlayer will exit.", 0));
                options.Add(new frmTaskDialog.Option("Continue Podcast Download", "QuuxPlayer will not exit.", 1));
                frmTaskDialog td = new frmTaskDialog("Podcast Download in Progress", "A podcast download is in progress. Do you want to quit anyway?", options);
                td.ShowDialog(this);
                switch (td.ResultIndex)
                {
                case 1:
                    e.Cancel = true;
                    break;
                }
            }

            // mnuMain is disabled if a panel is showing
            if (Locked && mnuMain.Enabled && e.CloseReason == CloseReason.UserClosing)
            {
                e.Cancel = true;
            }
            if (!e.Cancel)
            {
                this.Visible = false;

                SingletonApp.Close();
                controller.Close();

                Lib.ScreenSaverIsActive = screenSaverWasActive;
                closed = true;
            }
        }
Exemple #3
0
        public void ReloadStations()
        {
            List <frmTaskDialog.Option> options = new List <frmTaskDialog.Option>();

            options.Add(new frmTaskDialog.Option("Add back default stations", "Leave any additions or changes I have made in place.", 0));
            options.Add(new frmTaskDialog.Option("Replace all existing stations with defaults", "The station list will revert to the original list.", 1));
            options.Add(new frmTaskDialog.Option("Cancel", "Don't change my station list.", 2));

            frmTaskDialog td = new frmTaskDialog(Localization.Get(UI_Key.Radio_Restore_Default_Stations_Title),
                                                 Localization.Get(UI_Key.Radio_Restore_Default_Stations),
                                                 options);

            td.ShowDialog(this);

            switch (td.ResultIndex)
            {
            case 0:
                RadioStations = RadioStation.DefaultList.Union(RadioStations).ToList();
                break;

            case 1:
                RadioStations = RadioStation.DefaultList;
                break;

            default:
                return;
            }

            //QCheckedMessageBox mb = new QCheckedMessageBox(this,
            //                                               Localization.Get(UI_Key.Radio_Restore_Default_Stations),
            //                                               Localization.Get(UI_Key.Radio_Restore_Default_Stations_Title),
            //                                               QMessageBoxButtons.OKCancel,
            //                                               QMessageBoxIcon.Question,
            //                                               QMessageBoxButton.YesOK,
            //                                               Localization.Get(UI_Key.Radio_Restore_Default_Stations_Checkbox),
            //                                               false);
            //if (mb.DialogResult == DialogResult.OK)
            //{
            //    if (mb.Checked)
            //    {
            //        RadioStations = RadioStation.DefaultList;
            //    }
            //    else
            //    {
            //        RadioStations = RadioStation.DefaultList.Union(RadioStations).ToList();
            //    }

            SelectedStation = null;

            txtFilter.Text   = String.Empty;
            genrePanel.Value = String.Empty;

            sort();
            populateStations();
            populateGenres();
            invalidateAll();
            //}
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        public void RemoveTracks()
        {
            List <Track> tq = SelectedTracks;

            if (tq.Count > 0)
            {
                int i = trackList.FirstSelectedIndex;

                if (NondynamicPlaylistBasedView)
                {
                    Database.RemoveFromPlaylist(ActivePlaylist, tq);
                    foreach (Track t in tq)
                    {
                        t.Selected = false;
                    }
                }
                else
                {
                    // TODO: Localize

                    frmTaskDialog td;
                    List <frmTaskDialog.Option> options = new List <frmTaskDialog.Option>();

                    // Singular

                    if (tq.Count == 1)
                    {
                        options.Add(new frmTaskDialog.Option("Remove from library only", "Remove the track from my QuuxPlayer library but leave the file where it is on my hard drive.", 0));
                        options.Add(new frmTaskDialog.Option("Remove and recycle", "Remove the track from QuuxPlayer and also send the file to the Windows recycle bin.", 1));
                        options.Add(new frmTaskDialog.Option("Cancel", "Don't remove the file.", 2));

                        td = new frmTaskDialog("Remove Track?", "Remove \"" + tq[0].ToShortString() + "\" from library?", options);
                    }
                    else
                    {
                        options.Add(new frmTaskDialog.Option("Remove from library only", "Remove the tracks from my QuuxPlayer library but leave the files where they are on my hard drive.", 0));
                        options.Add(new frmTaskDialog.Option("Remove and recycle", "Remove the tracks from QuuxPlayer and also send the files to the Windows recycle bin.", 1));
                        options.Add(new frmTaskDialog.Option("Cancel", "Don't remove the files.", 2));

                        td = new frmTaskDialog("Remove Tracks?", "Remove " + tq.Count.ToString() + " tracks from library?", options);
                    }

                    td.ShowDialog(this);

                    switch (td.ResultIndex)
                    {
                    case 0:
                        Database.RemoveFromLibrary(tq);
                        break;

                    case 1:
                        Database.RemoveFromLibrary(tq);
                        TrackWriter.RecycleFiles(tq);
                        break;

                    default:
                        return;
                    }

                    //cmb = new QCheckedMessageBox(mainForm, text, "Remove Track?", QMessageBoxButtons.YesNo, QMessageBoxIcon.Question, QMessageBoxButton.NoCancel, Localization.Get(UI_Key.General_Also_Recycle), false);

                    //if (cmb.DialogResult == DialogResult.OK)
                    //{
                    //    Database.RemoveFromLibrary(tq);
                    //    if (cmb.Checked)
                    //    {
                    //        TrackWriter.RecycleFiles(tq);
                    //    }
                    //}
                    //else
                    //{
                    //    return;
                    //}
                    //}
                    //else
                    //{
                    //    DialogResult dr;

                    //    if (tq.Count == 1)
                    //        dr = QMessageBox.Show(mainForm, "Remove \"" + tq[0].ToShortString() + "\" from library?", "Remove Track?", QMessageBoxButtons.YesNo, QMessageBoxIcon.Question, QMessageBoxButton.NoCancel);
                    //    else
                    //        dr = QMessageBox.Show(mainForm, "Remove " + tq.Count.ToString() + " tracks from library?", "Remove Tracks?", QMessageBoxButtons.YesNo, QMessageBoxIcon.Question, QMessageBoxButton.NoCancel);

                    //    if (dr == DialogResult.OK)
                    //        Database.RemoveFromLibrary(tq);
                    //    else
                    //        return;
                    //}
                }
                RefreshAll(false);

                if (i < TrackCount)
                {
                    SelectTrack(i, false, true, true);
                }
                else if (TrackCount > 0)
                {
                    SelectTrack(TrackCount - 1, false, true, true);
                }
            }
        }
Exemple #6
0
        protected override void ok()
        {
            if (createDir())
            {
                this.Enabled = false;

                saveSettings();

                string r = complexify(root());

                List <Track> outsideTracks = Database.FindAllTracks(t => !((oldRoot.Length > 0 && t.FilePath.StartsWith(oldRoot, StringComparison.OrdinalIgnoreCase)) || (t.FilePath.StartsWith(r, StringComparison.OrdinalIgnoreCase))));
                List <Track> tracks        = Database.LibrarySnapshot;

                foreach (Track t in tracks)
                {
                    t.ChangeType |= (ChangeType.Move | ChangeType.IgnoreContainment);
                }

                System.Diagnostics.Debug.WriteLine("num: " + tracks.Count(t => (t.ChangeType & ChangeType.IgnoreContainment) != 0));

                if (outsideTracks.Any(t => t.ConfirmExists))
                {
                    List <frmTaskDialog.Option> options = new List <frmTaskDialog.Option>();
                    options.Add(new frmTaskDialog.Option("Move all my files", "All files in your library will be relocated within the top folder. (Files on different drives than your top folder's drive will be copied instead of moved.)", 0));
                    options.Add(new frmTaskDialog.Option("Don't move outside files", "Only files already under the top folder will be organized.", 1));
                    options.Add(new frmTaskDialog.Option("Cancel", "Go back to the organizer panel.", 2));

                    frmTaskDialog td = new frmTaskDialog(Localization.Get(UI_Key.Organize_Move_Files_Title),
                                                         Localization.Get(UI_Key.Organize_Move_Files),
                                                         options);

                    System.Diagnostics.Debug.WriteLine("num: " + tracks.Count(t => (t.ChangeType & ChangeType.IgnoreContainment) != 0));

                    td.ShowDialog(this);

                    switch (td.ResultIndex)
                    {
                    case 0:
                        break;

                    case 1:
                        foreach (Track t in outsideTracks)
                        {
                            t.ChangeType &= ~ChangeType.IgnoreContainment;
                        }
                        break;

                    case 2:
                        this.Enabled = true;
                        txtDirectory.Focus();
                        return;
                    }
                }

                foreach (Track t in tracks)
                {
                    t.RenameFormat = renameFormat;
                    if (renameFormat != TrackWriter.RenameFormat.None)
                    {
                        t.ChangeType |= ChangeType.Rename;
                    }
                }

                TrackWriter.AddToUnsavedTracks(tracks);

                done();
            }
        }