我正在创建一个程序,您可以在其中进行一次伸展运动,因此它会增加一个次数。我想在每个代表之间有一个间隔(不是当前问题)。我有这个嵌套在AllFramesReadyEventArgs
. 问题是,由于SDK使用了AllFramesReadyEvent
整个程序,所以它是一个无限循环。当我不想重复时,我怎样才能在不重复的情况下完成每个重复?提前致谢。
if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
{
int whereIsX = (int)Canvas.GetLeft(ellipse1);
int whereToX = (int)Canvas.GetLeft(pspine);
whatToMultiplyX = whereToX / whereIsX;
int whereIsY = (int)Canvas.GetTop(ellipse1);
int whereToY = (int)Canvas.GetTop(pspine);
whatToMultiplyY = whereToY / whereIsY;
Canvas.SetTop(ellipse1, Canvas.GetTop(ellipse1) * whatToMultiplyY);
Canvas.SetLeft(ellipse1, Canvas.GetLeft(ellipse1) * whatToMultiplyX);
for (int i = 0; i < Doctor_ShoulderX.Count; i++)
{
Canvas.SetTop(doctorHand, Doctor_HandY[i] * whatToMultiplyY);
Canvas.SetTop(doctorElbow, Doctor_ElbowY[i] * whatToMultiplyY);
Canvas.SetTop(doctor_Shoulder, Doctor_ShoulderY[i] * whatToMultiplyY);
Canvas.SetLeft(doctorHand, Doctor_HandX[i] * whatToMultiplyX);
Canvas.SetLeft(doctorElbow, Doctor_ElbowX[i] * whatToMultiplyX);
Canvas.SetLeft(doctor_Shoulder, Doctor_ShoulderX[i] * whatToMultiplyX);
handX = Canvas.GetLeft(handright);
handY = Canvas.GetTop(handright);
elbowX = Canvas.GetLeft(elbowright);
elbowY = Canvas.GetTop(elbowright);
shoulderX = Canvas.GetLeft(shoulderright);
shoulderY = Canvas.GetTop(shoulderright);
shoulder_x.Text = "Shoulder X: " + shoulderX.ToString();
shoulder_y.Text = "Shoulder Y: " + shoulderY.ToString();
elbow_x.Text = "Elbow X: " + elbowX.ToString();
elbow_y.Text = "Elbow Y: " + elbowY.ToString();
hand_x.Text = "Hand X: " + handX.ToString();
hand_y.Text = "Hand Y: " + handY.ToString();
Patient_HandX.Add(handX);
Patient_HandY.Add(handY);
Patient_ElbowX.Add(elbowX);
Patient_ElbowY.Add(elbowY);
Patient_ShoulderX.Add(shoulderX);
Patient_ShoulderY.Add(shoulderY);
}
}