public void SwitchToggle() { using (HttpClient httpClient = new HttpClient()) { var result = httpClient.GetStringAsync(string.Format("{0}/relay/{1}?turn=toggle", Parent.deviceUrl, Id)).Result; RelayTurnResponse response = Newtonsoft.Json.JsonConvert.DeserializeObject <RelayTurnResponse>(result); this.Ison = response.Ison; } }
// public static Relay FromJson(string json) => JsonConvert.DeserializeObject<Relay>(json); private void UpdateRelay(object state) { using (HttpClient httpClient = new HttpClient()) { var result = httpClient.GetStringAsync(string.Format("{0}/relay/{1}", Parent.deviceUrl, Id)).Result; RelayTurnResponse response = Newtonsoft.Json.JsonConvert.DeserializeObject <RelayTurnResponse>(result); this.Ison = response.Ison; } }