あなたは場所の緯度と経度を取得するには、この無料のREST APIを使用することができ、このREST APIには、Wi-FiをTraingulationに取り組んでいます。
REST API for getting Latitude and Longitude of a place
REST APIの出力に対応したモデルクラスは、直列化復元に使用してください:
今
public class PlaceGeography
{
public string ip { get; set; }
public string country_code { get; set; }
public string country_name { get; set; }
public string region_code { get; set; }
public string region_name { get; set; }
public string city { get; set; }
public string zip_code { get; set; }
public string time_zone { get; set; }
public float latitude { get; set; }
public float longitude { get; set; }
public int metro_code { get; set; }
}
を、単にボットフレームワークであなたのC#コードからGETリクエストを作成し、同様になりますこれは
public async static Task<HttpResponseMessage> GetCoOrdinates()
{
string responseJSON = string.Empty;
PlaceGeography obj = new PlaceGeography();
using (HttpClient client = new HttpClient())
{
string URI = $"http://freegeoip.net/json/";
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
using (HttpResponseMessage msg = await client.GetAsync(URI))
{
if (msg.IsSuccessStatusCode) //if HTTP 200 then
{
responseJSON = await msg.Content.ReadAsStringAsync();
JsonConvert.PopulateObject(responseJSON, obj); // Deserialize model class object and get latitude and longitude
return msg;
}
else
return msg;
}
}
}
どのチャンネルを使用しますか? –
ボットフレームワークエミュレータとフェイスブック –