Redirecting callbacks to separate Ribbon-functionality from shared add-in
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
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.
精彩评论