< Free Open Study > 

Running the Code for Multiple Languages

You have completed the modifications to the add-in to handle multiple languages. Next you will run just a couple of the features to show the results of the enhancements. Now most of the features in the add-in can do their respective jobs regardless of the type of code in which the user is programming.

Block Commenting C# Code

You have already seen that the add-in can comment blocks of Visual Basic code. Now you will see the results of running the code when the user is programming in C#. Put the add-in in debug mode so that a second instance of the Visual Studio IDE will be automatically started. When it opens, open a C# Windows application and select some lines for commenting. After connecting the add-in by going to the Add-in Manager, click the add-in's menu item to display the SmartDesktop UI form. Next, click the Block Comment node of the TreeView and the C# code is commented as shown in Figure 10-8.

click to expand
Figure 10-8: C# block commented code

Cloning a Proc in C# Code

Admittedly, this feature is not as useful in C# as it is in Visual Basic, but nevertheless, the code works the same as it does for a user programming in Visual Basic. The only caveat is that the user must select the whole procedure in C# prior to clicking the Clone Procedure option in the add-in's UI. Figure 10-9 shows the code in the CloneProc form after I have changed the name by appending "Cloned" to the end of the name.

click to expand
Figure 10-9: CloneProc form with the C# procedure being cloned

Once you have changed the name, click the Paste To Module button and the cloned C# method is inserted at the end of the class. Figure 10-10 shows the cloned code.

click to expand
Figure 10-10: Cloned C# procedure inserted in the class

 < Free Open Study > 

Writing Add-Ins for Visual Studio  .NET
Writing Add-Ins for Visual Studio .NET
ISBN: 1590590260
EAN: 2147483647
Year: 2002
Pages: 172
Authors: Les Smith © 2008-2017.
If you may any questions please contact us: