async protected override void OnNavigatedTo(NavigationEventArgs e) { k++; obj = e.Parameter as jointomap; uname = obj.username; gid = obj.gid; /*MessageDialog m = new MessageDialog(uname + " " + gid); m.ShowAsync();*/ funcparse(); HttpClient httpClient = new HttpClient(); string rad = await httpClient.GetStringAsync(URI + "/getradius?" + "gid=" + gid + "&k=" + k); radius = Convert.ToDouble(rad); }
async protected override void OnNavigatedTo(NavigationEventArgs e) { k++; obj = e.Parameter as jointomap; uname = obj.username; gid = obj.gid; /*MessageDialog m = new MessageDialog(uname + " " + gid); * m.ShowAsync();*/ funcparse(); HttpClient httpClient = new HttpClient(); string rad = await httpClient.GetStringAsync(URI + "/getradius?" + "gid=" + gid + "&k=" + k); radius = Convert.ToDouble(rad); }
private async void button_Click(object sender, RoutedEventArgs e) { string uname = username.Text; string gid = groupid.Text; Geolocator geolocator = new Geolocator(); Geoposition geoposition = null; try { geoposition = await geolocator.GetGeopositionAsync(); } catch (Exception ex) { // Handle errors like unauthorized access to location // services or no Internet access. } double latitude = geoposition.Coordinate.Latitude; double longitude = geoposition.Coordinate.Longitude; double accuracy = geoposition.Coordinate.Accuracy;; var js = new memberdata { username = uname, gid = Int32.Parse(gid), latitude = latitude, longitude = longitude, accuracy = accuracy }; json = JsonConvert.SerializeObject(js); using (HttpClient hc = new HttpClient()) { hc.DefaultRequestHeaders .Accept .Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = await hc.PostAsync(URI, new StringContent(json)); } jointomap obj = new jointomap(); obj.username = uname; obj.gid = gid; this.Frame.Navigate(typeof(membermap), obj); }
private async void button_Click(object sender, RoutedEventArgs e) { string uname = username.Text; string gid = groupid.Text; Geolocator geolocator = new Geolocator(); Geoposition geoposition = null; try { geoposition = await geolocator.GetGeopositionAsync(); } catch (Exception ex) { // Handle errors like unauthorized access to location // services or no Internet access. } double latitude = geoposition.Coordinate.Latitude; double longitude = geoposition.Coordinate.Longitude; double accuracy = geoposition.Coordinate.Accuracy; ; var js = new memberdata { username = uname, gid = Int32.Parse(gid), latitude = latitude, longitude = longitude, accuracy = accuracy }; json = JsonConvert.SerializeObject(js); using (HttpClient hc = new HttpClient()) { hc.DefaultRequestHeaders .Accept .Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = await hc.PostAsync(URI, new StringContent(json)); } jointomap obj = new jointomap(); obj.username = uname; obj.gid = gid; this.Frame.Navigate(typeof(membermap), obj); }