/// <summary> /// Parse the data received from kinect /// </summary> void Reader_FrameArrived(object sender, BodyFrameArrivedEventArgs e) { BodyFrameReference frameReference = e.FrameReference; BodyFrame frame = frameReference.AcquireFrame(); if (frame == null) { return; } // Make first list of people to compare to determine who has left the scene List <Person> oldPersonList = new List <Person>(); foreach (Body body in bodies) { if (body != null) { oldPersonList.Add(ConvertBodyToPerson((body))); } } frame.GetAndRefreshBodyData(bodies); frame.Dispose(); // Second list of people to compare with first to determine who has left the scene List <int> currentIDList = new List <int>(); foreach (Body body in bodies) { currentIDList.Add(GetSimpleID(body.TrackingId)); } List <Person> persons = new List <Person>(); foreach (Body body in bodies) { if (body.IsTracked) { Person person = ConvertBodyToPerson(body); persons.Add(person); if (FileRecording.recording) { int currentId = GetSimpleID(body.TrackingId);; FileRecording.Record_Joint_Points(currentId, person.Joints, DateTime.Now); } } } }
private void Stop_Recording() { FileRecording.recording = false; Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = "Joints"; // Default file name dlg.DefaultExt = ".JSON"; // Default file extension dlg.Filter = "JSon documents (.JSON)|*.JSON"; // Filter files by extension // Show save file dialog box Nullable <bool> result = dlg.ShowDialog(); // Process save file dialog box results if (result == true) { // Save document string filename = dlg.FileName; FileRecording.endFile(filename); } Record_Button.Content = "Rec"; FileRecording.GenNewTempStreamWriter(); }