mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-13 21:21:03 +00:00
Fix STAThreadAttribute issue
This commit is contained in:
parent
85ba0c14be
commit
bab0a3bba2
|
@ -9,6 +9,7 @@ using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.ServiceProcess;
|
using System.ServiceProcess;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Tesseract;
|
using Tesseract;
|
||||||
using WelsonJS.Service;
|
using WelsonJS.Service;
|
||||||
|
@ -357,15 +358,20 @@ public class ScreenMatch
|
||||||
// if use Clipboard
|
// if use Clipboard
|
||||||
if (isUseSampleClipboard)
|
if (isUseSampleClipboard)
|
||||||
{
|
{
|
||||||
try
|
Thread th = new Thread(new ThreadStart(() =>
|
||||||
{
|
{
|
||||||
Clipboard.SetImage(croppedBitmap);
|
try
|
||||||
parent.Log($"Copied to the clipboard");
|
{
|
||||||
}
|
Clipboard.SetImage(croppedBitmap);
|
||||||
catch (Exception ex)
|
parent.Log($"Copied the image to Clipboard");
|
||||||
{
|
}
|
||||||
parent.Log($"Error in Clipboard: {ex.Message}");
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
|
parent.Log($"Error in Clipboard: {ex.Message}");
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
th.SetApartmentState(ApartmentState.STA);
|
||||||
|
th.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if use OCR
|
// if use OCR
|
||||||
|
|
Loading…
Reference in New Issue
Block a user