Ejemplo n.º 1
0
        private void InitializeQueue(ICollection <CopyPair> items)
        {
            Initialize();
            long queueByteSize = 0;

            foreach (var copyPair in items)
            {
                try
                {
                    queueByteSize += copyPair.SourceInfo.Size;
                }
                catch (Exception ex)
                {
                    _log.ErrorFormat("Error getting size from {0}.", copyPair.SourceInfo.FullName);
                    _log.Error(ex.Message);
                    ReportError(copyPair, ex);
                }
            }
            _queueInfo = new QueueInfo
            {
                ItemCount             = items.Count,
                ItemsCompleteCount    = 0,
                QueueByteSize         = queueByteSize,
                QueueBytesTransferred = 0
            };
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueueProgressChangedEventArgs"/> class.
 /// </summary>
 /// <param name="queueInfo"> QueueInfo from which to get info. </param>
 public QueueProgressChangedEventArgs(QueueInfo queueInfo)
 {
     Size             = queueInfo.QueueByteSize;
     BytesTransferred = queueInfo.QueueBytesTransferred;
     ItemsTotal       = queueInfo.ItemCount;
     ItemsComplete    = queueInfo.ItemsCompleteCount;
 }
Ejemplo n.º 3
0
 protected void OnQueueComplete(QueueInfo queueInfo)
 {
     if (QueueComplete != null)
     {
         var e = new QueueCompleteEventArgs(queueInfo);
         QueueComplete(this, e);
     }
 }
Ejemplo n.º 4
0
        protected void OnQueueProgressChanged(QueueInfo queueInfo)
        {
            if (QueueProgressChanged != null)
            {
                var e = new QueueProgressChangedEventArgs(queueInfo);
                QueueProgressChanged(this, e);
            }

            if (ProgressChanged != null)
            {
                var e = new EventArgs.ProgressChangedEventArgs((int)(queueInfo.QueueBytesTransferred * 100 / Math.Max(1, queueInfo.QueueByteSize)));
                OnProgressChanged(e);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="QueueStartedEventArgs"/> class.
 /// </summary>
 /// <param name="queueInfo"> QueueInfo from which to get info. </param>
 public QueueStartedEventArgs(QueueInfo queueInfo)
 {
     Size       = queueInfo.QueueByteSize;
     ItemsTotal = queueInfo.ItemCount;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueueCompleteEventArgs"/> class.
 /// </summary>
 /// <param name="queueInfo"> QueueInfo from which to get info. </param>
 public QueueCompleteEventArgs(QueueInfo queueInfo)
 {
     Size       = queueInfo.QueueByteSize;
     ItemsTotal = queueInfo.ItemCount;
 }