Esempio n. 1
0
 void droneController_DroneCommandChanged(object sender, DroneController.DroneCommandChangedEventArgs args)
 {
     if (isDroneOn)
         CommandTextBlock.Text = args.CommandText;
 }
Esempio n. 2
0
        private void WindowLoaded(object sender, RoutedEventArgs e)
        {

            this.drawingGroup = new DrawingGroup();

            
            this.imageSource = new DrawingImage(this.drawingGroup);

           
            Image.Source = this.imageSource;

            foreach (var potentialSensor in KinectSensor.KinectSensors)
            {
                if (potentialSensor.Status == KinectStatus.Connected)
                {
                    this.sensor = potentialSensor;
                    break;
                }
            }

            if (null != this.sensor)
            {
               
                droneController = new DroneController();
                droneController.SubscribeToGestures();
                droneController.DroneCommandChanged += droneController_DroneCommandChanged;

                
                this.sensor.SkeletonStream.Enable();

               
                this.sensor.SkeletonFrameReady += this.SensorSkeletonFrameReady;

      
                try
                {
                    this.sensor.Start();
                }
                catch (IOException)
                {
                    this.sensor = null;
                }
            }

            if (null == this.sensor)
            {
                CommandTextBlock.Text = "Connect Kinect before sending commands!";

                StartButton.IsEnabled = false;
                EmergencyButton.IsEnabled = false;
                ResetEmergencyButton.IsEnabled = false;

                this.statusBarText.Text = Properties.Resources.NoKinectReady;
            }

            GestureDetection.RightHandUpDownChanged += OnRightHandUpDownChanged;
            GestureDetection.RightHandLeftRightChanged += OnRightHandLeftRightChanged;
            GestureDetection.RightHandBackForwardsChanged += OnRightHandBackFordwardChanged;

            GestureDetection.LeftHandUpDownChanged += OnLeftHandUpDownChanged;
            GestureDetection.LeftHandLeftRightChanged += OnLeftHandLeftRightChanged;
            GestureDetection.LeftHandBackForwardsChanged += OnLeftHandBackFordwardChanged;
        }