private async void _server_OnReceived(string data) { // GET 受信 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { textGet.Text = data; }); switch (data) { case "/left/f": motorLeft.Direction = 1; await Task.Delay(1000); // 1秒だけ動かす motorLeft.Direction = 0; break; case "/left/b": motorLeft.Direction = -1; await Task.Delay(1000); // 1秒だけ動かす motorLeft.Direction = 0; break; case "/right/f": motorRight.Direction = 1; await Task.Delay(1000); // 1秒だけ動かす motorRight.Direction = 0; break; case "/right/b": motorRight.Direction = -1; await Task.Delay(1000); // 1秒だけ動かす motorRight.Direction = 0; break; } // 応答を送信 _server.SendResponse("response " + data); }