Minor refact

This commit is contained in:
niksedk 2023-08-15 19:32:38 +02:00
parent b3bd422260
commit 6a80c278a3
5 changed files with 9 additions and 20 deletions

View File

@ -48,7 +48,6 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
public bool IncompleteModel { get; set; }
public string IncompleteModelName { get; set; }
private static bool? _cudaNoDevice { get; set; }
private static bool? _cudaSomeDevice { get; set; }
public Subtitle TranscribedSubtitle { get; private set; }
@ -1752,16 +1751,12 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
private static void OutputHandlerCheckCuda(object sendingProcess, DataReceivedEventArgs outLine)
{
if (string.IsNullOrWhiteSpace(outLine.Data))
if (string.IsNullOrEmpty(outLine.Data))
{
return;
}
if (outLine.Data.Contains("CUDA device: 0"))
{
_cudaNoDevice = true;
}
else if (outLine.Data.Contains("CUDA device:"))
if (!outLine.Data.Contains("CUDA device: 0") && outLine.Data.Contains("CUDA device:"))
{
_cudaSomeDevice = true;
}

View File

@ -2817,8 +2817,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
if (!e.Cancel)
{
e.Cancel = true;
e.Cancel = true; // Hack as FormClosing will crash if any Forms are created here (e.g. a msgbox).
_forceClose = true;
_dialogResult = DialogResult;
SynchronizationContext.Current.Post(TimeSpan.FromMilliseconds(10), () =>

View File

@ -13242,9 +13242,8 @@ namespace Nikse.SubtitleEdit.Forms
if (!e.Cancel)
{
e.Cancel = true;
e.Cancel = true; // Hack as FormClosing will crash if any Forms are created here (e.g. a msgbox).
_forceClose = true;
// To allow windows in FormClosing...
SynchronizationContext.Current.Post(TimeSpan.FromMilliseconds(10), () => Application.Exit());
}
}

View File

@ -8229,9 +8229,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
if (!e.Cancel)
{
e.Cancel = true;
// To allow windows in FormClosing...
e.Cancel = true; // Hack as FormClosing will crash if any Forms are created here (e.g. a msgbox).
_forceClose = true;
_dialogResult = DialogResult;
System.Threading.SynchronizationContext.Current.Post(TimeSpan.FromMilliseconds(10), () =>

View File

@ -333,9 +333,7 @@ namespace Nikse.SubtitleEdit.Forms
if (!e.Cancel)
{
e.Cancel = true;
_forceClose = true;
e.Cancel = true; // Hack as FormClosing will crash if any Forms are created here (e.g. a msgbox). _forceClose = true;
_dialogResult = DialogResult;
System.Threading.SynchronizationContext.Current.Post(TimeSpan.FromMilliseconds(10), () =>
{