...
Code Block |
---|
// Request the system status var response = await client.GetSystemStatus(); |
If async calls are not possible in the calling application, the Tsplice client class offers a Sync(..) method that can be used to wrap any client async method:
Code Block |
---|
// Request the system status
var response = TPRI.Tsplice.Client.Sync(() => client.GetSystemStatus()); |
Cancelling Long-Running Requests
Each client method includes an optional cancelToken parameter that can be used to interrupt and cancel a long-running call.
Code Block |
---|
// Create a cancellation source CancelSource = new CancellationTokenSource(); //... try { // RequestDownload thea systembunch statusof tryfiles from the Tsplice {host var response = await client.GetSystemStatus(GetSharedFiles("SharedFolder", "*", "D:\LocalFolder\", CancelSource.Token); } catch (TaskCanceledException) { // Someone called CancelSource.Cancel() before theall callof completed } |
If async calls are not possible in the calling application, the Tsplice client class offers a Sync(..) method that can be used to wrap any client async method:
Code Block |
---|
// Request the systemfiles statuswere vardownloaded response = TPRI.Tsplice.Client.Sync(() => client.GetSystemStatus()); } |
Example
Following is an example usage of the Tsplice client:
...