【发布时间】:2013-12-03 00:49:53
【问题描述】:
如何调用 WCF 并放入以下方法?我在 getSearchCoords() 的 http://kailun92wcf.cloudapp.net/Service1.svc 上有服务。
private void LoadJsonData(object sender, RoutedEventArgs e)
{
//retrieving the results for the keywords the user input
searchError.Text = "Loading... Please Wait";
if (Classes.Global.searched == 1)
{
searchVal = new List<string>();
}
var service = new Service1Client();
service.getSearchCoordsAsync(new getSearchCoordsRequest {searchBar.Text.ToString()});
service.getSearchCoordsCompleted += new EventHandler<MyCloudService.getSearchCoordsCompletedEventArgs>(obj_getSearchCoordsCompleted);
// string data = @"{
//
// ""PageCount"" : ""1"",
// ""SearchResults"": [
// {
// ""SEARCHVAL"": ""ORCHARD22"",
// ""CATEGORY"": ""Building"",
// ""X"": ""29483.4267"",
// ""Y"": ""31269.938""
// },
// {
// ""SEARCHVAL"": ""ORCHARDBELAIR"",
// ""CATEGORY"": ""Building"",
// ""X"": ""27071.2616"",
// ""Y"": ""31629.2465""
// }
// ]
// }";
var pagedResults = JsonConvert.DeserializeObject<TestMap.Classes.Global.ResultSetPager<TestMap.Classes.Global.Place>>(data);
//or lstPlaces
Results.ItemsSource = pagedResults.SearchResults;
}
需要将 svc 中的 json 数据放入结果中以显示在我的 windows phone 上。我该怎么做?
【问题讨论】: