Tutorials to .com

Tutorials to .com » Dotnet » Control-and-components » Visual Studio.NET in the use of custom plug-ins to maximize your productivity (a)

Visual Studio.NET in the use of custom plug-ins to maximize your productivity (a)

Print View , by: iSee ,Total views: 10 ,Word Count: 1024 ,Date: Thu, 21 May 2009 Time: 2:02 PM

This article assumes that you are already familiar with c #, Visual Basic. NET and CLR

The degree of difficulty 1 2 3

Abstract

For developers, no matter how powerful integrated development environment (IDE) needs to have the function of custom plug-ins. For this reason, Visual Studio. NET IDE provides a scalable, easy to add but also did not limit on the number of custom plug-in function. The custom plug-ins can use Visual Basic, C, C++ # or the other. NET's use of language to write. This article explains how Visual Studio. NET to add a custom plug-in example. This example will demonstrate how to complete a custom plug-ins to customize the text editing features, which has two functions, one is simple in the text to insert the current date, and the other is more complex function is to achieve re-format section of the text. Finally you will learn how to increase in the Options dialog box in a page.

If you start using Microsoft Visual Studio. NET, you should know that he is full of new features and technology. Although, you are willing to be that the integrated development environment (IDE) is a simple code to prepare a text editor, it has been very strong. It provides the framework to support the development of tools for insertion and can be a single seamless development. Of course, IDE, and can not satisfy all people, you or I have to function may not be here. Fortunately IDE has provided a scalable feature that allows you to expand you need anything.

Start

Plug-ins and macros are two ways to expand the IDE. Macros can be recorded and implemented immediately. Therefore, it is a powerful object model to explore methods. The use of a macro. Vsmacros the form of document distribution, by double-clicking the file to load to the macro editor. Macro can be used in the load, the macro can be very easy to user changes.

On the other hand, plug-in is compiled and can not be modified after distribution. This protects your intellectual property. Through plug-ins, you can create a tool window for these operations for the Visual Studio.NET as the local operations are functioning. Plug-ins can dynamically change menus, toolbars and the status of events to help increase the information dialog box. Plug-in installed through Microsoft documents (. MSI) to be deployed, it can be easily installed and through the Control Panel Add / Remove Programs dialog box to uninstall.

Steps to create a plug-in online help of Visual Studio.NET has been hidden, the same is Visual Studio.NET Automation Examples Web site has been hidden. I do not want to introduce a specific process, but I can look back to create a plug-in the course of their choice.

Create a plug-in must first create a project, in the New project (New Projects) dialog box, other items (Other Projects) below, you will find that the expansion project (Extensibility Projects). Select Visual Studio.NET add-ins (Visual Studio.NET Add-in). Figure I shows a point in the new project dialog box. Click OK button to start the wizard.




Figure 1 to create a new project

Plug-ins for me, the first three steps of the wizard are relatively easy. A first step, I chose the C # language as the development of language plug-ins. The second step, I chose the Microsoft Visual Studio.NET as a plug-in host (host). In your plug-in you can, of course, including VSMacros IDE. The third step, plug-in named "Text Editing Utilites", and gives the appropriate description.




Figure 2

In the wizard's fourth step, as shown in Figure 2, the need for some operations.

l Select "Yes, create a Tools menu item."

l OK "I do not provide the add-ins ... ..." not be selected. This case I did not intend to provide a model for user interface, but if you really want more plug-ins to expand your capabilities, you can choose this.

l OK "I want my add-ins in the host program to load at startup" not be selected. This keeps the debugging is easier. Users can plug-in plug-ins in the future management of the operation to change this option.

l I chose "I'm not the add-ins ... ..." option. In my computer I am a real user, the same I confirm that this example is to more developers. This option is to change the plug-ins only registered users.

The fifth step, you can include some help information. Select the check box, enter any contact information. Now, you can complete the Wizard, the beginning of our plug-ins.

Here is a list of objects Connect method. These methods is incomplete, you can find such Connect.cs document. Those of your new project.

l Connect:: Connect. This is the constructor, where you can do simple initialization.

l Connect:: OnConnection. This method is a real IDE plug-ins to load when you call. Here you can initialize your plug-in, and must be ordered to provide information for the IDE, the development of keyboard bindings and so on.

l Connect:: QueryStatus. This approach is at an appropriate time to determine the current state of IDE is called.

l Connect:: Exec. This method is really the implementation of IDE command is invoked.

Now, the basis of the contents of all here, let us begin to develop a simple example plug-ins.


.Net Control and components Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.