public DanceSegment addDanceSegment(int startFrame)
 {
     var segment = new DanceSegment(this);
     segments.Add(startFrame, segment);
     return segment;
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            audioPlayerPlayForDuration(new TimeSpan(0, 1, 0), new TimeSpan(0, 0, 10));

               //sign up for the event
            kinectSensorChooser.KinectSensorChanged += new DependencyPropertyChangedEventHandler(kinectSensorChooser_KinectSensorChanged);
            if (DanceRoutine.saveAlreadyExists(fakeSongFile))
            {
              Debug.WriteLine("save already exists.");
              routine = DanceRoutine.load(DanceRoutine.getSaveDestinationName(fakeSongFile));
              segment = routine.segments[0];
              Debug.WriteLine("Loaded segment " + segment);
              videoCounter = 0;
              kinectSkeletonViewerCanvas.Visibility = Visibility.Hidden;
              var dispatcherTimer = new DispatcherTimer();
              dispatcherTimer.Tick += new EventHandler(videoPlayerTick);
              dispatcherTimer.Interval = new TimeSpan(0, 0, 1/29);
              dispatcherTimer.Start();

              framesToRecord = -2;
            } else {
                Debug.WriteLine("creating new routine");
                routine = new DanceRoutine(fakeSongFile);
                Debug.WriteLine("created new routine");
                segment = routine.addDanceSegment(0);
            }
        }