是否可以在自己的.Net应用程序中嵌入Windows Sidebar Widgeds

发布于 2024-11-07 07:14:08 字数 466 浏览 6 评论 0原文

我正在尝试将 Windows-Sidebar-Widgets 嵌入到我自己的 .Net 应用程序(WPF 和 C#)中,但我真的不知道从哪里开始。我用谷歌搜索了一下,但只找到了用于小部件开发的 SDK 和教程。我发现Windows中有一个小服务,运行小部件。我的想法是,我也许可以伪造此服务并在我的程序中提供他的功能,以便我可以运行并显示小部件。

有人对如何做到这一点有一些建议吗?或者有这样做的经验吗?也许甚至有某种图书馆可以存放这类东西?

如果这是不可能的,也可以选择切换到开源widged-manager来使用这个widgeds,但这只是一个紧急解决方案,windows-gadgeds将非常感激。

有关我的系统的一些信息:

我在我的应用程序中为子窗口编写了某种小型窗口管理器。最重要的是,我想在某种 HostWindow 中显示小部件。

任何提示将不胜感激。

PS:如果我(或我们)成功的话,我愿意分享结果:-)

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. I googled a bit but only found SDK and tutorials for widget-development. I found that there is a small service in Windows, running the widgets. 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.

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.

Any hint will be appreciated.

P.S.: I would be willing to share the results if I (or we) get this working :-)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

当爱已成负担 2024-11-14 07:14:08

我从未见过用于托管小工具的库,但由于它们基本上只是网站,您可以使用 MSHTML 组件理论上可以托管任何任意小工具。

这并不是说这会很容易。

您需要将小工具提取到某个临时目录,启动托管 MSHTML 的内容(在 WinForms WebBrowser 会很方便),导航到该临时目录中的相应文件(通过解析 gadget.xml),并推送类似于 System 对象到小工具中。

首先,注入一些设置 System = window.external; onload 和 WebBrowerser.ObjectForScripting = new FakeGadgetSystem() 的脚本。

FakeGadgetSystem 将需要 [ComVisible(true)] 并实现大量的东西。我建议抓住一两个小部件来测试温和测试 Gadget API,然后慢慢实现它们所做的调用。要与官方小工具托管服务 100% 兼容,还需要很长时间。

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.

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.

As a starting point, inject some script that sets System = window.external; onload and WebBrowerser.ObjectForScripting = new FakeGadgetSystem().

FakeGadgetSystem will need [ComVisible(true)] and to implement a decent amount of stuff. 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. It'll be a long haul for 100% compatibility with the official gadget hosting service.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文