public virtual void Bind(Beagle robot, Joystick joystick) { if (robot == null) throw new ArgumentNullException("robot"); if (joystick == null) throw new ArgumentNullException("joystick"); _robot = robot; _joystick = joystick; }
private void connectButton_Click(object sender, RoutedEventArgs e) { string host = hostTextBox.Text; int i2cCommandPort = int.Parse(i2cCommandPortTextBox.Text); int cameraPort = int.Parse(cameraPortTextBox.Text); Settings.Default.Host = host; Settings.Default.I2CProxyPort = i2cCommandPort; Settings.Default.CameraPort = cameraPort; Settings.Default.Save(); var robot = new Beagle(); robot.Host = host; robot.I2CCommandPort = i2cCommandPort; robot.I2CPollPort = i2cCommandPort + 1; robot.CameraPort = cameraPort; robot.Init(); bool ok = robot.Connect(); if (!ok) { MessageBox.Show("Unable to connect. Please check your settings.", "Connect", MessageBoxButton.OK, MessageBoxImage.Error); return; } var main = new MainWindow(); main.Robot = robot; main.Show(); expectedToClose = true; Close(); }
public override void Bind(Beagle robot, Joystick joystick) { base.Bind(robot, joystick); joystick.MainAxisChanged += Joystick_MainAxisChanged; }
public override void Bind(Beagle robot, Joystick joystick) { base.Bind(robot, joystick); if (Joystick != null) joystick.PointOfViewPressed += joystick_PointOfViewChanged; DataContext = robot.ServoController; }
public override void Bind(Beagle robot, Joystick joystick) { base.Bind(robot, joystick); joystick.TriggerPressed += joystick_TriggerClicked; DataContext = robot.UltrasonicRangeFinder; }
public override void Bind(Beagle robot, Joystick joystick) { base.Bind(robot, joystick); DataContext = robot; }