将回调重定向到将功能区功能与共享加载项分开

发布于 2024-10-03 02:59:49 字数 432 浏览 5 评论 0原文

我试图将共享加载项和相应功能区的功能分开(通过功能区设计器或 VS10 中的 XML 集成)。解决方案上下文是由多个项目构建的,其中加载项本身代表一个主机,该主机具有与运行时加载的另一个程序集的接口。在此程序集中,我想访问共享加载项 (connect.cs) 中实现的功能区的回调方法。我尝试注入功能区的 MSProject2010 应用程序包装在该程序集中,以授予对 Project 实例的访问权限。

主机中有一个 Startup() 函数,它扫描特定目录中的所有程序集并将其与正确的接口集成。因此,位于程序集中的 AddIn_Startup(Params) 函数是通过接口调用的,这里是上下文,我想在其中访问我的功能区回调。

现在,如何通过共享加载项将回调从 MSProject 应用程序路由到程序集中?

另一个问题:如何通过外部程序集访问自定义功能区? (相同环境)

最诚挚的问候

I’m trying to separate the functionality of a shared-add-in and a corresponding Ribbon (integrated through Ribbon Designer or XML in VS10). The solution context is build with several projects in which the add-in itself represents a host with an interface to another assembly that is loaded on runtime. In this assembly I want to get access to the callback methods of the Ribbon implemented in the shared-add-in (connect.cs). The MSProject2010-application I tried to inject the Ribbon is wrapped in that assembly to grant access to the instance of Project.

In the Host is a Startup()-Function that scans through all assemblies in a specific directory and integrates the one with the right interface. So, the AddIn_Startup(Params)-Function located in the assembly is called through the interface and here is the context, where I want to get access to my Ribbon-callbacks.

Now, how is it possible to route the Callbacks from the MSProject-application, through the shared-add-in into the assembly?

Another question: How is it possible to access a custom Ribbon through an external assembly? (Same environment)

Best regards

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

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

发布评论

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

评论(1

夜未央樱花落 2024-10-10 02:59:49

我自己找到了解决方案。

问题在于共享插件的上下文。与通过 VSTO 实现的方式相比,操作 Ribbon 环境要复杂一些。我将共享插件转换为 MSProject2010-Addin,然后将功能区本身传递到界面中。这可以通过使用功能区设计器制作功能区来实现,该功能区设计器将功能区注册到由插件提供的 Globals 类中。 (全局.丝带.丝带名称.丝带)。另一方面,我将此对象投射到 OfficeRibbon 中并将其分配给空的 OfficeRibbon。在这里,我可以操作和更改功能区的属性并创建事件处理程序。在运行时期间不可能向功能区添加选项卡、按钮或其他控件!至少我找不到办法做到这一点。

I found a solution myself.

The problem is the context of the shared-addin. It's complicated to manipulate a Ribbon environment compared to the way it is realizable via VSTO. I turned the shared-addin into a MSProject2010-Addin and then I pass the Ribbon itself as into the interface. This is possible by making a Ribbon with the Ribbon Designer that registers the Ribbon in the Globals class, that is delivered by the Addin. (Globals.Ribbons.RibbonName.Ribbon). On the other side I cast this object into a OfficeRibbon and assign it to an empty OfficeRibbon. Here I can manipulate and alter the properties of the ribbon and create EventHandlers. It is NOT possible to add Tabs, Buttons or other Controls to the Ribbon during runtime! At least I could not find a way to do that.

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