private async void dispatcherTimer_Tick(object sender, object args) { if (connection != null) { try { var command = GamepadService.GetCurrentCommand(); if (command != null) { if (lastCommand != command) { Debug.WriteLine(command); lastCommand = command.Value; } var task = this.SendCommandAsync(command.ToString()); } } catch (Exception ex) { await this.ShowErrorAsync(ex); } } }
private async Task SendRoverCommandAsync(RoverMovementType command) { using (var client = new RestClient(SERVICE_URL)) { try { await client.PostAsync("rover/move", new RoverMovement { Movement = command }); } catch (Exception ex) { var dialog = new MessageDialog($"Error sending commnad: {ex.Message}"); await dialog.ShowAsync(); } } }
public RoverMovement(RoverMovementType movement) { Movement = movement; }
private async Task SendRoverCommandAsync(RoverMovementType command) { using (var client = new RestClient(SERVICE_URL)) { try { await client.PostAsync("rover/move", new RoverMovement { Movement = command }); } catch (Exception ex) { var dialog = new MessageDialog($"Error sending commnad: {ex.Message}"); await dialog.ShowAsync(); } } }