private void ListenerOnFrame(Controller controller)
        {
            lock (sync)
            {
                var fingers = new FingerList();
                var frame   = controller.Frame();
                _currentTime = frame.Timestamp;
                _timeChange  = _currentTime - _previousTime;

                #region Read frama data
                if (!frame.Hands.Empty)
                {
                    Hand hand = frame.Hands[0];
                    fingers = hand.Fingers;
                    if (_timeChange > 1000)
                    {
                        if (!fingers.Empty)
                        {
                            if (textBox1.InvokeRequired)
                            {
                                BeginInvoke(new Action <object>(Update), new object[] { fingers });
                            }
                        }
                    }
                }
                #endregion
                #region Gesture

                GestureList gestures = frame.Gestures();
                foreach (Gesture gesture in gestures)
                {
                    switch (gesture.Type)
                    {
                    case Gesture.GestureType.TYPECIRCLE:
                        PrintData("Circle gesture");
                        break;

                    case Gesture.GestureType.TYPESWIPE:
                        PrintData("Swipe gesture");
                        break;

                    case Gesture.GestureType.TYPEKEYTAP:
                        PrintData("Tap gesture");
                        break;

                    case Gesture.GestureType.TYPESCREENTAP:
                        PrintData("Tap ScreenTapGesture");
                        break;

                    default:
                        PrintData("Unknown gesture type.");
                        break;
                    }
                }
                #endregion
                #region Mouse

                if (_cursourEnabled)
                {
                    var screen = controller.CalibratedScreens.ClosestScreenHit(fingers[0]);

                    if (fingers.Count == 2)
                    {
                        if (_timeChange > 4000)
                        {
                            var x = (int)screen.Intersect(fingers[0], true, 1.0F).x;
                            var y = (int)screen.Intersect(fingers[0], true, 1.0F).y;
                            MouseCursor.mouse_event(0x0002 | 0x0004, 0, x, y, 0);
                        }
                    }

                    if (screen != null && screen.IsValid)
                    {
                        if ((int)fingers[0].TipVelocity.Magnitude > 25)
                        {
                            var xScreenIntersect = screen.Intersect(fingers[0], true).x;
                            var yScreenIntersect = screen.Intersect(fingers[0], true).y;

                            if (xScreenIntersect.ToString() != "NaN")
                            {
                                var x = (int)(xScreenIntersect * screen.WidthPixels);
                                var y = (int)(screen.HeightPixels - (yScreenIntersect * screen.HeightPixels));
                                MouseCursor.MoveCursor(x, y);
                            }
                        }
                    }
                }

                #endregion
                _previousTime = _currentTime;
                frame.Dispose();
            }
        }