private void OnTapped(string identifier, int tapcode) { if (tapcode.ToString() == "A")///forward { BtnA.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (tapcode.ToString() == "E")///backward { BtnS.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (tapcode.ToString() == "I")///left { BtnD.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (tapcode.ToString() == "O")///right { BtnW.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (tapcode.ToString() == "U")///steer forward { BtnForward.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (tapcode.ToString() == "T")///stop { BtnSpace.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } }
//-------------------------- // ROBOT'S CONTROLS //-------------------------- /// Keyboard events private void key_event(object sender, KeyEventArgs e) { switch (e.Key) { case Key.A: //forward BtnA.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); break; case Key.E: //backward BtnS.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); break; case Key.I: //left BtnD.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); break; case Key.O: //right BtnW.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); break; case Key.T: //stop BtnSpace.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); break; case Key.U: //steer forward BtnForward.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); break; } }