本文整理汇总了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();
}
示例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)));
}
示例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)
);
}
示例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();
}