In my toolbox, I have created a customer tab called "Code Snippets".
As you might have guessed, "Code Snippets" contains a number of
resuable code snips that I would like to share with members of my
team.
In leiu of sharing the TOOLBOX.TBD file, I would like to create an
application that would do help me in sharing the contents of my "Code
Snippets" tab.
My application would work something like this.
1. The app would prompt you for the name of the toolbox tab to
export.
2. A list of all the items in the tab would be displayed.
3. You would select the items you want to export.
4. The exported items are written to an XML file.
5. Next, the XML file can be shared with other team members.
6. They will run the same application. However, this time they would
choose to import the XML. Selecting only the items they want.
I have looked at EnvDTE, but I am not sure if this is the right
approach.
Any thoughts would be appreciated.
Thanks.
Steve
Tim Farley - 30 Sep 2004 17:01 GMT
> In leiu of sharing the TOOLBOX.TBD file, I would like to create an
> application that would do help me in sharing the contents of my "Code
> Snippets" tab.
Yes, this is totally doable. I would approach it as follows:
Use the wizard to create a new ADDIN for Visual Studio.
In the UISetup part of your OnConnection interface, I would use
AddNamedCommand() to create "export" and "import" commands. (The wizard code
includes one command so you can crib from that).
I would add your "export" and "import" commands to the right-click menu for
the toolbox, seems like the most logical place to do it. That would work
something like this:
(cmdExport is the return value from AddNamedCommand, app is your cached
pointer to the DTE object)
// Get the right-click menu for the toolbox
popupMenu = app.CommandBars["Toolbox Tab"];
Microsoft.Office.Core.CommandBarButton export =
(Microsoft.Office.Core.CommandBarButton)cmdExport.AddControl(popupMenu,
popupMenu.Controls.Count );
export.Style = MsoButtonStyle.msoButtonAutomatic;
export.BeginGroup = true;
(In the above case I'm adding it as the last item on the menu and putting it
into its own group).
In the QueryStatus and Exec, implement handlers for your export and import
commands. (Again, you can crib from the example the wizard provides). Of
course what UI you provide is up to you, it could be a dialog or whatever.
Hope that helps.
--Tim Farley