public DebugController(Context context, KinectUser user, IRenderEngine renderEngine)
        {
            _DepthGenerator = new DepthGenerator(context);

            this.User = user;
            this.RenderEngine = renderEngine;

            _DebugLines = new Dictionary<SkeletonJoint, ILine>();
        }
        void _UserGenerator_NewUser(object sender, NewUserEventArgs e)
        {
            if(_FindUser(e.ID) == null)
            {
                //new user
                var user = new KinectUser(e.ID);

                lock (_UserLock)
                {
                    this.Users.Add(e.ID, user);
                }

                UserFound.Raise(this, user);

                //use the first lot of calibration data loaded for all users if available
                if (System.IO.File.Exists(this.CalibrationPath))
                {
                    try
                    {
                        lock (_SkeletonLock)
                        {
                            _SkeletonCapability.LoadCalibrationDataFromFile(e.ID, this.CalibrationPath);
                            _SkeletonCapability.StartTracking(e.ID);

                            user.IsCalibrated = true;

                            SkeletonReady.Raise(this, user);
                        }
                    }
                    catch(StatusException)
                    {
                        //need to detect the pose
                        _PoseDetectionCapability.StartPoseDetection(_CalibrationPose, e.ID);
                    }
                }
                else
                {
                    //need to detect the pose
                    _PoseDetectionCapability.StartPoseDetection(_CalibrationPose, e.ID);
                }
            }
        }
        /// <summary>
        /// Unlinks the specified user from the specified proxy element.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="element">The element.</param>
        public void Unlink(KinectUser user, VastPark.Imml.Proxy.ImmlElement element)
        {
            if (ElementProxyFactory.GetType(element) != VastPark.Data.ElementType.Model)
            {
                throw new Exception("Invalid element to unlink, must be of type Model");
            }

            var model = ElementProxyFactory.ExtractElement(element) as VastPark.Imml.Scene.Controls.Model;
            var modelController = base.Controllers.Where(c => c is ModelController && (c as ModelController).Model == model).FirstOrDefault();

            if (modelController != null)
            {
                base.RemoveController(modelController);
            }

            this.LogProvider.Write(string.Format("User {0} is no longer associated with model {1}", user.UserId, model.Name), LogLevel.Notice);
        }
 public ModelController(KinectUser user, VastPark.Imml.Scene.Controls.Model model)
 {
     this.User = user;
     this.Model = model;
     this.EnableBlending = true;
 }
        /// <summary>
        /// Links the specified user to a proxy element.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="element">The element.</param>
        public void Link(KinectUser user, VastPark.Imml.Proxy.ImmlElement element)
        {
            if (ElementProxyFactory.GetType(element) != VastPark.Data.ElementType.Model)
            {
                throw new Exception("Invalid element to link, must be of type Model");
            }

            var model = ElementProxyFactory.ExtractElement(element) as VastPark.Imml.Scene.Controls.Model;
            var modelController = new ModelController(user, model) { Enabled = true };

            base.AddController(modelController);

            this.LogProvider.Write(string.Format("User {0} is now associated with model {1}", user.UserId, model.Name), LogLevel.Notice);
        }