mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
Allow stop/kill before recording start
This commit is contained in:
parent
c34a5b5619
commit
5e00cff459
5 changed files with 10 additions and 7 deletions
|
@ -35,7 +35,7 @@ public abstract class ExternalCLIManager : IDisposable
|
|||
public event DataReceivedEventHandler OutputDataReceived;
|
||||
public event DataReceivedEventHandler ErrorDataReceived;
|
||||
|
||||
private Process process;
|
||||
protected Process process;
|
||||
|
||||
public virtual int Open(string path, string args = null)
|
||||
{
|
||||
|
|
|
@ -180,9 +180,9 @@ public DirectShowDevices GetDirectShowDevices()
|
|||
|
||||
public override void Close()
|
||||
{
|
||||
if (closeTryCount >= 3)
|
||||
if (closeTryCount >= 2)
|
||||
{
|
||||
base.Close();
|
||||
process.Kill();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -241,6 +241,6 @@ public enum ImagePreviewVisibility
|
|||
|
||||
public enum ScreenRecordState
|
||||
{
|
||||
Waiting, BeforeStart, AfterStart, AfterStop
|
||||
Waiting, BeforeStart, AfterStart, AfterRecordingStart, AfterStop
|
||||
}
|
||||
}
|
|
@ -158,14 +158,12 @@ public void StartRecordingTimer()
|
|||
|
||||
lblTimer.ForeColor = Color.White;
|
||||
borderColor = Color.FromArgb(0, 255, 0);
|
||||
btnStart.Text = Resources.AutoCaptureForm_Execute_Stop;
|
||||
Refresh();
|
||||
|
||||
Timer.Reset();
|
||||
Timer.Start();
|
||||
timerRefresh.Start();
|
||||
UpdateTimer();
|
||||
IsRecording = true;
|
||||
}
|
||||
|
||||
private void UpdateTimer()
|
||||
|
@ -263,6 +261,10 @@ public void ChangeState(ScreenRecordState state)
|
|||
niTray.Text = trayTextAfterStart.Truncate(63);
|
||||
niTray.Icon = Resources.control_record.ToIcon();
|
||||
tsmiStart.Text = Resources.AutoCaptureForm_Execute_Stop;
|
||||
btnStart.Text = Resources.AutoCaptureForm_Execute_Stop;
|
||||
IsRecording = true;
|
||||
break;
|
||||
case ScreenRecordState.AfterRecordingStart:
|
||||
StartRecordingTimer();
|
||||
break;
|
||||
case ScreenRecordState.AfterStop:
|
||||
|
|
|
@ -216,7 +216,8 @@ private static void StartRecording(ScreenRecordOutput outputType, TaskSettings t
|
|||
if (!abortRequested)
|
||||
{
|
||||
screenRecorder = new ScreenRecorder(outputType, options, captureRectangle);
|
||||
screenRecorder.RecordingStarted += () => recordForm.ChangeState(ScreenRecordState.AfterStart);
|
||||
screenRecorder.RecordingStarted += () => recordForm.ChangeState(ScreenRecordState.AfterRecordingStart);
|
||||
recordForm.ChangeState(ScreenRecordState.AfterStart);
|
||||
screenRecorder.StartRecording();
|
||||
|
||||
if (recordForm.AbortRequested)
|
||||
|
|
Loading…
Reference in a new issue