Exemple #1
0
        public UploadResultList UploadWithoutDialog(UploadRequestList objUploadRequests)
        {
            if (objUploadRequests == null)
            {
                throw new ArgumentNullException("objUploadRequests", "A valid non-null UploadRequestList is expected");
            }

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

            Job objUploadJob = new Job(objTasks);

            objUploadJob.JobEnd += new Job.OnJobEndDelegate(objUploadJob_JobEnd);
            objUploadJob.Start();
            objUploadJob.Wait();

            UploadResultList objUploadResults = new UploadResultList();

            if (_objJobResult != null)
            {
                foreach (ITaskResult objTaskResult in _objJobResult.TaskResults)
                {
                    UploadResult objUploadResult = (UploadResult)objTaskResult;
                    objUploadResults.Add(objUploadResult);
                }
            }

            return(objUploadResults);
        }
Exemple #2
0
        public UploadResultList UploadWithDialog(UploadRequestList objUploadRequests, UploadDialogSettings objUploadDialogSettings)
        {
            if (objUploadRequests == null)
            {
                throw new ArgumentNullException("objUploadRequests", "A valid non-null UploadRequestList is expected");
            }

            UploadResultList objUploadResults = UploadDialog.ShowDialog(objUploadRequests, objUploadDialogSettings);

            return(objUploadResults);
        }
Exemple #3
0
        private void UploadThread()
        {
            Thread.Sleep(10);

            this.ThreadSafe(new MethodInvoker(delegate()
            {
                listViewStatus.Items.Clear();
                foreach (UploadRequest objUploadRequest in _objUploadRequests)
                {
                    string strFileName           = Path.GetFileName(objUploadRequest.Source);
                    ListViewItem objListViewItem = new ListViewItem(objUploadRequest.Source);
                    objListViewItem.SubItems.Add("Queued");
                    listViewStatus.Items.Add(objListViewItem);
                }

                buttonCancel.Enabled        = _objUploadDialogSettings.AllowCancel;
                buttonPauseContinue.Enabled = _objUploadDialogSettings.AllowPause;
                this.Refresh();
            }));

            _intTaskIndex = 0;
            _intTaskCount = _objUploadRequests.Count;
            _objJobResult = null;

            IEnumerable <ITask> objTasks = _objUploadRequests.GetTasks();

            _objJob                      = new Job(objTasks);
            _objJob.TaskBegin           += new Job.OnTaskBeginDelegate(objUploadJob_TaskBegin);
            _objJob.TaskEnd             += new Job.OnTaskEndDelegate(objUploadJob_TaskEnd);
            _objJob.JobEnd              += new Job.OnJobEndDelegate(objUploadJob_JobEnd);
            _objJob.TaskProgressChanged += new Job.TaskProgressChangedDelegate(objUploadJob_TaskProgressChanged);
            _objJob.Start();
            _objJob.Wait();

            _objUploadResults = new UploadResultList();
            if (_objJobResult != null)
            {
                _objUploadResults = new UploadResultList(_objJobResult.TaskResults);
            }

            Thread.Sleep(10);

            this.ThreadSafe(new MethodInvoker(delegate()
            {
                this.Close();
            }));
        }
Exemple #4
0
        public static UploadResultList ShowDialog(UploadRequestList objUploadRequests, UploadDialogSettings objUploadDialogSettingss)
        {
            if (objUploadRequests == null)
            {
                throw new ArgumentNullException("objUploadRequests", "A valid non-null UploadRequestList is expected");
            }
            if (objUploadDialogSettingss == null)
            {
                throw new ArgumentNullException("objUploadDialogSettingss", "A valid non-null UploadDialogSettings is expected");
            }

            UploadResultList objUploadResults = null;

            using (UploadDialog objFileUploadDialog = new UploadDialog())
            {
                objUploadResults = objFileUploadDialog.ShowDialogWithResult(objUploadRequests, objUploadDialogSettingss);
            }

            return(objUploadResults);
        }