public override string ToString()
        {
            StringBuilder __sb = new StringBuilder("MSimulationResult(");

            __sb.Append(", Posture: ");
            __sb.Append(Posture == null ? "<null>" : Posture.ToString());
            if (Constraints != null && __isset.Constraints)
            {
                __sb.Append(", Constraints: ");
                __sb.Append(Constraints);
            }
            if (Events != null && __isset.Events)
            {
                __sb.Append(", Events: ");
                __sb.Append(Events);
            }
            if (SceneManipulations != null && __isset.SceneManipulations)
            {
                __sb.Append(", SceneManipulations: ");
                __sb.Append(SceneManipulations);
            }
            if (DrawingCalls != null && __isset.DrawingCalls)
            {
                __sb.Append(", DrawingCalls: ");
                __sb.Append(DrawingCalls);
            }
            if (LogData != null && __isset.LogData)
            {
                __sb.Append(", LogData: ");
                __sb.Append(LogData);
            }
            __sb.Append(")");
            return(__sb.ToString());
        }
        public override string ToString()
        {
            StringBuilder __sb = new StringBuilder("MIKServiceResult(");

            __sb.Append(", Posture: ");
            __sb.Append(Posture == null ? "<null>" : Posture.ToString());
            __sb.Append(", Success: ");
            __sb.Append(Success);
            __sb.Append(", Error: ");
            __sb.Append(Error);
            __sb.Append(")");
            return(__sb.ToString());
        }
        public override string ToString()
        {
            StringBuilder __sb = new StringBuilder("MPostureConstraint(");

            __sb.Append(", Posture: ");
            __sb.Append(Posture == null ? "<null>" : Posture.ToString());
            if (JointConstraints != null && __isset.JointConstraints)
            {
                __sb.Append(", JointConstraints: ");
                __sb.Append(JointConstraints);
            }
            __sb.Append(")");
            return(__sb.ToString());
        }
            public override string ToString()
            {
                StringBuilder __sb    = new StringBuilder("GetGraspPoses_args(");
                bool          __first = true;

                if (Posture != null && __isset.posture)
                {
                    if (!__first)
                    {
                        __sb.Append(", ");
                    }
                    __first = false;
                    __sb.Append("Posture: ");
                    __sb.Append(Posture == null ? "<null>" : Posture.ToString());
                }
                if (__isset.handType)
                {
                    if (!__first)
                    {
                        __sb.Append(", ");
                    }
                    __first = false;
                    __sb.Append("HandType: ");
                    __sb.Append(HandType);
                }
                if (SceneObject != null && __isset.sceneObject)
                {
                    if (!__first)
                    {
                        __sb.Append(", ");
                    }
                    __first = false;
                    __sb.Append("SceneObject: ");
                    __sb.Append(SceneObject == null ? "<null>" : SceneObject.ToString());
                }
                if (__isset.repositionHand)
                {
                    if (!__first)
                    {
                        __sb.Append(", ");
                    }
                    __first = false;
                    __sb.Append("RepositionHand: ");
                    __sb.Append(RepositionHand);
                }
                __sb.Append(")");
                return(__sb.ToString());
            }
        private void SensorSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            Skeleton[] skeletons = new Skeleton[0];

            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
            {
                if (skeletonFrame != null)
                {
                    skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
                    skeletonFrame.CopySkeletonDataTo(skeletons);
                }
            }

            using (DrawingContext dc = this.drawingGroup.Open())
            {
                // Dibuja fondo oscuro
                dc.DrawRectangle(Brushes.Black, null, new Rect(0.0, 0.0, RenderWidth, RenderHeight));

                if (skeletons.Length != 0)
                {
                    foreach (Skeleton skel in skeletons)
                    {
                        RenderClippedEdges(skel, dc);

                        if (skel.TrackingState == SkeletonTrackingState.Tracked)
                        {
                            this.DrawBonesAndJoints(skel, dc);

                            Vector3 manoD = new Vector3();
                            manoD.X = skel.Joints[JointType.HandRight].Position.X;
                            manoD.Y = skel.Joints[JointType.HandRight].Position.Y;
                            manoD.Z = skel.Joints[JointType.HandRight].Position.Z;

                            Vector3 cabeza = new Vector3();
                            cabeza.X = skel.Joints[JointType.Head].Position.X;
                            cabeza.Y = skel.Joints[JointType.Head].Position.Y;
                            cabeza.Z = skel.Joints[JointType.Head].Position.Z;

                            Vector3 manoI = new Vector3();
                            manoI.X = skel.Joints[JointType.HandLeft].Position.X;
                            manoI.Y = skel.Joints[JointType.HandLeft].Position.Y;
                            manoI.Z = skel.Joints[JointType.HandLeft].Position.Z;

                            Vector3 hombroD = new Vector3();
                            hombroD.X = skel.Joints[JointType.ShoulderRight].Position.X;
                            hombroD.Y = skel.Joints[JointType.ShoulderRight].Position.Y;
                            hombroD.Z = skel.Joints[JointType.ShoulderRight].Position.Z;

                            Vector3 hombroI = new Vector3();
                            hombroI.X = skel.Joints[JointType.ShoulderLeft].Position.X;
                            hombroI.Y = skel.Joints[JointType.ShoulderLeft].Position.Y;
                            hombroI.Z = skel.Joints[JointType.ShoulderLeft].Position.Z;

                            Vector3 codoI = new Vector3();
                            codoI.X = skel.Joints[JointType.ElbowLeft].Position.X;
                            codoI.Y = skel.Joints[JointType.ElbowLeft].Position.Y;
                            codoI.Z = skel.Joints[JointType.ElbowLeft].Position.Z;

                            Vector3 codoD = new Vector3();
                            codoD.X = skel.Joints[JointType.ElbowRight].Position.X;
                            codoD.Y = skel.Joints[JointType.ElbowRight].Position.Y;
                            codoD.Z = skel.Joints[JointType.ElbowRight].Position.Z;

                            positionList.Add(new Vector3()
                            {
                                X    = manoD.X,
                                Y    = manoD.Y,
                                Z    = manoD.Z,
                                date = DateTime.Now
                            });

                            SwipeRightToLeft();

                            if (positionList.Count() > 20)
                            {
                                positionList.RemoveAt(0);
                            }

                            if (Adelante(manoD, manoI, codoD, codoI))
                            {
                                if (PostureDetector(Posture.Adelante))
                                {
                                    mensajemov.Text = previousPosture.ToString();

                                    Robot robot = new Robot(com);
                                    robot.caminar();
                                }
                            }

                            else if (Derecha(manoD, codoD, hombroD, cabeza))
                            {
                                if (PostureDetector(Posture.Derecha))
                                {
                                    mensajemov.Text = previousPosture.ToString();
                                    Robot robot = new Robot(com);
                                    robot.derecha();
                                }
                            }
                            else if (Izquierda(manoI, codoI, hombroI, cabeza))
                            {
                                if (PostureDetector(Posture.Izquierda))
                                {
                                    mensajemov.Text = previousPosture.ToString();
                                    Robot robot = new Robot(com);
                                    robot.izquierda();
                                }
                            }
                            else
                            if (PostureDetector(Posture.None))
                            {
                                mensajemov.Text = previousPosture.ToString();
                            }
                        }
                        else if (skel.TrackingState == SkeletonTrackingState.PositionOnly)
                        {
                            dc.DrawEllipse(
                                this.centerPointBrush,
                                null,
                                this.SkeletonPointToScreen(skel.Position),
                                BodyCenterThickness,
                                BodyCenterThickness);
                        }
                    }
                }
                // Previene que el dibujo salgan del cuadro
                this.drawingGroup.ClipGeometry = new RectangleGeometry(new Rect(0.0, 0.0, RenderWidth, RenderHeight));
            }
        }