From 0b3f42fef34124bc22761db3929354e020bb51ae Mon Sep 17 00:00:00 2001 From: Jeffrey Markowitz Date: Mon, 2 Jan 2017 11:48:33 -0500 Subject: [PATCH] Added support for writing straight to folder --- kinect2_nidaq/MainWindow.xaml.cs | 57 +++++++++++++++++------------- kinect2_nidaq/kinect2_nidaq.csproj | 37 +++++++++++++++++-- 2 files changed, 67 insertions(+), 27 deletions(-) diff --git a/kinect2_nidaq/MainWindow.xaml.cs b/kinect2_nidaq/MainWindow.xaml.cs index f6b248c..d4d5ab2 100644 --- a/kinect2_nidaq/MainWindow.xaml.cs +++ b/kinect2_nidaq/MainWindow.xaml.cs @@ -428,6 +428,7 @@ private void StartButton_Click(object sender, RoutedEventArgs e) DepthReader = sensor.DepthFrameSource.OpenReader(); DepthReader.FrameArrived += DepthReader_FrameArrived; IsDepthStreamEnabled = true; + } else { @@ -646,32 +647,37 @@ private void SessionCleanup() // close the readers, files and filewriting tasks - if (IsRecordingEnabled == true) + if (IsColorStreamEnabled == true && IsRecordingEnabled == true) { - if (IsColorStreamEnabled == true) - { - ColorReader.Dispose(); - ColorTSStream.Close(); - ColorDumpTask.Dispose(); - } - - if (IsDepthStreamEnabled == true) - { - DepthReader.Dispose(); - DepthTSStream.Close(); - DepthVidStream.Close(); - DepthDumpTask.Dispose(); - } - - if (IsNidaqEnabled == true) - { - NidaqStream.Close(); - NidaqFile.Close(); - NidaqDumpTask.Dispose(); - } - + ColorReader.Dispose(); + ColorTSStream.Close(); + ColorDumpTask.Dispose(); + } + else if (IsColorStreamEnabled == true) + { + ColorReader.Dispose(); + } + + if (IsDepthStreamEnabled == true && IsRecordingEnabled== true) + { + DepthReader.Dispose(); + DepthTSStream.Close(); + DepthVidStream.Close(); + DepthDumpTask.Dispose(); + } + else if (IsDepthStreamEnabled == true) + { + DepthReader.Dispose(); } + if (IsNidaqEnabled == true && IsRecordingEnabled ==true) + { + NidaqStream.Close(); + NidaqFile.Close(); + NidaqDumpTask.Dispose(); + } + + StatusBarProgress.IsEnabled = true; StatusBarProgressETA.IsEnabled = true; @@ -1301,7 +1307,10 @@ private void SettingsChanged() && PreviewMode.IsChecked == false) { - string BasePath = Path.GetTempPath(); + // Temporary directory is defined here + + //string BasePath = Path.GetTempPath(); + string BasePath = SaveFolder; string now = DateTime.Now.ToString("yyyyMMddHHmmss"); FilePath_ColorTs = Path.Combine(BasePath, String.Format("rgb_ts_{0}.txt", now)); diff --git a/kinect2_nidaq/kinect2_nidaq.csproj b/kinect2_nidaq/kinect2_nidaq.csproj index 6b0e3da..0471e37 100644 --- a/kinect2_nidaq/kinect2_nidaq.csproj +++ b/kinect2_nidaq/kinect2_nidaq.csproj @@ -15,7 +15,7 @@ 4 true false - C:\Users\dattalab\Desktop\kinect2-nidaq\ + C:\Users\dattalab\Desktop\kinect2-nidaq-vspublish\ true Disk false @@ -25,8 +25,7 @@ false false true - true - 2 + 5 1.0.0.%2a false true @@ -232,6 +231,38 @@ + + + False + + + + + Include + True + Assembly + + + False + + + + + Include + True + Assembly + + + False + + + + + Include + True + Assembly + +