Esempio n. 1
0
        private void SaveFragButton_Click(object sender, RoutedEventArgs e)
        {
            if (HendlerHolder.IsKinectPlayerWindow(this))
            {
                return;
            }
            if (SKLRecording == null)
            {
                MessageBox.Show(this, "No recording was loaded.", "Error saving recording", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (SKLRecording.Count == 0)
            {
                MessageBox.Show(this, "No recording was loaded.", "Error saving recording", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            int start = 0;
            int stop  = 0;

            try
            {
                start = int.Parse(StartTextBox.Text);
                stop  = int.Parse(StopTextBox.Text);
            }
            catch
            {
                MessageBox.Show(this, "Error in parsing range.", "Error saving recording", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (start < 0 || start >= SKLRecording.Count ||
                stop < 0 || stop >= SKLRecording.Count ||
                start > stop)
            {
                MessageBox.Show(this, "Recording ranges out of range.", "Error saving recording", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            String dirName          = System.AppDomain.CurrentDomain.BaseDirectory;
            String fileNameSkeleton = "SkeletonRecord";
            int    imageIndex       = 0;

            while (File.Exists(dirName + "/" + fileNameSkeleton + imageIndex + ".skl"))
            {
                imageIndex++;
            }
            StreamWriter sw           = new StreamWriter(dirName + "/" + fileNameSkeleton + imageIndex + ".skl");
            long         currentFrame = 0;

            for (int a = start; a <= stop; a++)
            {
                TSkeleton[] ts = (TSkeleton[])SKLRecording[a];
                for (int b = 0; b < ts.Length; b++)
                {
                    TSkeletonHelper.SaveTSkeletonToFile(ts[b], sw, currentFrame);
                }
                currentFrame++;
            }
            sw.Close();
            MessageBox.Show(this, "File saved successfully under path:\r\n" + dirName + "/" + fileNameSkeleton + imageIndex + ".skl", "Saving", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Esempio n. 2
0
 private void RecordButtn_Click(object sender, RoutedEventArgs e)
 {
     if (HendlerHolder.IsKinectPlayerWindow(this))
     {
         BeginCapture();
     }
 }
Esempio n. 3
0
        private void SkeletonOutput_Drop(object sender, DragEventArgs e)
        {
            if (IsPlaying == true || recording == true || HendlerHolder.FileDroppingEnabled == false)
            {
                string msg = "File dropping has been disabled either by internal processing (like recording or playing) or by the user in main menu.";
                HendlerHolder.DisplayMessage(this, msg);
                return;
            }
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                // Note that you can have more than one file.
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
                for (int a = 0; a < files.Length; a++)
                {
                    if (System.IO.Path.GetExtension(files[a]).ToLower() == ".skl")
                    {
                        if (HendlerHolder.IsKinectPlayerWindow(this))
                        {
                            HendlerHolder.OpenNewPlayerWindow(true, files[a]);
                        }
                        else
                        {
                            LoadSKLRecording(files[0]);
                            Title = files[0];
                        }
                    }
                }
                // Assuming you have one file that you care about, pass it off to whatever
                // handling code you have defined.

                /*Dispatcher.Invoke(
                 *  new Action(
                 *  () =>
                 *  {
                 *      this.parentMainWindow.LoadSkeletonFile(files[0]);
                 *  }));*/
            }
        }