private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            
            // this is just a test, so it only works with one Kinect, and quits if that is not available.
            _sensor = KinectSensor.KinectSensors.FirstOrDefault();
            if (_sensor == null)
            {
                MessageBox.Show("No Kinect Sensor detected!");
                Close();
                return;
            }
            
            //_sensor.SkeletonStream.EnableTrackingInNearRange = true;
            _sensor.SkeletonStream.Enable();

            _sensor.SkeletonFrameReady += NuiSkeletonFrameReady;

            _sensor.Start();
            IGestureDetector gestureDetector = new InteractiveGestureDetector(_sensor);
            ((InteractiveGestureDetector)gestureDetector).DumpReady += InteractionStreamOnInteractionFrameReady;
            IGestureDetector voiceDetector = new VoiceRecognition.KinectVoiceGestureDetector(_sensor);
            ICommandSender commandSender = new XbmcCommandSender();
            adapter = new GestureToCommandAdapter(@"GestureToCommand.XML", commandSender, gestureDetector, voiceDetector);
            adapter.ShowNotification = true;
            //Gestures
            gestureDetector.GestureDetected += gestureDetector_GestureDetected;
        }
 /// <summary>
 /// Initialize Adapter and Kinect Device.
 /// </summary>
 private void Initialize()
 {
     
     
     _kinectSensor.Start();
     kinectStatusText.Text = _kinectSensor.Status.ToString(); //update UI
     IGestureDetector gestureDetector = new InteractiveGestureDetector(_kinectSensor);
     IGestureDetector voiceDetector = new VoiceRecognition.KinectVoiceGestureDetector(_kinectSensor);
     INotifybleCommandSender commandSender = new XbmcCommandSender();
     commandSender.CommandSenderStatusChanged += commandSender_CommandSenderStatusChanged;
     commandSender.SendNotification("Kinect Adapter Connected","");
     _adapter = new GestureToCommandAdapter(GestureFilePath, commandSender, gestureDetector, voiceDetector);
     //Gestures
     gestureDetector.GestureDetected += gestureDetector_GestureDetected;
     //display available gestures
     //Load gestures from file
     XmlSerializer xmlser = new XmlSerializer(typeof(List<GestureCommandPair>));
     using (StreamReader srdr = new StreamReader(GestureFilePath))
     {
         var list  = (IList<GestureCommandPair>)xmlser.Deserialize(srdr);
         foreach (var g in list)
             GestureList.Add(g);
     }
 }