Example #1
0
        internal void Ended(DownloadInfo downloadInfo, HowEnded howEnded, bool retry)
        {
            lock (this)
            {
                this.current.Remove(downloadInfo);

                bool b1 = success.Contains(downloadInfo);
                bool b2 = failWithoutRetry.Contains(downloadInfo);
                bool b3 = failedButRetried.Contains(downloadInfo);

                if (!b1 && !b2 && !b3)
                {
                    switch (howEnded)
                    {
                    case HowEnded.SUCCESS:
                    {
                        success.Add(downloadInfo);
                        this.progressTracker.OneDownloadHasFinished();
                        break;
                    }

                    case HowEnded.FAIL:
                    {
                        this.progressTracker.OneDownloadHasFailed(retry);

                        if (retry)
                        {
                            failedButRetried.Add(downloadInfo);
                        }
                        else
                        {
                            failWithoutRetry.Add(downloadInfo);
                        }
                        break;
                    }

                    case HowEnded.NOT_ENDED_YET:
                        break;
                    }
                }

                for (int i = 0; i < 3; i++)
                {
                    if (this.current.GetCount() < this.maxCurrent && waiting.GetCount() > 0)
                    {
                        DownloadInfo p = this.waiting.GetAndRemoveFirst();
                        if (p != null)
                        {
                            Add2(p);
                        }
                    }
                }
            }
        }
Example #2
0
        private void MoreInfo(HowEnded howEnded)
        {
            DownloadInfoList r = null;

            switch (howEnded)
            {
            case HowEnded.SUCCESS:
                r = this.downloadForm.downloadPool.success;
                break;

            case HowEnded.FAIL:
                r = this.downloadForm.downloadPool.failWithoutRetry;
                break;

            case HowEnded.NOT_ENDED_YET:
                r = this.downloadForm.downloadPool.current;
                break;
            }

            if (r == null || r.GetCount() == 0)
            {
                if (StartupForm.IsItalian)
                {
                    MessageBox.Show("Nessun risultato!");
                }
                else
                {
                    MessageBox.Show("No results!");
                }
                return;
            }

            ResultsListForm resultsListForm = new ResultsListForm(r, howEnded);

            resultsListForm.Show();
        }