开发者

Call an C# Add-In method directly from a shape-action

I have the following setting: I wrote an add-in for Visio 2010 with VSTO and this add-in adds another ribbon to the UI. From this user-interface, it is possible to open new forms and do some cool stuff.

With the elder version of the tool I rewrote, it was possible to right-click on a shape and open a form directly from the shape. This was done, by adding an action to the shape that looked like:

=RUNADDON("VS2.EXE")

where VS2.exe was the executable that opened another form (which had to be in the search-path of Visio).

My question is, if there is an easy way of calling a method in the add-in/ribbon from inside of the shape action or not? Something like:

=RUNADDON("MyAddIn.MyMethod()")

Related information I found (but didn't answer this question) were

  • How to call a VSTO AddIn method from a separate C# project?
  • http://msdn.microsoft.com/en-us/library/bb608621.aspx
  • http://msdn.microsoft.com/en-us/library/aa200979%28office.10%29.aspx
  • http://msdn.microsoft.com/en-us/library/ff767833.aspx

T开发者_开发百科hanks for any reply or suggestion.


If you want to call an action in your add-in from the ShapeSheet, then you need to raise an event using either of the two following functions:

QUEUEMARKEREVENT("My ContextString") See https://msdn.microsoft.com/en-us/library/office/ff767955.aspx

RUNADDONWARGS("QueueMarkerEvent","My ContextString") See https://msdn.microsoft.com/EN-US/library/office/ff768158.aspx

The first one is newer and made specifically for this purpose. Your add-in needs to be listening to the Application.MarkerEvent to capture the raised events.

There are examples in the Visio SDK

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜