Ejemplo n.º 1
0
        public bool SendText(MachineSendTextCommand command)
        {
            var cmd = new MachineCommand()
            {
                Type    = "ShowText",
                Payload = command.Text
            };

            Console.WriteLine($"Trying to send {JsonConvert.SerializeObject(cmd)} to {this.url}");

            return(this.SendRequest(cmd).Result);
        }
Ejemplo n.º 2
0
        private async Task <bool> SendRequest(MachineCommand 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);
            }
        }
Ejemplo n.º 3
0
        private string GetDesc(int x, int y)
        {
            MachineCommand cmd = GetCmd(x, y);

            return(cmd == null ? "" : cmd.CommandName);
        }
Ejemplo n.º 4
0
 public MoneyController(ISodaMachineDbService sodaMachineDbService)
 {
     _machineCommand = new MachineCommand(sodaMachineDbService.GetDBContext().SodaMachines.First());
     _dbService      = sodaMachineDbService;
 }