private void processButton_Click(object sender, RoutedEventArgs e)
 {
     //foreach (KinectFrame kf in CurrentClip)
     //{
     //    BitmapSource bs = kf.ColorPixelData.ToBitmapSource(kf.ColorWidth,kf.ColorHeight);
     //    BitmapSource dp = kf.DepthPixelData.ToBitmapSource(kf.DepthWidth, kf.DepthHeight, 0, Color.FromRgb((byte)255, (byte)0, (byte)0));
     //    this.colorImage.Source = bs;
     //    bs.Save(string.Format("X:\\Recording\\test{0}.png",kf.ColorFrameNumber),ImageFormat.Png);
     //    this.depthImage.Source = dp;
     //    dp.Save(string.Format("X:\\Recording\\test_d{0}.png", kf.ColorFrameNumber), ImageFormat.Png);
     //}
     CurrentClip = new KinectClip(ClipName);
     Thread t = new Thread(new ThreadStart(BeginProcessing));
     t.Start();
 }
        void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker bw = sender as BackgroundWorker;
            WorkParams wp = (WorkParams)e.Argument;
            IEnumerable<string> files = wp.inFiles;
            int c = files.Count();
            Regex r = new Regex(@"S(\d+)_(\w+)_T(\d+).*.clip");
            int i = 0;
            foreach (string path in files)
            {
                i++;
                string outPath = Path.Combine(wp.saveDir, r.Replace(Path.GetFileName(path), @"S$1_$2_T$3.xml"));

                Console.Write("Processing {0}", outPath);
                CurrentClip = new KinectClip(path);
                CurrentClip.SensorInstanceID = KinectSensor.KinectSensors[0].DeviceConnectionId;
                try
                {
                    CurrentClip.Sensor.Start();
                }
                catch { }
                CurrentClip.ToCache(outPath, onlyActors: wp.onlyActors, legacy: true);
                //try
                //{
                //    CurrentClip.ToCache(outPath, onlyActors: true, legacy: true);
                //}
                //catch (Exception ex)
                //{
                //    Console.WriteLine(ex.Message);
                //}
                bw.ReportProgress((int)((float)i / (float)c * 100));
            }
        }
        private void openButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofp = new OpenFileDialog();
            ofp.Filter = "All Files (*.*)|*.*";

            Nullable<bool> result = ofp.ShowDialog();
            if (result == true)
            {
                ClipName = ofp.FileName;
                CurrentClip = new KinectClip(ClipName);

                saveButton.IsEnabled = true;
                processButton.IsEnabled = true;
            }
        }
 public void StartRecording(object sender, RoutedEventArgs e)
 {
     CurrentSession.CurrentClip = new ClipMeta() { StartFrame=(CurrentSession.CurrentClip != null ? CurrentSession.CurrentClip.EndFrame+1 : 0), Note=CurrentSession.CurrentNote,  Actor = CurrentSession.CurrentActor, Directory=CurrentSession.CurrentDirectory, Take=CurrentSession.CurrentTake, Scene=CurrentSession.CurrentScene, KinectConnectionID = CurrentSession.CurrentKinectConnectionID };
     CurrentFile = new KinectClip(CurrentSession.CurrentClip.DefaultFilePath);
     CurrentSession.Recording = true;
 }