Пример #1
0
        private void BgwRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Result != null)
            {
                var resultObject = e.Result as List <object>;

                var s0       = resultObject[0] as List <SearchDetails>;
                var s1       = resultObject[1] as string;
                var s2       = resultObject[2] as ScanSeries;
                var toAdd    = resultObject[3] as Dictionary <string, ScanSeries>;
                var toRemove = resultObject[4] as List <string>;

                var frmSelectSeries = new FrmSelectSeries(s0, s1);
                frmSelectSeries.ShowDialog();

                if (frmSelectSeries.Cancelled)
                {
                    var seriesname =
                        (from s in ImportTvFactory.SeriesNameList where s.SeriesName == s1 select s).SingleOrDefault();

                    seriesname.Skipped        = true;
                    seriesname.WaitingForScan = false;
                }
                else
                {
                    if (frmSelectSeries.SelectedSeries != null)
                    {
                        ImportTvFactory.ScanSeriesPicks.Add(
                            new ScanSeriesPick
                        {
                            SearchString = s1,
                            SeriesID     = frmSelectSeries.SelectedSeries.SeriesID,
                            SeriesName   = frmSelectSeries.SelectedSeries.SeriesName
                        });
                    }

                    var series = this.theTvdb.OpenNewSeries(frmSelectSeries.SelectedSeries);

                    this.Set(series, toRemove, toAdd, s1, s2);
                }

                frmSelectSeries.Dispose();

                this.ButNextClick(null, null);
            }
            else
            {
                this.Hide();

                var frmNotCatagorized = new FrmNotCatagorized2();
                frmNotCatagorized.ShowDialog();
            }

            DatabaseIOFactory.Save(DatabaseIOFactory.OutputName.ScanSeriesPick);
        }
Пример #2
0
        /// <summary>
        /// Handles the RunWorkerCompleted event of the Bgw control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.ComponentModel.RunWorkerCompletedEventArgs"/> instance containing the event data.</param>
        private void Bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Result != null)
            {
                var resultObject = e.Result as List<object>;

                var s0 = resultObject[0] as List<SearchDetails>;
                var s1 = resultObject[1] as string;
                var s2 = resultObject[2] as ScanSeries;
                var toAdd = resultObject[3] as Dictionary<string, ScanSeries>;
                var toRemove = resultObject[4] as List<string>;

                var frmSelectSeries = new FrmSelectSeries(s0, s1);
                frmSelectSeries.ShowDialog();

                if (frmSelectSeries.Cancelled)
                {
                    var seriesname =
                        (from s in ImportTvFactory.SeriesNameList where s.SeriesName == s1 select s).SingleOrDefault();
                    
                    seriesname.Skipped = true;
                    seriesname.WaitingForScan = false;
                }
                else
                {

                    if (frmSelectSeries.SelectedSeries != null)
                    {
                        var check =
                            (from s in ImportTvFactory.ScanSeriesPicks where s.SearchString == s1 select s).Count() > 0;

                        if (!check)
                        {
                            ImportTvFactory.ScanSeriesPicks.Add(
                                new ScanSeriesPick
                                    {
                                        SearchString = s1,
                                        SeriesID = frmSelectSeries.SelectedSeries.SeriesID,
                                        SeriesName = frmSelectSeries.SelectedSeries.SeriesName
                                    });
                        }
                    }

                    var series = this.theTvdb.OpenNewSeries(frmSelectSeries.SelectedSeries);

                    this.Set(series, toRemove, toAdd, s1, s2);
                }

                frmSelectSeries.Dispose();

                this.ButNext_Click(null, null);
            }
            else
            {
                this.Hide();

                var frmNotCatagorized = new FrmNotCatagorized2();
                frmNotCatagorized.ShowDialog();
            }

            DatabaseIOFactory.Save(DatabaseIOFactory.OutputName.ScanSeriesPick);
        }