// Tracks when record button is click and starts recording to JSON private void RecordButton_Click(object sender, RoutedEventArgs e) { // Toggles on record that will start recording AU coefficients to buffer if (!isRecording) { RecordButton.Content = "Stop"; RecordButton.ToolTip = "Click to stop recording"; skeletonData = new rotationData(); isRecording = true; // Start stopwatch stopwatch.Start(); } // When record is disabled write stored AUs to JSON object else { RecordButton.Content = "Record"; RecordButton.ToolTip = "Click to start recording"; isRecording = false; stopwatch.Stop(); JsonSerializer serializer = new JsonSerializer(); // File path settings -- currently json.txt in My Documents folder string myDocuments = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string path = System.IO.Path.Combine(myDocuments, "bodyData.json"); // Writes AUCoefficients using (StreamWriter sw = new StreamWriter(path)) using (JsonWriter jw = new JsonTextWriter(sw)) { serializer.Serialize(jw, skeletonData); } Console.WriteLine("Test"); if (skeletonData.ShoulderLeft.Count > 0) { Console.WriteLine(skeletonData.ShoulderLeft[0].time); Console.WriteLine(skeletonData.ShoulderLeft[0].value); } else { Console.WriteLine("No data in ShoulderLeft"); } } }