Example #1
0
 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);
 }
Example #3
0
        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);
            }
        }
Example #4
0
 public bool InteractWithMachine(MachineInteractionCommand command)
 {
     return(this.SendRequest(command).Result);
 }