protected override async void OnNavigatedTo(NavigationEventArgs e) { client = e.Parameter as Client; await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () => { try { status_message.Text = client.Status_message; top_Name.Text = client.Nickname; BitmapImage bi = await Convert_module.convert_base64_to_bitmapImage(client.Profile_image); profile_image.Fill = new ImageBrush { ImageSource = bi }; } catch(Exception err) { Debug.WriteLine(err); } }); Debug.WriteLine("{0} , {1} , {2}", client.Nickname, client.Phone_number, client.Status_message); bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.RunWorkerAsync(); }
public void add_client(string id) { Client new_client = new Client(id); clients.Add(new_client); this.client_num++; }
public static async Task request_client_more_info(Client client) { try { string url = "http://40.76.6.186:8888/member_find/likeable"; var httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url); httpWebRequest.ContentType = "application/json; charset=utf-8"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(await httpWebRequest.GetRequestStreamAsync())) { //object to json StringBuilder sb = new StringBuilder(); JsonWriter jw = new JsonTextWriter(new StringWriter(sb)); jw.Formatting = Formatting.Indented; jw.WriteStartObject(); jw.WritePropertyName("id"); jw.WriteValue(client.Id); jw.WriteEndObject(); streamWriter.Write(sb.ToString()); streamWriter.Flush(); } var httpResponse = (HttpWebResponse)await httpWebRequest.GetResponseAsync(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { var result = await streamReader.ReadToEndAsync(); client.setClient_more_info(result); Debug.WriteLine("more_info success"); } } catch (Exception ex) { // Need to convert int HResult to hex string Debug.WriteLine("Error = " + ex.HResult.ToString("X") + " Message: " + ex.Message); } }