Beispiel #1
0
        public DownloadResultList DownloadWithoutDialog(DownloadRequestList objDownloadRequests)
        {
            if (objDownloadRequests == null)
            {
                throw new ArgumentNullException("objDownloadRequests", "A valid non-null DownloadRequestList is expected");
            }

            _objJobResult = null;
            IEnumerable <ITask> objTasks = objDownloadRequests.GetTasks();

            Job objDownloadJob = new Job(objTasks);

            objDownloadJob.JobEnd += new Job.OnJobEndDelegate(objDownloadJob_JobEnd);
            objDownloadJob.Start();
            objDownloadJob.Wait();

            DownloadResultList objDownloadResults = new DownloadResultList();

            if (_objJobResult != null)
            {
                foreach (ITaskResult objTaskResult in _objJobResult.TaskResults)
                {
                    DownloadResult objDownloadResult = (DownloadResult)objTaskResult;
                    objDownloadResults.Add(objDownloadResult);
                }
            }

            return(objDownloadResults);
        }
Beispiel #2
0
        public DownloadResultList DownloadWithoutDialog(DownloadRequest objDownloadRequest)
        {
            if (objDownloadRequest == null)
            {
                throw new ArgumentNullException("objDownloadRequest", "A valid non-null DownloadRequest is expected");
            }

            DownloadRequestList objDownloadRequests = new DownloadRequestList();

            objDownloadRequests.Add(objDownloadRequest);

            return(DownloadWithoutDialog(objDownloadRequests));
        }
Beispiel #3
0
        protected DownloadResultList ShowDialogWithResult(DownloadRequestList objDownloadRequests, DownloadDialogSettings objDownloadDialogSettings)
        {
            _objDownloadRequests       = objDownloadRequests;
            _objDownloadDialogSettings = objDownloadDialogSettings;

            ThreadStart objThreadStart = new ThreadStart(DownloadThread);

            _objDownloadThread = new Thread(objThreadStart);
            _objDownloadThread.IsBackground = true;
            _objDownloadThread.Start();

            this.ShowDialog();

            return(_objDownloadResults);
        }
Beispiel #4
0
        public DownloadResultList DownloadWithDialog(DownloadRequestList objDownloadRequests, DownloadDialogSettings objDownloadDialogSettings)
        {
            if (objDownloadRequests == null)
            {
                throw new ArgumentNullException("objDownloadRequests", "A valid non-null DownloadRequestList is expected");
            }
            if (objDownloadDialogSettings == null)
            {
                throw new ArgumentNullException("objDownloadDialogSettings", "A valid non-null DownloadDialogSettings is expected");
            }

            DownloadResultList objDownloadResults = DownloadDialog.ShowDialog(objDownloadRequests, objDownloadDialogSettings);

            return(objDownloadResults);
        }
Beispiel #5
0
        public static DownloadResultList ShowDialog(DownloadRequestList objDownloadRequests, DownloadDialogSettings objDownloadDialogSettings)
        {
            if (objDownloadRequests == null)
            {
                throw new ArgumentNullException("objDownloadRequests", "A valid non-null DownloadRequestList is expected");
            }
            if (objDownloadDialogSettings == null)
            {
                throw new ArgumentNullException("objDownloadDialogSettings", "A valid non-null DownloadDialogSettings is expected");
            }

            DownloadResultList objDownloadResults = null;

            using (DownloadDialog objFileDownloadDialog = new DownloadDialog())
            {
                objDownloadResults = objFileDownloadDialog.ShowDialogWithResult(objDownloadRequests, objDownloadDialogSettings);
            }

            return(objDownloadResults);
        }
Beispiel #6
0
 public DownloadResultList DownloadWithDialog(DownloadRequestList objDownloadRequests)
 {
     return(DownloadWithDialog(objDownloadRequests, new DownloadDialogSettings()));
 }