示例#1
0
        /// <summary>
        /// Sets the state of the VSM depending on the state of the UI
        /// </summary>
        /// <param name="useTransitions">true to use a System.Windows.VisualTransition object to transition between states; otherwise, false.</param>
        private void ChangeVisualState(bool useTransitions)
        {
            string newStateName     = "KinectNormal";
            bool   showKinectCursor = true;

            if (!this.IsEnabled)
            {
                newStateName = "KinectDisabled";
            }
            else if (this.IsDragging)
            {
                newStateName     = "KinectPressed";
                showKinectCursor = false;
            }
            else if (KinectRegion.GetIsPrimaryHandPointerOver(this.gripEventTarget) || this.gripEventTarget.IsMouseOver)
            {
                newStateName = "HandPointerOver";
            }

            var kinectRegion = KinectRegion.GetKinectRegion(this);

            if (this.sliderParent != null && kinectRegion != null)
            {
                if (!showKinectCursor && !this.sliderParent.HideKinectCursorWhenDragging)
                {
                    showKinectCursor = true;
                }

                kinectRegion.IsCursorVisible = showKinectCursor;
            }

            VisualStateManager.GoToState(this, newStateName, useTransitions);
        }