I made a small test about WktReader , found that can not read data from a wcf service!!!
but when I copied the demo file from the example to the project, it can run well!
In my test project I did not modify the other file except the file WktDataViewModel.cs
my WktDataViewModel like this:
but when I copied the demo file from the example to the project, it can run well!
In my test project I did not modify the other file except the file WktDataViewModel.cs
my WktDataViewModel like this:
public
WktDataViewModel()
{
this
.WktDataCollection =
new
Collection<WktDataRow>();
var coll =
new
Collection<WktDataRow>();
Uri xmlUri =
new
Uri(
string
.Concat(Constant.HOST,
"/DataService.svc/ProvinceList/2011"
));
LoaderService.DownloadString(xmlUri, result =>
{
var jarProvince = JArray.Parse(result);
for
(
int
i = 0; i < jarProvince.Count; i++)
{
var obj = (JObject)jarProvince[i];
WktDataRow northAreaDataRow =
new
WktDataRow();
northAreaDataRow.Name = obj[
"name"
].ToString();
northAreaDataRow.Geometry = obj[
"coordinates"
].ToString();
coll.Add(northAreaDataRow);
}
//WktDataCollection = (Collection<WktDataRow>)Newtonsoft.Json.JsonConvert.DeserializeObject(result, typeof(Collection<WktDataRow>));
});
this
.WktDataCollection = coll;
}
and the method DownloadString code is :
public
static
void
DownloadString(Uri uri, Action<
string
> callback)
{
try
{
WebClient wc =
new
WebClient();
wc.DownloadStringAsync(uri);
wc.DownloadStringCompleted += (
object
sender, DownloadStringCompletedEventArgs e) =>
{
try
{
callback(e.Result);
}
catch
(System.Exception ex) { }
};
}
catch
(System.Exception ex) { }
}
this is why? is there anything wrong?
thank you !!
Is there any more demos about use
Sql GeospatialData?