VSTO Sample in Visio SDK - Where is the Event Queued?

Started by dmschneide, February 03, 2017, 11:44:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dmschneide

I have a very newbie question.

I'm trying to understand the C# VSTOAddIn example that comes with the Visio 2013 SDK.  The code to handle the event is straightforward, but what I can't seem to track down is where the event is queued.  I assumed it was being generated when the template is used to create a new document, but I looked in the template and stencil and I'm not seeing it.

Anyone got a pointer for me?

TIA
David

Nikolay

#1
Which event are you talking about? Do you mean Startup event? Or?

JohnGoldsmith

#2
I'm guessing you're talking about the Persistent event in the template (and therefore any drawing document created from it).

If you have the SDK installed you should find the Persistent Events tool appear in the Developer tab in Visio.  The one embedded in the template in the sample fires the DocumentOpened event with an args string that is then parsed by the code in sample.  [update] I'll correct that I think - The one embedded in the template in the sample adds an event (DocumentOpened) to the eventlist of the Document.  When the event is raised it runs an Addon (QueueMarkerEvent addon) passing in an args string (/soln=VSTOAddIn /cmd=1) that is parsed by the code in sample.

Using persistent events with the QueueMarkerEvent addon in this way allows your code to just listen for Marker events rather than listening for every DocumentOpened/Created and wire up further listening if it turns out you're dealing with your solution's document type.

There's only a limited set of events are persistable, but have a look at some of the drawings that rely on backing addons like Org Chart and Timeline to see other examples using the SDK tool.

Does that make sense?

I give events a light covering in my video on Channel 9 if that helps you.  See the second video for the events part.

Best regards

John
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/

dmschneide

Yes, it was the persistent event in the template which I couldn't track down, and the Persistent Events tool shows it clearly.

I had already been through both your videos in Channel 9 (thanks for the great content!) but I either missed or didn't realize the tool was what I wanted if you covered it.

Thanks for the prompt and useful feedback
David