Example #1
0
        private void objDownloadJob_TaskBegin(ITask objTask, int intTaskIndex, int intTaskTotal)
        {
            _intTaskIndex = intTaskIndex + 1;

            DownloadRequest objDownloadRequest = (DownloadRequest)objTask;

            this.ThreadSafe(new MethodInvoker(delegate()
            {
                labelOverall.Text = String.Format(labelOverall.Tag.ToString(), objDownloadRequest.SourceFileName, _intTaskIndex.ToString(), _intTaskCount.ToString());

                ListViewItem objListViewItem = listViewStatus.Items[_intTaskIndex - 1];
                if (objListViewItem != null)
                {
                    _blnUpdatePercentages            = true;
                    objListViewItem.SubItems[1].Text = "Downloading";
                    listViewStatus.EnsureVisible(objListViewItem.Index);
                }

                UpdateCurrentProgress(0, 0);

                pathLabelSource.Text = objDownloadRequest.Source;
                pathLabelTarget.Text = objDownloadRequest.Destination;

                timerUpdateProgress.Enabled = true;
            }));
        }
 public DownloadRequestSession(DownloadRequest objDownloadRequest, JobTicket objJobTicket)
     : base()
 {
     DownloadRequest = objDownloadRequest;
     JobTicket       = objJobTicket;
     DownloadStats   = new DownloadStats(objDownloadRequest, objJobTicket.StartTime);
 }
Example #3
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));
        }
Example #4
0
        public override void ReadData(SerializedObject objSerializedObject)
        {
            base.ReadData(objSerializedObject);

            _lngSize           = objSerializedObject.Values.GetValue <long>("Size", 0);
            _lngBytesReceived  = objSerializedObject.Values.GetValue <long>("BytesReceived", 0);
            _lngBytesRemaining = objSerializedObject.Values.GetValue <long>("BytesRemaining", 0);
            _objStartTime      = objSerializedObject.Values.GetValue <DateTime>("StartTime", DateTime.MinValue);
            _objEndTime        = objSerializedObject.Values.GetValue <DateTime>("EndTime", DateTime.MinValue);

            _objDownloadRequest = objSerializedObject.Objects.GetObject <DownloadRequest>("DownloadRequest", null);
            if (_objDownloadRequest == null)
            {
                _objDownloadRequest = DownloadRequest.Empty;
            }
        }
Example #5
0
        public DownloadStats(DownloadRequest objDownloadRequest, DateTime dtStartTime)
            : base()
        {
            if (objDownloadRequest == null)
            {
                throw new ArgumentNullException("objDownloadRequest", "A valid non-null DownloadRequest instance is expected.");
            }

            _objDownloadRequest = objDownloadRequest;
            _objStartTime       = dtStartTime;
            _objEndTime         = DateTime.MaxValue;
            _lngSize            = 0;
            _lngBytesReceived   = 0;
            _lngBytesRemaining  = 0;
            _dblTransferRate    = 0;
        }
Example #6
0
        public override void ReadData(SerializedObject objSerializedObject)
        {
            base.ReadData(objSerializedObject);

            _enuResultType = objSerializedObject.Values.GetValue <TaskResultType>("ResultType", TaskResultType.Unknown);
            _strDetails    = objSerializedObject.Values.GetValue <string>("Details", string.Empty);

            _objDownloadRequest = objSerializedObject.Objects.GetObject <DownloadRequest>("DownloadRequest", null);
            if (_objDownloadRequest == null)
            {
                _objDownloadRequest = DownloadRequest.Empty;
            }

            _objDownloadStats = objSerializedObject.Objects.GetObject <IDownloadStats>("DownloadStats", null);
            if (_objDownloadStats == null)
            {
                _objDownloadStats = ReLi.Framework.Library.Net.DownloadStats.Empty;
            }
        }
Example #7
0
        public DownloadResult(DownloadRequest objDownloadRequest, TaskResultType enuResultType, IDownloadStats objDownloadStats, string strDetails)
            : base()
        {
            if (objDownloadRequest == null)
            {
                throw new ArgumentNullException("objDownloadRequest", "A valid non-null DownloadRequest is expected");
            }
            if (objDownloadStats == null)
            {
                throw new ArgumentNullException("objDownloadStats", "A valid non-null IDownloadStats is expected");
            }
            if (strDetails == null)
            {
                throw new ArgumentNullException("strDetails", "A valid non-null string is expected");
            }

            _objDownloadRequest = objDownloadRequest;
            _objDownloadStats   = objDownloadStats;
            _enuResultType      = enuResultType;
            _strDetails         = strDetails;
        }
Example #8
0
 public DownloadStats(DownloadRequest objDownloadRequest)
     : this(objDownloadRequest, DateTime.Now)
 {
 }
Example #9
0
 public DownloadResultList DownloadWithDialog(DownloadRequest objDownloadRequest)
 {
     return(DownloadWithDialog(objDownloadRequest, new DownloadDialogSettings()));
 }
Example #10
0
 public DownloadResult(DownloadRequest objDownloadRequest, TaskResultType enuResultType, IDownloadStats objDownloadStats)
     : this(objDownloadRequest, enuResultType, objDownloadStats, string.Empty)
 {
 }