我想知道如何從一個類發送一個double值到另一個類。我正在使用Kinect,當我的公共課程主要計算雙「距離」時,如果我關閉了手,我希望將該信息發送給我的其他公共類Monitor。顯示的例子將非常感謝,因爲我是C#編程初學者。在C#中發送一個類到另一個類的雙重值
private void DrawHand(HandState handState, Point handPosition, DrawingContext drawingContext)
{
switch (handState)
{
case HandState.Closed:
drawingContext.DrawEllipse(this.handClosedBrush, null, handPosition, HandSize, HandSize);
// Distance calculation
foreach (var body in bodies)
{
// Get the positions
pRH = body.Joints[JointType.HandRight];
pLH = body.Joints[JointType.HandLeft]; // pLH gets to be "home" position in the meanwhile
//Some maths
double sqDistance = Math.Pow(pRH.Position.X - pLH.Position.X, 2) +
Math.Pow(pRH.Position.Y - pLH.Position.Y, 2) +
Math.Pow(pRH.Position.Z - pLH.Position.Z, 2);
// This is the information I want to send to public class Monitor
double distance = Math.Sqrt(sqDistance);
}
break;
}
}
請填寫你的問題更清楚 – Shrivallabh