예제 #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (_robot == null)
            {
                throw new ApplicationException("The Robot property has not been set.");
            }

            MyTraceListener traceListener = new MyTraceListener();

            traceListener.NewMessage += OnNewMessage;
            Debug.Listeners.Add(traceListener);

            _joystick = new Joystick();
            _joystick.Initialize();
            if (_joystick.IsConnected)
            {
                _joystick.StartPolling();
            }

            _motorController.Bind(_robot, _joystick);
            _motorVisualizer.Bind(_robot, _joystick);
            _batteryStatusVisualizer.Bind(_robot, _joystick);
            _servoController.Bind(_robot, _joystick);
            _ultrasonicRangeFinderVisualizer.Bind(_robot, _joystick);
            _compassVisualizer.Bind(_robot, _joystick);
            _camera.Bind(_robot, _joystick);
        }
예제 #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (_robot == null) throw new ApplicationException("The Robot property has not been set.");

            MyTraceListener traceListener = new MyTraceListener();
            traceListener.NewMessage += OnNewMessage;
            Debug.Listeners.Add(traceListener);

            _joystick = new Joystick();
            _joystick.Initialize();
            if (_joystick.IsConnected) _joystick.StartPolling();

            _motorController.Bind(_robot, _joystick);
            _motorVisualizer.Bind(_robot, _joystick);
            _batteryStatusVisualizer.Bind(_robot, _joystick);
            _servoController.Bind(_robot, _joystick);
            _ultrasonicRangeFinderVisualizer.Bind(_robot, _joystick);
            _compassVisualizer.Bind(_robot, _joystick);
            _camera.Bind(_robot, _joystick);
        }