Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //find location in gps xong roi . . .
- string search_string = Convert.ToString(geoposition.Coordinate.Lat...)+","+Convert.ToString(geoposition.Coordinate.Lon...)
- string link1 = "http://127.0.0.1/phoneserver/traficjam.php?local=" + search_string;
- HttpClient httpClient1 = new HttpClient();
- string HTMLCode1 = await httpClient1.GetStringAsync(link1);
- if (HTMLCode1 == "1" || HTMLCode1 == "")
- {
- MessageDialog msgbox = new MessageDialog("Find location fail! or locaiton not exist");
- await msgbox.ShowAsync();
- }
- else
- {// khuc nay moi ne` -----------------------------
- List<double> lat = new List<double>();
- List<double> lon = new List<double>();
- List<string> time = new List<string>();
- string code = HTMLCode1;
- while (code.IndexOf("|") > 0)
- {
- lat.Add(double.Parse(code.Substring(0, code.IndexOf("_"))));
- lon.Add(double.Parse(code.Substring(code.IndexOf("_") + 1, code.IndexOf("=") - code.IndexOf("_") - 1)));
- time.Add(Convert.ToString(code.Substring(code.IndexOf("=") + 1, code.IndexOf("|") - code.IndexOf("=") - 1)));
- code = code.Substring(code.IndexOf("|") + 1, code.Length - code.IndexOf("|") - 1);
- }
- for (int j = 0; j < lat.Count; j++)
- {
- var trafic = new Geopoint(new BasicGeoposition() { Latitude = lat[j], Longitude = lon[j] });
- if (time[j] != "needhelp")
- {
- setPositionIcon(trafic, "ms-appx:///Assets/pin.png", "Have " + time[j] + " say trafic jam.");// hien icon traficjam
- }
- else
- {
- setPositionIcon(trafic, "ms-appx:///Assets/SplashScreen.scale-240.png", "Help someone in here!");// hien icon need help!
- }
- }
- }
- //roi TrySetViewAsync
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement