Inheritance: System.EventArgs
Ejemplo n.º 1
0
 private void _kinect_UserCreated(object sender, KinectUserEventArgs e)
 {
     Core.User kinect_user = _kinect.GetUser(e.User.Id);
     var xnaUser = new User.User(kinect_user, Content,
                                 new Size(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
     _users.Add(xnaUser);
 }
Ejemplo n.º 2
0
        private void KinectUserCreated(object sender, KinectUserEventArgs e)
        {
            UpdateUserInterface(() => Messages.Add(string.Format("User {0} is created", e.User.Id)));
            //TODO: Workshop -> Step 5: instantiate the field _kinectUser, use the eventArgs and Kinect

            SubscribeToUserUpdatedEvent();
            AttachGesture();
        }
Ejemplo n.º 3
0
 private void _kinect_UserCreated(object sender, KinectUserEventArgs e)
 {
     DispatcherHelper.CheckBeginInvokeOnUI(() =>
                                               {
                                                   lock (_syncRoot)
                                                   {
                                                       User kuser = _kinect.GetUser(e.User.Id);
                                                       if (kuser != null)
                                                       {
                                                           Users.Add(new TrackingViewModel(kuser));
                                                           DebugInformation = "User Created";
                                                       }
                                                   }
                                               });
 }
Ejemplo n.º 4
0
 private void _kinect_UserCreated(object sender, KinectUserEventArgs e)
 {
     DispatcherHelper.CheckBeginInvokeOnUI(() =>
                                               {
                                                   lock (_syncRoot)
                                                   {
                                                       User kuser = _kinect.GetUser(e.User.Id);
                                                       if (kuser != null)
                                                       {
                                                           _player = kuser;
                                                           AccelerationGesture AccelerationGesture =
                                                               _player.AddAccelerationGesture();
                                                           AccelerationGesture.AccelerationCalculated +=
                                                               AccelerationGesture_AccelerationCalculated;
                                                           if (_players.Count%2 == 0)
                                                           {
                                                               PongGame.Paddles.Add(new Paddle(
                                                                                        Paddle.Side.Right, false,
                                                                                        kuser.Id));
                                                           }
                                                           else
                                                           {
                                                               PongGame.Paddles.Add(new Paddle(Paddle.Side.Left,
                                                                                               false, kuser.Id));
                                                           }
                                                           _players.Add(_player);
                                                           if (PongGame.Paddles.Count == 2)
                                                           {
                                                               PongGame.AddBall();
                                                           }
                                                       }
                                                       DebugInformation = "User Created";
                                                   }
                                               });
 }
Ejemplo n.º 5
0
        private void _kinect_UserCreated(object sender, KinectUserEventArgs e)
        {
            if (_kinectUsers.Count > 0 && !_userCalibrated)
            {
                //De gebruiker is al aan het initialiseren
                _log.DebugFormat("User {0} ignored, because another user is calibrating", e.User.Id);
                return;
            }

            User user = _kinect.GetUser(e.User.Id);
            user.Updated += _kinectUser_Updated;
            _kinectUsers.Add(user);
            _log.DebugFormat("User {0} added to the list of active Powerpoint users", user.Id);
            OnUserFound(e.User.Id);

            if (_userCalibrated)
            {
                AddUserTouchEvents(user);
            }
            else
            {
                StartCalibration(user);
            }
        }
Ejemplo n.º 6
0
 private void _kinect_UserRemoved(object sender, KinectUserEventArgs e)
 {
     if (_kinectUsers != null)
     {
         User user =
             (from kinectuser in _kinectUsers where kinectuser.Id == e.User.Id select kinectuser).FirstOrDefault();
         if (user != null)
         {
             _kinectUsers.Remove(user);
             _log.DebugFormat("User {0} removed from the list of active Powerpoint users", user.Id);
         }
         //_kinectUser = null;
     }
     OnUserLost(e.User.Id);
 }
Ejemplo n.º 7
0
        private void KinectUserCreated(object sender, KinectUserEventArgs e)
        {
            WindowMessage = "User found";
            lock (SyncRoot)
            {
                if (_activeUser != null)
                {
                    return;
                }
                _activeUser = _kinect.GetUser(e.User.Id);
                _activeUser.Updated += ActiveUserUpdated;

                var framesFilter = new FramesFilter(15);

                //Initialize filters
                _lefthandRighthandCollision = new CollisionFilter(new Point3D(100, 50, 130), JointID.HandLeft, JointID.HandRight);
                _lefthandHeadCollision = new CollisionFilter(new Point3D(150, 30, 500), JointID.HandLeft, JointID.Head);
                _lefthandRightShoulderCollision = new CollisionFilter(new Point3D(50, 50, 300), JointID.HandLeft, JointID.ShoulderRight);
                _righthandHeadCollision = new CollisionFilter(new Point3D(125, 40, 150), JointID.HandRight, JointID.Head);
                _righthandLeftShoulderCollision = new CollisionFilter(new Point3D(50, 50, 300), JointID.HandRight, JointID.ShoulderLeft);
                _righthandRightHipCollision = new CollisionFilter(new Point3D(80, 30, 200), JointID.HandRight, JointID.HipRight);

                //Initialize gestures
                _lefthandRighthandGesture = new SelfTouchGesture(1);
                _lefthandHeadGesture = new SelfTouchGesture(1);
                _lefthandRightShoulderGesture = new SelfTouchGesture(1);
                _righthandHeadGesture = new SelfTouchGesture(1);
                _righthandLeftShoulderGesture = new SelfTouchGesture(1);
                _righthandRightHipGesture = new SelfTouchGesture(1);

                //Attach filters and gestures
                _activeUser.AttachPipeline(framesFilter);
                framesFilter.AttachPipeline(_lefthandRighthandCollision);
                framesFilter.AttachPipeline(_lefthandHeadCollision);
                framesFilter.AttachPipeline(_lefthandRightShoulderCollision);
                framesFilter.AttachPipeline(_righthandHeadCollision);
                framesFilter.AttachPipeline(_righthandLeftShoulderCollision);
                framesFilter.AttachPipeline(_righthandRightHipCollision);
                _lefthandRighthandCollision.AttachPipeline(_lefthandRighthandGesture);
                _lefthandHeadCollision.AttachPipeline(_lefthandHeadGesture);
                _lefthandRightShoulderCollision.AttachPipeline(_lefthandRightShoulderGesture);
                _righthandHeadCollision.AttachPipeline(_righthandHeadGesture);
                _righthandLeftShoulderCollision.AttachPipeline(_righthandLeftShoulderGesture);
                _righthandRightHipCollision.AttachPipeline(_righthandRightHipGesture);

                _righthandLeftShoulderGesture.SelfTouchDetected += SwitchMode;

                //Debug info
                //_righthandLeftShoulderCollision.Filtered += (s, args) => ShowDebugInfo(args, "Filter info: ");
                _lefthandRightShoulderGesture.SelfTouchDetected += FireCustomEvent;
                SwitchMode(null, null);
            }
        }
Ejemplo n.º 8
0
 private void KinectUserRemoved(object sender, KinectUserEventArgs e)
 {
     lock (SyncRoot)
     {
         if (_activeUser != null && _activeUser.Id == e.User.Id)
         {
             _controlMouse = false;
             _activeUser = null;
         }
     }
 }
Ejemplo n.º 9
0
        private void KinectUserCreated(object sender, KinectUserEventArgs e)
        {
            DispatcherHelper.CheckBeginInvokeOnUI(() =>
                                                      {
                                                          lock (SyncRoot)
                                                          {
                                                              User kuser = _kinect.GetUser(e.User.Id);
                                                              if (kuser != null)
                                                              {
                                                                  UserViewModel user = CreateUser(kuser);
                                                                  user.AddSemaphoreTracking();

                                                                  Users.Add(user);
                                                                  //User = user;
                                                                  ImageSource = null;
                                                              }
                                                          }
                                                      });
        }
Ejemplo n.º 10
0
 private void KinectUserRemoved(object sender, KinectUserEventArgs e)
 {
     DispatcherHelper.CheckBeginInvokeOnUI(() =>
                                               {
                                                   lock (SyncRoot)
                                                   {
                                                       if (e.User != null)
                                                       {
                                                           UserViewModel user =
                                                               Users.SingleOrDefault(
                                                                   ku => ku != null && ku.Id == e.User.Id);
                                                           if (user != null)
                                                           {
                                                               Users.Remove(user);
                                                           }
                                                           //if(User.ID == e.User.ID)
                                                           //{
                                                           //    User = null;
                                                           //}
                                                       }
                                                   }
                                               });
 }
Ejemplo n.º 11
0
 private void _kinect_UserRemoved(object sender, KinectUserEventArgs e)
 {
 }
Ejemplo n.º 12
0
        private void KinectUserCreated(object sender, KinectUserEventArgs e)
        {
            User user = _kinect.GetUser(e.User.Id);
            user.Updated += KinectUserUpdated;
            SelfTouchGesture gesture = user.AddSelfTouchGesture(new Point3D(0, 0, 0), JointID.HandLeft, JointID.HandRight);
            gesture.SelfTouchDetected += GestureSelfTouchDetected;
            _kinectUsers.Add(user);

            Action del2 = () => HandImage.Visibility = Visibility.Visible;
            HandImage.Dispatcher.BeginInvoke(DispatcherPriority.Send, del2);
        }