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


C# JsonServiceClient.SendAsync方法代码示例

本文整理汇总了C#中JsonServiceClient.SendAsync方法的典型用法代码示例。如果您正苦于以下问题:C# JsonServiceClient.SendAsync方法的具体用法?C# JsonServiceClient.SendAsync怎么用?C# JsonServiceClient.SendAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JsonServiceClient的用法示例。


在下文中一共展示了JsonServiceClient.SendAsync方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            var client = new JsonServiceClient("http://localhost:53353"){UserName = "user1", Password = "password"};
            client.SendAsync(new AwardRequest(), 
                r => Console.WriteLine("Response: " + r.IsSuccess), 
                (r, ex) => Console.WriteLine(ex.Message));

            Console.ReadLine();
        }
开发者ID:arron-green,项目名称:ServiceStack.Example,代码行数:9,代码来源:Program.cs

示例2: Can_call_SendAsync_on_ServiceClient

        public async Task Can_call_SendAsync_on_ServiceClient()
        {
            var jsonClient = new JsonServiceClient(ListeningOn);

            var request = new GetFactorial { ForNumber = 3 };
            var response = await jsonClient.SendAsync<GetFactorialResponse>(request);

            Assert.That(response, Is.Not.Null, "No response received");
            Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(request.ForNumber)));
        }
开发者ID:tystol,项目名称:ServiceStack,代码行数:10,代码来源:AsyncServiceClientTests.cs

示例3: HandleClicked

 void HandleClicked(object sender, EventArgs e)
 {
     var name = NameField.Text;
     var client = new JsonServiceClient("http://127.0.0.1:8080/servicestack");
     client.SendAsync<HelloResponse>(
         new Hello { Name = name },
         (response) => Append(response.Result),
         (response, error) => Append("ERROR: " + error.Message)
     );
 }
开发者ID:defacas,项目名称:TryServiceStack,代码行数:10,代码来源:MainWindow.cs

示例4: HandleClicked

 void HandleClicked(object sender, EventArgs e)
 {
     var name = NameField.Text;
     var client = new JsonServiceClient(ServiceAddressField.Text);
     client.SendAsync<HelloResponse>(
         new Hello { Name = name },
         (response) => Append(response.Result),
         (response, error) => Append("ERROR: " + error.Message)
     );
     NameField.ResignFirstResponder();
 }
开发者ID:defacas,项目名称:TryServiceStack,代码行数:11,代码来源:iPadClientViewController.cs


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