Skip to content

Commit

Permalink
new progress API
Browse files Browse the repository at this point in the history
  • Loading branch information
robinrodricks committed Oct 11, 2019
1 parent 0e2e1c2 commit 1f5151c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion FluentFTP/Helpers/FtpProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace FluentFTP {
/// <summary>
/// Class to report Ftp Transfer Progress (Up and Donwload)
/// Class to report FTP file transfer progress during upload or download of files
/// </summary>
public class FtpProgress {
/// <summary>
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ To use this, first create a callback method to provide to the Upload/Download me

If you are creating your UI in WinForms, create a `ProgressBar` with the `Minimum` = 0 and `Maximum` = 100.

*Using the asynchronous API:*
```cs
// Callback method that accepts a FtpProgress object
Progress<FtpProgress> progress = new Progress<FtpProgress>(x => {
Expand All @@ -813,6 +814,21 @@ Progress<FtpProgress> progress = new Progress<FtpProgress>(x => {
});
```

*Using the synchronous API:*
```cs
// Callback method that accepts a FtpProgress object
Action<FtpProgress> progress = new Action<FtpProgress>(x => {

// When progress in unknown, -1 will be sent
if (x.Progress < 0){
progressBar.IsIndeterminate = true;
}else{
progressBar.IsIndeterminate = false;
progressBar.Value = x;
}
});
```

Now call the Upload/Download method providing the new `progress` object that you just created.

*Using the asynchronous API:*
Expand Down

0 comments on commit 1f5151c

Please sign in to comment.