我正在創建一個程序,您在其中執行rep伸展操作,因此它會向代表的數量添加一個。我想每個代表之間有一個時間間隔(不是當前問題)。我有這個嵌套在AllFramesReadyEventArgs
內。問題是,由於SDK在整個程序中使用了AllFramesReadyEvent
,所以它是一個無限循環。當我不想要它時,我如何在不重複的情況下做每個代表?提前致謝。AllFramesReady重複循環
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);
}
}
你可以寫更多關於什麼是重複?我在這裏看到循環與開始和結束。問題出在循環或循環本身? – Fixus 2012-07-08 17:19:09
@Fixus問題是,allframesready重複我想要的循環 – 2012-07-08 21:05:00
@Fixus檢查編輯 – 2012-07-09 00:47:19