Beispiel #1
0
        /// <summary>
        /// Add Multiple Items to the Queue at once.
        /// </summary>
        /// <param name="addRange">
        /// The add Range.
        /// </param>
        private void AddRangeOfTitles(bool addRange)
        {
            if (!this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNaming))
            {
                MessageBox.Show(
                    "You need to enable 'Auto Naming' in options to use this feature.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            if (this.SourceScan.SouceData == null)
            {
                MessageBox.Show(
                    "You must first scan a source before you can use this feature. Select the 'Source' button on the toolbar.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            bool errors = false;
            if (addRange) // Add Range
            {
                BatchAdd batchAdd = new BatchAdd(this.SourceScan.SouceData);
                if (batchAdd.ShowDialog() == DialogResult.OK)
                {
                    TimeSpan min = batchAdd.Min;
                    TimeSpan max = batchAdd.Max;

                    foreach (Title title in this.SourceScan.SouceData.Titles)
                    {
                        if (title.Duration.TotalSeconds > min.TotalSeconds && title.Duration.TotalSeconds < max.TotalSeconds)
                        {
                            // Add to Queue
                            this.drp_dvdtitle.SelectedItem = title;

                            if (!this.AddItemToQueue(false))
                            {
                                errors = true;
                            }
                        }
                    }
                }
            }
            else // Add All
            {

                string warning = string.Format(
                    "You are about to add *ALL* titles to the queue. \nCurrent settings will be applied to *ALL {0} Titles*. \n\nAre you sure you want to do this?", this.SourceScan.SouceData.Titles.Count);

                DialogResult question =
                    MessageBox.Show(
                        warning,
                        "Warning",
                        MessageBoxButtons.YesNoCancel,
                        MessageBoxIcon.Warning);

                if (question == DialogResult.Yes)
                {
                    foreach (Title title in this.SourceScan.SouceData.Titles)
                    {
                        // Add to Queue
                        this.drp_dvdtitle.SelectedItem = title;

                        if (!this.AddItemToQueue(false))
                        {
                            errors = true;
                        }
                    }
                }
            }

            if (errors)
            {
                MessageBox.Show(
                    "One or more items could not be added to the queue. You should check your queue and manually add any missing jobs.",
                    "Warning",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            }
        }
        /// <summary>
        /// Add Multiple Items to the Queue at once.
        /// </summary>
        /// <param name="sender">The Sender</param>
        /// <param name="e">The EventArgs</param>
        private void MnuAddMultiToQueueClick(object sender, EventArgs e)
        {
            if (!this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNaming))
            {
                MessageBox.Show("Destination Auto Naming must be enabled in preferences for this feature to work.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (this.SourceScan.SouceData == null)
            {
                MessageBox.Show("You must first scan a source or collection of source to use this feature.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            BatchAdd batchAdd = new BatchAdd();
            if (batchAdd.ShowDialog() == DialogResult.OK)
            {
                int min = batchAdd.Min;
                int max = batchAdd.Max;
                bool errors = false;

                foreach (Title title in this.SourceScan.SouceData.Titles)
                {
                    if (title.Duration.TotalMinutes > min && title.Duration.TotalMinutes < max)
                    {
                        // Add to Queue
                        this.drp_dvdtitle.SelectedItem = title;

                        if (!this.AddItemToQueue(false))
                        {
                            errors = true;
                        }
                    }
                }

                if (errors)
                {
                    MessageBox.Show(
                        "One or more items could not be added to the queue. You should check your queue and manually add any missing jobs.",
                        "Warning",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Warning);
                }
            }
        }