Closed Xohn closed 9 years ago
What exactly is Cef.Form
? Do you mean WinForms
?
If you try the CefSharp.WinForms.Example
, there is Edit -> Copy Source To Clipboard (async)
, does that work for you?
Yeah i means WinForms.
Try to Call Edit -> Copy Source To Clipboard (async) into my code. And i check my clopboard,nothing happened to it.
Hmm, works fine for me.
Anyways, your original problem is likely one of threading. NavStateChanged
is executed on CEF
UI
thread, and your also trying to Wait
on code that will be executed on a CEF
thread.
You can either
ContinueWith
and have the code execute on a .Net
thread (depending on what your doing it may need to be the UI
thread, your example is pretty basic, so I can't really tell).Thanks a lot. I use Continewith and everything works fine. Really appreciate your help ,and wish my experience can help other people.
Really appreciate your help ,and wish my experience can help other people.
No problem. Threading
issues are pretty common, I've marked this as faq-able
, in the hopes it's easier to find for others.
@Xohn , @amaitland
Hi, buddy,
I meet the same problem, and I tried the CefSharp.WinForms.Example, there is Edit -> Copy Source To Clipboard (async)
, It works fine.
in that kind, the code seems in the same thread of winform UI, but why that happend?
I tried to click the button before the browser finished the page, and this time it didn't work ,and the whole application seemed died already.
I want to say, in this example , the GetSourceAsync() code is in the same thread of winform UI? right?
if I accept waiting for a while. like I saw the page finished and then click the button. how can I do that in the code?
I tries to get html source via GetSourceAsync() after page load completed,but it failed to get anything.And if i try to load another uri ,it win't react if i have GetSourceAsync() in my code. I'm wondering what's wrong to my code?
cefsharp version:41.0.0 My code:
For my test,I put two MessageBox ,one before GetSourceAsync() ,and one after GetSourceAsync() . The first MessageBox will show,and the second never show up.