public void Cancel()
        {
            if (Stage == CaptureMovieProcessFlowStage.Recording)
            {
                Stage = CaptureMovieProcessFlowStage.Stopped;
                State = CaptureMovieProcessFlowStates.Stop;

                PreRecordingTimer.Stop();;
                RecordingTimer.Stop();

                PreRecordingTimer = null;
                RecordingTimer    = null;

                CaptureFacede.StopCapturingVideoToFile();

                //TODO handle files left after cancel
                //File.Delete(TempFilename);

                TextBlock.Visibility = System.Windows.Visibility.Collapsed;

                IsRecording = false;
            }
            else
            {
                this.Clean();
            }
        }
        public void PauseRecording()
        {
            RecordingTimer.Stop();
            CaptureFacede.PauseCapturingVideoToFile();

            this.IsRecording = false;
            State            = CaptureMovieProcessFlowStates.PausedRecording;
            Stage            = CaptureMovieProcessFlowStage.Stopped;
        }
 public void ToggleStartPause()
 {
     if (Stage == CaptureMovieProcessFlowStage.Stopped || Stage == CaptureMovieProcessFlowStage.CountingDownTillRecording)
     {
         if (PreRecordingTimer == null)
         {
             PreRecordingTimer          = new DispatcherTimer();
             PreRecordingTimer.Tick    += new EventHandler(StartMovieDelay_Timer);
             PreRecordingTimer.Interval = new TimeSpan(0, 0, 1);
             PreRecordingTimer.Start();
             State                = CaptureMovieProcessFlowStates.CountingDownTillRecording;
             Stage                = CaptureMovieProcessFlowStage.CountingDownTillRecording;
             Seconds              = 3;
             TextBlock.Text       = "You have " + Seconds.ToString() + " seconds before recording starts...";
             TextBlock.Visibility = System.Windows.Visibility.Visible;
             IsRecording          = true;
         }
         else
         {
             if (PreRecordingTimer.IsEnabled)
             {
                 PreRecordingTimer.Stop();
                 IsRecording = false;
                 State       = CaptureMovieProcessFlowStates.PausedCountingDownTillRecording;
             }
             else
             {
                 PreRecordingTimer.Start();
                 State       = CaptureMovieProcessFlowStates.CountingDownTillRecording;
                 IsRecording = true;
             }
         }
     }
     else
     {
         if (RecordingTimer != null)
         {
             if (RecordingTimer.IsEnabled)
             {
                 RecordingTimer.Stop();
                 State = CaptureMovieProcessFlowStates.PausedRecording;
                 CaptureFacede.PauseCapturingVideoToFile();
                 IsRecording = false;
             }
             else
             {
                 RecordingTimer.Start();
                 State = CaptureMovieProcessFlowStates.Recording;
                 CaptureFacede.ResumeCapturingVideoToFile();
                 IsRecording = true;
             }
         }
     }
 }
        public void StartMovieTimeCountDown()
        {
            RecordingTimer          = new DispatcherTimer();
            RecordingTimer.Tick    += new EventHandler(MovieCountDown_Timer);
            RecordingTimer.Interval = new TimeSpan(0, 0, 1);
            RecordingTimer.Start();
            State = CaptureMovieProcessFlowStates.Recording;
            Stage = CaptureMovieProcessFlowStage.Recording;
            var filename = System.IO.Path.Combine(System.IO.Path.GetTempPath(), new Random().Next().ToString() + ".avi");

            CaptureFacede.StartCapturingVideoToFile(filename);

            this.IsRecording = true;


            TempFilename = filename;
        }
        public void StopRecording()
        {
            CaptureFacede.StopCapturingVideoToFile();
            State = CaptureMovieProcessFlowStates.Stop;
            Stage = CaptureMovieProcessFlowStage.Stopped;

            PreRecordingTimer = null;
            RecordingTimer    = null;

            IsRecording = false;

            TextBlock.Visibility = System.Windows.Visibility.Collapsed;
            NewStomeMovie window = new NewStomeMovie();

            window.TempFileName           = TempFilename;
            window.FolderUponCaptureEvent = StonesView.CurrentPath;
            window.ShowDialog();
        }