void copy_OnCopyProgressChanged(object sender, CopyProgressEventArgs e) { Dispatcher.BeginInvoke((Action)(() => { FileProgress.Value = e.CurrentFileProgress; FileProgressPercent.Text = string.Format("{0}%", e.CurrentFileProgress); })); }
private void _RoboCommand_OnCopyProgressChanged(object sender, CopyProgressEventArgs e) { BeginInvoke((Action)(() => { TaskbarProgress.SetValue(Handle, (int)e.CurrentFileProgress, 100); CurrentFileProgress.Value = (int)e.CurrentFileProgress; })); }
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; } } }
/// <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); }
/// <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("."); }