コード例 #1
0
 void copy_OnCopyProgressChanged(object sender, CopyProgressEventArgs e)
 {
     Dispatcher.BeginInvoke((Action)(() =>
     {
         FileProgress.Value = e.CurrentFileProgress;
         FileProgressPercent.Text = string.Format("{0}%", e.CurrentFileProgress);
     }));
 }
コード例 #2
0
        private void _RoboCommand_OnCopyProgressChanged(object sender, CopyProgressEventArgs e)
        {
            BeginInvoke((Action)(() =>
            {
                TaskbarProgress.SetValue(Handle, (int)e.CurrentFileProgress, 100);

                CurrentFileProgress.Value = (int)e.CurrentFileProgress;
            }));
        }
コード例 #3
0
        private void CopyProgress(CopyProgressEventArgs args)
        {
            switch (args.OperationStatus)
            {
            case OperationStatus.Initiated:
            {
                copyProgressEventArgs = args;
                break;
            }

            case OperationStatus.Inprogress:
            {
                this.Invoke(new MethodInvoker(delegate
                    {
                        copyProgressEventArgs.Aggregated.CountItems++;
                        copyProgressEventArgs.Aggregated.CountSize += args.Aggregated.CountSize;
                        this.progressBarCurrentOperation.Value      = args.CurrentItem.Progress;
                        this.labelCountItems.Text  = copyProgressEventArgs.Initiate.CountItems + "/" + copyProgressEventArgs.Aggregated.CountItems;
                        this.labelSizeItems.Text   = args.Initiate.CountSizeItems.ToHumanReadable() + "/" + copyProgressEventArgs.Aggregated.CountSize.ToHumanReadable();
                        this.labelSource.Text      = args.CurrentItem.SourceItemName.ShrinkPath(80);
                        this.labelDestination.Text = args.CurrentItem.DestinationItemName.ShrinkPath(80);
                        //this.Refresh();
                        if (copyProgressEventArgs.Aggregated.CountItems == copyProgressEventArgs.Initiate.CountItems)
                        {
                            EventAggregator.Instance.UnSubscribe(copyProgressSubscription);
                            //this.Close();
                            //this.Invoke(new MethodInvoker(delegate
                            //{
                            //    this.Close();
                            //}));
                        }
                    }));

                break;
            }

            case OperationStatus.Canceled:
            {
                EventAggregator.Instance.UnSubscribe(copyProgressSubscription);
                this.Invoke(new MethodInvoker(delegate
                    {
                        this.Close();
                    }));
                break;
            }

            case OperationStatus.Ended:
            {
                EventAggregator.Instance.UnSubscribe(copyProgressSubscription);
                this.Invoke(new MethodInvoker(delegate
                    {
                        this.Close();
                    }));
                break;
            }
            }
        }
コード例 #4
0
ファイル: HelperIO.cs プロジェクト: AmirRezaei/SystemManager

        
コード例 #5
0
ファイル: RoboCommand.cs プロジェクト: imcf/auto-tx
        /// <summary>
        /// RoboSharp OnCopyProgressChanged callback handler, triggered every time RoboCopy reports
        /// a change in the copy progress.
        /// Print a log message if the progress has changed for more than 20%.
        /// </summary>
        private void RsProgressChanged(object sender, CopyProgressEventArgs e)
        {
            // e.CurrentFileProgress has the current progress in percent
            // report progress in steps of 20:
            var progress = ((int)e.CurrentFileProgress / 20) * 20;

            if (progress == _txCurFileProgress)
            {
                return;
            }

            _txCurFileProgress = progress;
            _status.TransferredBytesCurrentFile = (long)(_txCurFileSize * e.CurrentFileProgress / 100);
            _status.CurrentTransferPercent      = (int)(
                (_status.TransferredBytesCompleted + _status.TransferredBytesCurrentFile) * 100 /
                _status.CurrentTransferSize);
            Log.Info("Current transfer at {0}%", _status.CurrentTransferPercent);
            Log.Trace("Tx progress: complete [{0}] - current [{1}] - combined {2:0}%",
                      _status.TransferredBytesCompleted, _status.TransferredBytesCurrentFile,
                      _status.CurrentTransferPercent);
            Log.Trace("Current file transfer progress {0}%", progress);
        }
コード例 #6
0
 /// <summary>
 /// Event thats called to provide copy progress of a file
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void rbc_OnCopyProgressChanged(object sender, CopyProgressEventArgs e)
 {
     Console.Write(".");
 }
コード例 #7
0
 void copy_OnCopyProgressChanged(object sender, CopyProgressEventArgs e)
 {
     Dispatcher.BeginInvoke((Action)(() =>
     {
         FileProgress.Value = e.CurrentFileProgress;
         FileProgressPercent.Text = string.Format("{0}%", e.CurrentFileProgress);
     }));
 }