Awesomium multithreading c#?

146 views Asked by At

So I'm trying to figure out a way to run 2 or more processes of Webview at the same time? I saw that I could accomplish this with multithreading but Awesomium dosen't support this and it just gives me an error:

Awesomium.Core.AweInvalidOperationException: 'The calling thread cannot access this object because a different thread owns it.'

How can I do this?

my code:

first class:

secondclass sclass = new secondclass();
Thread nakedCPH = new Thread(() => sclass.run(name));
nakedCPH.Start();

second class:

internal ThreadStart runNakedCPH(string v)
{
    MessageBox.Show(v);
    throw new NotImplementedException();
}
1

There are 1 answers

0
Enigmativity On BEST ANSWER

Try this:

Thread nakedCPH = new Thread(() =>
{
    secondclass sclass = new secondclass();
    sclass.run(name);
});
nakedCPH.Start();

The problem you'll get is if the MessageBox.Show(v); is running on this new thread. It'll fail because you can only call UI functions on the UI-thread.