|
264 | 264 | CancellationToken token = cancellationTokenSource.Token; |
265 | 265 |
|
266 | 266 | // Regardless of transfer client, the approach below remains the same. |
| 267 | +
|
| 268 | + // The transfer context object provides several events and supplied to the transfer requests below. |
| 269 | + TransferContext context = new TransferContext(); |
| 270 | + context.TransferPathIssue += (sender, args) => { }; |
| 271 | + context.TransferRequest += (sender, args) => { }; |
| 272 | + context.TransferPathProgress += (sender, args) => { }; |
| 273 | + context.TransferJobRetry += (sender, args) => { }; |
| 274 | + context.TransferStatistics += (sender, args) => { }; |
267 | 275 |
|
268 | 276 | // Get the same workspace specified above to get the default file share. |
269 | 277 | Workspace workspace = await client.GetWorkspaceAsync(token).ConfigureAwait(false); |
|
278 | 286 | }; |
279 | 287 |
|
280 | 288 | // Add all upload transfer path objects to the request. |
281 | | - TransferRequest uploadRequest = TransferRequest.ForUpload(localSourcePath); |
| 289 | + TransferRequest uploadRequest = TransferRequest.ForUpload(localSourcePath, context); |
282 | 290 |
|
283 | 291 | // Submit the request and await completion. |
284 | 292 | ITransferResult uploadResult = await client.TransferAsync(uploadRequest, token).ConfigureAwait(false); |
|
297 | 305 | }; |
298 | 306 |
|
299 | 307 | // Add all download transfer path objects to the request, submit the request, and await completion. |
300 | | - TransferRequest downloadRequest = TransferRequest.ForDownload(remoteSourcePath); |
| 308 | + TransferRequest downloadRequest = TransferRequest.ForDownload(remoteSourcePath, context); |
301 | 309 | ITransferResult downloadResult = await client.TransferAsync(downloadRequest, token).ConfigureAwait(false); |
302 | 310 |
|
303 | 311 | if (downloadResult.Status != TransferStatus.Successful) |
|
0 commit comments