示例#1
0
        private async void submit_Click(object sender, RoutedEventArgs e)
        {
            string uname = username.Text;
            string rad = radius.Text;

            var js = new UnameRadius { username = uname, rad = Int32.Parse(rad), lat = 13.351320074, lon = 74.79314491152, accurate = 10 };
            json = JsonConvert.SerializeObject(js);

            this.Frame.Navigate(typeof(waiting));

            using (HttpClient hc = new HttpClient())
            {
                hc.DefaultRequestHeaders
                .Accept
                .Add(new MediaTypeWithQualityHeaderValue("application/json"));
                var response = await hc.PostAsync(URI, new StringContent(json));
            }
        }
示例#2
0
        private async void submit_Click(object sender, RoutedEventArgs e)
        {
            string uname = username.Text;
            string rad   = radius.Text;

            var js = new UnameRadius {
                username = uname, rad = Int32.Parse(rad), lat = 13.351320074, lon = 74.79314491152, accurate = 10
            };

            json = JsonConvert.SerializeObject(js);

            this.Frame.Navigate(typeof(waiting));

            using (HttpClient hc = new HttpClient())
            {
                hc.DefaultRequestHeaders
                .Accept
                .Add(new MediaTypeWithQualityHeaderValue("application/json"));
                var response = await hc.PostAsync(URI, new StringContent(json));
            }
        }