mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Fix toast notification settings not being respected in OCR
This commit is contained in:
parent
c49d641972
commit
d860104a08
1 changed files with 9 additions and 8 deletions
|
@ -1312,10 +1312,11 @@ public static async Task OCRImage(Bitmap bmp, TaskSettings taskSettings = null,
|
||||||
{
|
{
|
||||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||||
|
|
||||||
await OCRImage(bmp, taskSettings.CaptureSettingsReference.OCROptions, filePath);
|
bool notificationsEnabled = taskSettings.GeneralSettings.ShowToastNotificationAfterTaskComplete;
|
||||||
|
await OCRImage(bmp, taskSettings.CaptureSettingsReference.OCROptions, filePath, notificationsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task OCRImage(Bitmap bmp, OCROptions options, string filePath = null)
|
private static async Task OCRImage(Bitmap bmp, OCROptions options, string filePath = null, bool notificationsEnabled = true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1325,7 +1326,7 @@ private static async Task OCRImage(Bitmap bmp, OCROptions options, string filePa
|
||||||
{
|
{
|
||||||
if (options.Silent)
|
if (options.Silent)
|
||||||
{
|
{
|
||||||
await AsyncOCRImage(bmp, options, filePath);
|
await AsyncOCRImage(bmp, options, filePath, notificationsEnabled);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1348,9 +1349,9 @@ private static async Task OCRImage(Bitmap bmp, OCROptions options, string filePa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task AsyncOCRImage(Bitmap bmp, OCROptions options, string filePath = null)
|
private static async Task AsyncOCRImage(Bitmap bmp, OCROptions options, string filePath = null, bool notificationsEnabled = true)
|
||||||
{
|
{
|
||||||
ShowNotificationTip(Resources.OCRForm_AutoProcessing);
|
if (notificationsEnabled) ShowNotificationTip(Resources.OCRForm_AutoProcessing);
|
||||||
|
|
||||||
string result = null;
|
string result = null;
|
||||||
|
|
||||||
|
@ -1372,11 +1373,11 @@ private static async Task AsyncOCRImage(Bitmap bmp, OCROptions options, string f
|
||||||
File.WriteAllText(textFilePath, result, Encoding.UTF8);
|
File.WriteAllText(textFilePath, result, Encoding.UTF8);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowNotificationTip(Resources.OCRForm_AutoComplete);
|
if (notificationsEnabled) ShowNotificationTip(Resources.OCRForm_AutoComplete);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowNotificationTip(Resources.OCRForm_AutoCompleteFail);
|
if (notificationsEnabled) ShowNotificationTip(Resources.OCRForm_AutoCompleteFail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2182,4 +2183,4 @@ public static bool IsUploadAllowed()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue