private void OnFiredUxEventDelegate(PXCMTouchlessController.UXEventData data) { Dispatcher.BeginInvoke((Action)(() => { cursorDisplay.SetPosition(data.position.x, data.position.y, data.position.z, data.bodySide == PXCMHandData.BodySideType.BODY_SIDE_RIGHT); controller.CheckCollision(data.position, Cube, SchemaGrid); outOfScreenBorder.X = data.position.x - 0.5f; outOfScreenBorder.Y = data.position.y - 0.5f; if (data.type == PXCMTouchlessController.UXEventData.UXEventType.UXEvent_CursorVisible) { cursorDisplay.ChangeCursorState(RealSenseNavigator.CursorDisplay.CursorStates.Normal); cursorDisplay.ChangeCursorState(RealSenseNavigator.CursorDisplay.CursorStates.Visible); outOfScreenBorder.Visibility = Visibility.Visible; } else if (data.type == PXCMTouchlessController.UXEventData.UXEventType.UXEvent_CursorNotVisible) { cursorDisplay.ChangeCursorState(RealSenseNavigator.CursorDisplay.CursorStates.Hidden); outOfScreenBorder.Visibility = Visibility.Collapsed; } else if (data.type == PXCMTouchlessController.UXEventData.UXEventType.UXEvent_ReadyForAction) { cursorDisplay.ChangeCursorState(RealSenseNavigator.CursorDisplay.CursorStates.Scroll); controller.SetHandClosed(true); controller.SetStartX(data.position.x - 0.5f); controller.SetStartY(data.position.x - 0.5f); } else if (data.type == PXCMTouchlessController.UXEventData.UXEventType.UXEvent_EndScroll) { cursorDisplay.ChangeCursorState(RealSenseNavigator.CursorDisplay.CursorStates.Normal); controller.SetHandClosed(false); controller.SetStartX(-999999999); controller.SetStartY(-999999999); controller.SetPreviousX(-999999999); controller.SetPreviousY(-999999999); } })); }