public IObservable<GeoIp> getGeoLocation(String IP) { WebClient wc = new WebClient(); var result = wc.DownloadStringTaskAsync(new Uri("http://freegeoip.net/xml/" + IP)).ToObservable(); return result.Select(x => { XDocument xDoc = XDocument.Parse(x); var res = new GeoIp() { Ip = IP, Lat = Convert.ToDouble((string)xDoc.Root.Element("Latitude")), Long = Convert.ToDouble((string)xDoc.Root.Element("Longitude")) }; return res; }); }
public void SendLocation(GeoIp ip) { // Call the addNewMessageToPage method to update clients. Clients.All.SendLocation(ip); }
public static void SendIp(GeoIp ip) { GetGeoHub().SendMessage(ip); }
public void SendMessage(GeoIp ip) { hubProxy.Invoke("SendLocation", ip).Wait(); }
public void TestEF() { using (var db = new RepoEF()) { var geoIp = new GeoIp() { Ip = "66.249.76.78", Lat = 37, Long = -122 }; db.GeoIps.Add(geoIp); db.SaveChanges(); // Display all Blogs from the database var query = from b in db.GeoIps orderby b.Ip select b; Debug.WriteLine("All geoips in the database:"); foreach (var item in query) { Debug.WriteLine(item.Ip); } } Debug.WriteLine("Done..."); }