当前位置: 首页>>代码示例>>C#>>正文


C# ServiceClient.CallAsync方法代码示例

本文整理汇总了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,
                   };
        }
开发者ID:BingAds,项目名称:BingAds-dotNet-SDK,代码行数:13,代码来源:ReportingStatusProvider.cs

示例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};
        }
开发者ID:moinahmed,项目名称:BingAds-dotNet-SDK,代码行数:12,代码来源:ReportingServiceManager.cs

示例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];
        }
开发者ID:BingAds,项目名称:BingAds-dotNet-SDK,代码行数:22,代码来源:AdExtensions.cs

示例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
开发者ID:moinahmed,项目名称:BingAds-dotNet-SDK,代码行数:67,代码来源:BulkShoppingCampaigns.cs

示例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};
        }
开发者ID:shyTNT,项目名称:BingAds-dotNet-SDK,代码行数:19,代码来源:ReportingServiceManager.cs


注:本文中的ServiceClient.CallAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。