简体   繁体   English

WPF WinFormsHost中托管的CefSharp WinForms浏览器

[英]CefSharp WinForms browser hosted within WPF WinFormsHost

I'm currently working on moving out kiosk software that runs Awesomium away and instead onto CefSharp. 我目前正在研究移出运行Awesomium的信息亭软件,而转而使用CefSharp。 Our main application is written in WPF and this work is using v45 of CefSharp 我们的主要应用程序是用WPF编写的,这项工作是使用CefSharp v45

I'm aware that the WPF control has some serious performance issues, when compared side-by-side with the WinForms version hosted in a WindowsFormsHost, the smoothness of transitions etc is MUCH better. 我知道WPF控件存在一些严重的性能问题,与WindowsFormsHost中托管的WinForms版本并排比较时,过渡等的平滑性要好得多。

To that end I'm looking to stick with this approach of embedding the WinForms ChromiumWebBrowser inside a WindowsFormsHost on the WPF window. 为此,我希望坚持在WPF窗口的WindowsFormsHost内嵌入WinForms ChromiumWebBrowser的方法。 This all works and however I'm having issues with getting touch support to work. 所有这些都有效,但是我在获得触摸支持方面遇到问题。 Our kiosks have touch screens and run Windows 7 / 8.1, the touch works flawlessly with the WPF control, however when using the WinForms embedded one touch doesn't work at-all. 我们的信息亭具有触摸屏并运行Windows 7 / 8.1,使用WPF控件可以完美地实现触摸,但是当使用嵌入式WinForms时,完全不能使用一键操作。 As well as touch not working it also steals all Keyboard events and consumes them internally it seems, as none of my event handlers ever fire on the main WPF window. 触摸不起作用的同时,它还会窃取所有Keyboard事件并在内部使用它们,因为我的事件处理程序都没有在WPF主窗口上触发过。

If anyone has any ideas or can point me in the correct direction to try and solve this it would be hugely appreciated! 如果有人有任何想法或可以指出正确的方向尝试解决此问题,将不胜感激!

Thanks 谢谢

The scenario your talking about is not well supported and as such there is not a lot of information. 您所讨论的场景没有得到很好的支持,因此没有很多信息。 A lot of the problem your are seeing are likely because CEF is running it's message loop in a separate thread. 您看到的很多问题都有可能是因为CEF在单独的线程中运行它的消息循环。 If you turn MultiThreadedMessageLoop off, then you become responsible for calling Cef.DoMessageLoopWork() . 如果关闭MultiThreadedMessageLoop ,则您将负责调用Cef.DoMessageLoopWork() I recently added a rough demo the WinForms Example . 我最近添加了一个粗略的演示WinForms Example You can likely port this to WPF , though I've never tried. 您可能可以将此端口移植到WPF ,尽管我从未尝试过。

You are in somewhat uncharted territory there, so you'll have to do most of the leg work yourself. 您在那里有些未知的领域,因此您必须自己完成大部分腿部工作。

For reference there are some ways to improve the WPF performance. 供参考,有一些方法可以改善WPF性能。 They come with their own set of drawbacks though. 但是,它们也有自己的缺点。 See https://github.com/cefsharp/CefSharp/blob/cefsharp/45/CefSharp.Example/CefExample.cs#L58 参见https://github.com/cefsharp/CefSharp/blob/cefsharp/45/CefSharp.Example/CefExample.cs#L58

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM