Monitor transfer progress in real-time using observables or the managed monitor for UI binding.
IHttpTransferManager manager; // injected
Console.WriteLine($"Transfer: {result.Request.Identifier}");
Console.WriteLine($"Status: {result.Status}");
Console.WriteLine($"Progress: {result.Progress.PercentComplete:P0}");
Console.WriteLine($"Speed: {result.Progress.BytesPerSecond} B/s");
Console.WriteLine($"ETA: {result.Progress.EstimatedTimeRemaining}");
.WatchTransfer("upload-1")
Console.WriteLine($"Progress: {result.Progress.PercentComplete:P0}");
Console.WriteLine($"Failed: {error.Message}");
Console.WriteLine("Transfer completed!");
Console.WriteLine($"Active transfers: {count}");
| Property | Type | Description |
|---|
Request | HttpTransferRequest | The original request |
Status | HttpTransferState | Current transfer state |
Progress | TransferProgress | Progress details |
Exception | Exception? | Error details if failed |
| Property | Type | Description |
|---|
BytesPerSecond | long | Current transfer speed |
BytesToTransfer | long? | Total bytes (null if indeterminate) |
BytesTransferred | long | Bytes transferred so far |
PercentComplete | double | 0-1 range, or -1 if indeterminate |
EstimatedTimeRemaining | TimeSpan | Estimated completion time |
| Value | Description |
|---|
Pending | Queued, waiting to start |
InProgress | Currently transferring |
Paused | Paused by user/system |
PausedByNoNetwork | Paused due to no network |
PausedByCostedNetwork | Paused due to metered network |
Completed | Successfully completed |
Error | Failed with error |
Canceled | Cancelled by user |
HttpTransferMonitor provides an observable collection ideal for binding to UI.
HttpTransferMonitor monitor; // injected (registered by AddHttpTransfers)
// Bind to the collection
var transfers = monitor.Transfers; // INotifyReadOnlyCollection<HttpTransferObject>
// Each HttpTransferObject has:
// - Identifier, Uri, Type
// - Status, PercentComplete, BytesPerSecond
// - BytesToTransfer, BytesTransferred
// - EstimatedTimeRemaining, IsDeterministic
// Clear completed/errored transfers from the list
monitor.Clear(removeFinished: true, removeCancelled: true, removeErrors: true);