public static async void LoadData() { actionList.Clear(); try { StorageFile storageFile = await ApplicationData.Current.LocalFolder.GetFileAsync("actionList.dat"); IRandomAccessStream raStream = await storageFile.OpenAsync(FileAccessMode.Read); DataReader reader = new DataReader(raStream); reader.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8; reader.ByteOrder = ByteOrder.LittleEndian; await reader.LoadAsync((uint)raStream.Size); int dataLength = reader.ReadInt32(); for (int i = 0; i < dataLength; i++) { Kinect.Joint[] action = new Kinect.Joint[20]; for (int j = 0; j < 20; j++) { Kinect.Joint joint = new Kinect.Joint(); joint.JointType = (Kinect.JointType)reader.ReadByte(); joint.X = reader.ReadSingle(); joint.Y = reader.ReadSingle(); joint.Z = reader.ReadSingle(); action[j] = joint; } actionList.Add(action); } raStream.Dispose(); } catch { } }
private void SetPosition(Ellipse eliipse, Kinect.Joint joint) { Canvas.SetLeft(eliipse, joint.X * 300 + skeletonCanvas.ActualWidth / 2); Canvas.SetTop(eliipse, -joint.Y * 300 + skeletonCanvas.ActualHeight / 2); }