[英]Is it possible to embed Windows Sidebar Widgeds in own .Net Application
I'm trying to embed Windows-Sidebar-Widgets into my own .Net Application (WPF and C#), but I dont't realy know where to start. 我试图将Windows侧边栏小部件嵌入到自己的.Net应用程序(WPF和C#)中,但我真的不知道从哪里开始。 I googled a bit but only found SDK and tutorials for widget-development.
我在Google上搜索了一下,但只找到了用于小部件开发的SDK和教程。 I found that there is a small service in Windows, running the widgets.
我发现Windows中有一个运行小部件的小型服务。 My thought was that I could perhaps fake this service and provide his functions whithin my programm, so that I can run and show the widgets.
我的想法是,我可能会伪造该服务,并在程序中提供他的功能,以便我可以运行和显示小部件。
Does anyone have some tips on how to do this? 有人对如何执行此操作有一些提示吗? Or some experience in doing so?
或这样做的经验? Perhaps there is even some kind of libary for that kind of stuff?
也许对于这类东西甚至有某种图书馆?
If this is not possible it is also an option to switch to an OpenSource widged-manager to use this widgeds, but this is only an emergency solution and the windows-gadgeds would be very appreciated. 如果无法做到这一点,也可以选择切换到一个开放源代码的widged-manager来使用此widged,但这只是一种紧急解决方案,windows-gadged非常感谢。
Some information about my system: 有关我的系统的一些信息:
I've written some kind of small windowmanager for childwindows in my application. 我在应用程序中为子窗口编写了某种小型的窗口管理器。 And on the top of this I want to show the widgets in some kind of HostWindow.
在此之上,我想在某种HostWindow中显示小部件。
Any hint will be appreciated. 任何提示将不胜感激。
PS: I would be willing to share the results if I (or we) get this working :-) PS:如果我(或我们)可以完成此工作,我将愿意分享结果:-)
I've never seen a library for hosting gadgets, but since they are basically just websites you could use the MSHTML component to host any arbitrary gadget in theory. 我从未见过用于托管小工具的库,但是由于它们基本上只是网站,因此从理论上讲,您可以使用MSHTML组件托管任何任意小工具。
This isn't to say it will be easy. 这并不是说这很容易。
You'll need to extract a gadget to some temporary directory, spin up something hosting MSHTML (in WinForms WebBrowser would be convenient), navigate to the appropriate file in that temp directory (discovered by parsing gadget.xml ), and shove something resembling the System object into the gadget. 您需要将小工具提取到某个临时目录,旋转托管MSHTML的内容(在WinForms WebBrowser中会很方便),导航到该temp目录中的适当文件(通过解析gadget.xml来发现),并进行类似于将系统对象放入小工具。
As a starting point, inject some script that sets System = window.external;
首先,注入一些设置
System = window.external;
脚本System = window.external;
onload and WebBrowerser.ObjectForScripting = new FakeGadgetSystem()
. onload和
WebBrowerser.ObjectForScripting = new FakeGadgetSystem()
。
FakeGadgetSystem
will need [ComVisible(true)]
and to implement a decent amount of stuff. FakeGadgetSystem
将需要[ComVisible(true)]
并实现大量的内容。 I'd advise grabbing a widget or two to test with that mildly exercise the Gadget API, and then slowly implement the calls they make. 我建议抓住一个或两个小部件来进行测试,以轻度地练习Gadget API,然后慢慢实现它们进行的调用。 It'll be a long haul for 100% compatibility with the official gadget hosting service.
与官方小工具托管服务100%兼容将是一个漫长的过程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.