本文整理汇总了C#中ServiceClient.CallAsync方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceClient.CallAsync方法的具体用法?C# ServiceClient.CallAsync怎么用?C# ServiceClient.CallAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceClient
的用法示例。
在下文中一共展示了ServiceClient.CallAsync方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCurrentStatus
public async Task<ReportingOperationStatus> GetCurrentStatus(ServiceClient<IReportingService> reportingServiceClient)
{
var request = new PollGenerateReportRequest {ReportRequestId = _requestId,};
var response = await reportingServiceClient.CallAsync((s, r) => s.PollGenerateReportAsync(r), request).ConfigureAwait(false);
return new ReportingOperationStatus
{
TrackingId = response.TrackingId,
Status = response.ReportRequestStatus.Status,
ResultFileUrl = response.ReportRequestStatus.ReportDownloadUrl,
};
}
示例2: SubmitDownloadAsyncImpl
private async Task<ReportingDownloadOperation> SubmitDownloadAsyncImpl(ReportRequest request)
{
var submitRequest = new SubmitGenerateReportRequest {ReportRequest = request,};
SubmitGenerateReportResponse response;
using (var apiService = new ServiceClient<IReportingService>(_authorizationData))
{
response = await apiService.CallAsync((s, r) => s.SubmitGenerateReportAsync(r), submitRequest).ConfigureAwait(false);
}
return new ReportingDownloadOperation(response.ReportRequestId, _authorizationData, response.TrackingId) {StatusPollIntervalInMilliseconds = StatusPollIntervalInMilliseconds};
}
示例3: AddImageAsync
private async Task<long> AddImageAsync(AuthorizationData authorizationData)
{
var media = new List<Media>();
var image = new Image();
// This example uses an image with 1.5:1 aspect ratio.
// For more information about available aspect ratios and min / max dimensions,
// see the Image data object reference documentation on MSDN.
image.Data = GetImage15x10Data();
image.Type = "Image15x10";
image.MediaType = "Image";
media.Add(image);
var request = new AddMediaRequest
{
Media = media
};
var Service = new ServiceClient<ICampaignManagementService>(authorizationData);
return (await Service.CallAsync((s, r) => s.AddMediaAsync(r), request)).MediaIds[0];
}
示例4: RunAsync
//.........这里部分代码省略.........
| | |
| | +-- All other (Brand)
| |
| +-- All other (CategoryL2)
|
+-- Electronics (CategoryL1)
| |
| +-- Brand C (Brand)
| |
| +-- Brand D (Brand)
| |
| +-- All other (Brand)
|
+-- All other (CategoryL1)
*/
OutputStatusMessage(
"The product partition group tree now has 12 nodes, including the children of Electronics (CategoryL1): \n"
);
OutputProductPartitions(productPartitions);
#endregion UpdateTree
var Service = new ServiceClient<ICampaignManagementService>(authorizationData);
var getCampaignIds = new List<long>();
getCampaignIds.Add((long)campaignResults[0].Campaign.Id);
var request = new GetCampaignsByIdsRequest
{
AccountId = authorizationData.AccountId,
CampaignIds = getCampaignIds,
CampaignType = CampaignType.Shopping
};
await Service.CallAsync((s, r) => s.GetCampaignsByIdsAsync(r), request);
#region CleanUp
/* Delete the campaign, ad group, criterion, and ad that were previously added.
* You should remove this region if you want to view the added entities in the
* Bing Ads web application or another tool.
*/
var campaignId = campaignResults[0].Campaign.Id;
bulkCampaign = new BulkCampaign
{
Campaign = new Campaign
{
Id = campaignId,
Status = CampaignStatus.Deleted
}
};
uploadEntities = new List<BulkEntity>();
uploadEntities.Add(bulkCampaign);
// Write the upload output
Reader = await UploadEntities(uploadEntities);
bulkEntities = Reader.ReadEntities().ToList();
campaignResults = bulkEntities.OfType<BulkCampaign>().ToList();
OutputBulkCampaigns(campaignResults);
Reader.Dispose();
OutputStatusMessage(String.Format("Deleted CampaignId {0}\n", campaignResults[0].Campaign.Id));
#endregion Cleanup
示例5: SubmitDownloadAsyncImpl
private async Task<ReportingDownloadOperation> SubmitDownloadAsyncImpl(ReportRequest request)
{
var submitRequest = new SubmitGenerateReportRequest {ReportRequest = request,};
SubmitGenerateReportResponse response;
using (var apiService = new ServiceClient<IReportingService>(_authorizationData, _apiEnvironment))
{
try
{
response = await apiService.CallAsync((s, r) => s.SubmitGenerateReportAsync(r), submitRequest).ConfigureAwait(false);
}
catch (Exception e)
{
throw new CouldNotSubmitReportingDownloadException("Submit download operation failed.", e);
}
}
return new ReportingDownloadOperation(response.ReportRequestId, _authorizationData, response.TrackingId, _apiEnvironment) {StatusPollIntervalInMilliseconds = StatusPollIntervalInMilliseconds};
}