private void RunCommand(DriveCommand command) { Action action = async() => { txtCommand.Text = command.ToString(); await _lego.SendCommand(command); }; }
private void RunCommand(DriveCommand command) { Dispatcher.BeginInvoke(async() => { txtCommand.Text = command.ToString(); await _lego.SendCommand(command); }); }
private void WriteMovement(DriveCommand movement) { deleteButtons(); string name = movement.ToString(); var boton = (Button)arrows.FindName(name); boton.Visibility = Visibility.Visible; }
public void SendDriveCommand(DriveCommand command) { Trace.TraceInformation("SendDriveCommand: " + command.ToString()); //call to BeAPI using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://legoev3api.azurewebsites.net/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = client.PostAsJsonAsync("api/values", (int)command).Result; if (response.IsSuccessStatusCode) { var a = response.Headers.Location; } } }
private void TimerElapsed(object state) { //Trace.TraceInformation(DateTime.Now.ToLongTimeString() + ": SignalR Timer Elapsed "); stateCounter++; //Send vote total every 1/2 second Clients.All.sendState(storage.GetState()); //Send command every 3 seconds if (stateCounter >= 6) { //Trace.TraceInformation("Sending to LEGO!"); stateCounter = 0; if (storage.HasCommand()) { DriveCommand cmd = storage.GetMostPopularCommand(); Debug.WriteLine("Popular: " + cmd.ToString()); Clients.All.commandToRun(cmd); storage.Reset(); } } }
public void SendDriveCommand(DriveCommand command) { instance.UpdateVoteCounter(command); Trace.TraceInformation("SendDriveCommand: " + command.ToString()); }
public void SendDriveCommand(DriveCommand command) { Trace.TraceInformation("SignalR received: " + command.ToString()); Clients.All.broadcastDriveCommand(command); }
private void RunCommand(DriveCommand command) { Action action = async () => { txtCommand.Text = command.ToString(); await _lego.SendCommand(command); }; }