Esempio n. 1
0
        /// <summary>
        /// Handles Skeleton Updated event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void kinectService_SkeletonUpdated(object sender, SkeletonEventArgs e)
        {
            if (App.Current.MainWindow != null)
            {


                bool wasTouching = user.Touching;
                #region Set vals
                user.rightArm.HandX = e.RightHandPosition.X;
                user.rightArm.HandY = e.RightHandPosition.Y;
                user.rightArm.HandZ = e.RightHandPosition.Z;

                user.leftArm.HandX = e.LeftHandPosition.X;
                user.leftArm.HandY = e.LeftHandPosition.Y;
                user.leftArm.HandZ = e.LeftHandPosition.Z;

                user.torso.X = e.TorsoPosition.X;
                user.torso.Y = e.TorsoPosition.Y;
                user.torso.Z = e.TorsoPosition.Z;
                #endregion

                if (user.Touching)
                    firstEntry = false;

                if (updatingViewState)
                    return;

                if (!wasTouching)
                {
                    oldGlobalX = GlobalOffsetX;
                    oldGlobalY = GlobalOffsetY;

                    if (user.Touching)
                    {
                        EntryX = user.DominantArmHandOffsetX;
                        EntryY = user.DominantArmHandOffsetY;
                    }
                }

                if (user.Touching)
                {
                    GlobalOffsetX = user.DominantArmHandOffsetX;
                    GlobalOffsetY = user.DominantArmHandOffsetY;
                    if (user.InteractionMode == HandsState.Panning)
                    {
                        this.OnPropertyChanged("DominantArmHandOffsetX");
                        this.OnPropertyChanged("DominantArmHandOffsetY");
                    }
                    appIdleTimer.Stop();
                    appIdleTimer.Start();

                    NewUserGuidesShowing = false; // because he finished his instructional training
                }

                this.OnPropertyChanged("Engaged");
                this.OnPropertyChanged("TooClose");
                this.OnPropertyChanged("OutOfBounds");
                this.OnPropertyChanged("OutOfBoundsLeft");
                this.OnPropertyChanged("OutOfBoundsTop");
                this.OnPropertyChanged("OutOfBoundsRight");
                this.OnPropertyChanged("OutOfBoundsBottom");
                this.OnPropertyChanged("InRange");
                this.OnPropertyChanged("OutOfRange");

                if (!user.TooClose)
                    this.OnPropertyChanged("DistanceFromInvisScreen");

                helpService.UserStateUpdated(user);
            }

        }
Esempio n. 2
0
        /// <summary>
        /// Handles Skeleton Updated event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void kinectService_SkeletonUpdated(object sender, SkeletonEventArgs e)
        {
            if (App.Current.MainWindow != null)
            {
                bool wasTouching = user.Touching;
                #region Set vals
                user.rightArm.HandX = e.RightHandPosition.X;
                user.rightArm.HandY = e.RightHandPosition.Y;
                user.rightArm.HandZ = e.RightHandPosition.Z;

                user.leftArm.HandX = e.LeftHandPosition.X;
                user.leftArm.HandY = e.LeftHandPosition.Y;
                user.leftArm.HandZ = e.LeftHandPosition.Z;

                user.torso.X = e.TorsoPosition.X;
                user.torso.Y = e.TorsoPosition.Y;
                user.torso.Z = e.TorsoPosition.Z;
                #endregion

                if (user.Touching)
                {
                    firstEntry = false;
                }

                if (updatingViewState)
                {
                    return;
                }

                if (!wasTouching)
                {
                    oldGlobalX = GlobalOffsetX;
                    oldGlobalY = GlobalOffsetY;

                    if (user.Touching)
                    {
                        EntryX = user.DominantArmHandOffsetX;
                        EntryY = user.DominantArmHandOffsetY;
                    }
                }

                if (user.Touching)
                {
                    GlobalOffsetX = user.DominantArmHandOffsetX;
                    GlobalOffsetY = user.DominantArmHandOffsetY;
                    if (user.InteractionMode == HandsState.Panning)
                    {
                        this.OnPropertyChanged("DominantArmHandOffsetX");
                        this.OnPropertyChanged("DominantArmHandOffsetY");
                    }
                    appIdleTimer.Stop();
                    appIdleTimer.Start();

                    NewUserGuidesShowing = false; // because he finished his instructional training
                }

                this.OnPropertyChanged("Engaged");
                this.OnPropertyChanged("TooClose");
                this.OnPropertyChanged("OutOfBounds");
                this.OnPropertyChanged("OutOfBoundsLeft");
                this.OnPropertyChanged("OutOfBoundsTop");
                this.OnPropertyChanged("OutOfBoundsRight");
                this.OnPropertyChanged("OutOfBoundsBottom");
                this.OnPropertyChanged("InRange");
                this.OnPropertyChanged("OutOfRange");

                if (!user.TooClose)
                {
                    this.OnPropertyChanged("DistanceFromInvisScreen");
                }

                helpService.UserStateUpdated(user);
            }
        }