Skip to content

Commit

Permalink
Optimize video-status control - Bugfix wrong usage of logical operators
Browse files Browse the repository at this point in the history
  • Loading branch information
MerlinCooper committed Jun 5, 2020
1 parent 15f4b14 commit 39ae01c
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Phases/Direction/VideoCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,24 @@ public class VideoCapture
Timer timer;
List<CapturedVideoFile> captureFileNames = new List<CapturedVideoFile>();
videoStatus curVideoStatus = videoStatus.stopped;

~VideoCapture()
{
if(curVideoStatus != videoStatus.stopped)
SendKeyStroke_StartStopp();
}

public void Activate(string workingFolder, bool bStartRecording = true)
{
this.workingFolder = workingFolder;
this.started = DateTime.Now;

timer = new Timer(500);
timer.Elapsed += CaptureNewFileNames; ;
timer.Elapsed += CaptureNewFileNames;
timer.AutoReset = false;
timer.Enabled = true;

if (bStartRecording & (curVideoStatus != videoStatus.running))
if (bStartRecording && (curVideoStatus != videoStatus.running))
{
SendKeyStroke_StartStopp(); //Send hot-key to start recording
curVideoStatus = videoStatus.running;
Expand Down Expand Up @@ -130,6 +136,16 @@ public void Resume()
}
}

public void Stop()
{
if(curVideoStatus == videoStatus.running || curVideoStatus == videoStatus.paused)
{
SendKeyStroke_StartStopp();
curVideoStatus = videoStatus.stopped;
}
}


private static void SendKeyStroke_StartStopp()
{
TraceInfo.WriteLine("Sending key event to start/stopp recording ALT+F9");
Expand Down

0 comments on commit 39ae01c

Please sign in to comment.