public bool InteractWithMachine(MachineInteractionCommand command) { return(this.SendRequest(new MachineCommand() { Type = "ShowStatus", Payload = JsonConvert.SerializeObject(command) }).Result); }
public bool InteractWithMachine(MachineInteractionCommand command) { return(this.SendRequest(new MachineCommand() { Type = "ShowStatus", Payload = command.CommandLevel.ToString() }).Result); }
private async Task <bool> SendRequest(MachineInteractionCommand command) { try{ var client = new HttpClient(); var result = await client.PostAsync(url, new StringContent(JsonConvert.SerializeObject(command), Encoding.UTF8, "application/json")); return(result.StatusCode == HttpStatusCode.OK); } catch (Exception ex) { Console.WriteLine(ex); return(false); } }
public bool InteractWithMachine(MachineInteractionCommand command) { return(this.SendRequest(command).Result); }