Do not allow the application to be closed while the screen recording is active

This commit is contained in:
Jaex 2023-04-01 05:40:46 +03:00
parent 5fa77b5d32
commit 51c879bc92

View file

@ -1244,8 +1244,20 @@ private async Task PrepareCaptureMenuAsync(ToolStripMenuItem tsmiWindow, EventHa
public void ForceClose()
{
forceClose = true;
Close();
if (ScreenRecordManager.IsRecording)
{
// TODO: Translate
if (MessageBox.Show("ShareX cannot be closed while screen recording is active.\r\n\r\nDo you want to abort the active screen recording?", "ShareX",
MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
ScreenRecordManager.AbortRecording();
}
}
else
{
forceClose = true;
Close();
}
}
#region Form events