public void SendCommand(string command) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(ipAddress + @"/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); try { HttpResponseMessage response = client.GetAsync(command).Result; if (response.IsSuccessStatusCode) { VolumeReturnMessage = response.Content.ReadAsAsync <VolumeReturnEnvelope>().Result; } } catch (Exception ex) { System.Diagnostics.Debug.Print(ex.Message); } } }
public void SendCommand(string command) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(ipAddress + @"/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); try { HttpResponseMessage response = client.GetAsync(command).Result; if (response.IsSuccessStatusCode) { VolumeReturnMessage = response.Content.ReadAsAsync<VolumeReturnEnvelope>().Result; } } catch (Exception ex) { System.Diagnostics.Debug.Print(ex.Message); } } }