Simple plug-in development for compiling Windows Live writer highlight plug-in (3)

Source: Internet
Author: User
Why?

 

How to do

1. Create a class library in vs2005Program.

2 add windowslive. Writer. API. dll Assembly reference (located in the livewriter Assembly directory)

Right-click and choose add reference.

 

Select windowslive. Writer. API. dll (in the live writer directory)

To let people call you automatically, You have to reference it. The basic work at this step is complete.

3 Add the livewriteradapter class to inherit from contentsource

 Livewriteradapter completion code  Using System; Using System. Collections. Generic; Using System. text;Using Windowslive. Writer. API; Using System. Windows. forms; Namespace Codemarksframework. livewriter. plugins {[writerplugin (" CA5ACC8E-5007-4df8-B110-DD6420C4CD4F "," Plug-insCodeBlock ", Publisherurl =" Http://www.cnblogs.com/yaoshiyou/ ", ImagePath =" Image.incode.bmp ", Description =" Insert code block ")] [Insertablecontentsource (" Insert code block ")]Public   Class Livewriteradapter: contentsource { /// <Summary>          /// Override the createcontent Method          /// </Summary>          /// <Param name = "dialogowner"> </param>          /// <Param name = "content"> content returned to the host </param>          /// <Returns> dialogresult. OK </returns>          Public   Override Dialogresult createcontent (iwin32window dialogowner, Ref   String Content) {content =" Hello plugin "; Return Dialogresult. OK ;}}}

 

4. Explanation

/// <Summary>/// Override the createcontent Method/// </Summary>/// <Param name = "dialogowner"> </param>/// <Param name = "content"> content returned to the host </param>/// <Returns> dialogresult. OK </returns>Public OverrideDialogresult createcontent (iwin32window dialogowner,Ref StringContent) {content ="Hello plugin";ReturnDialogresult. OK ;}

In this step, our simple plug-in is complete.

4. Add an event Generation Command Line for debugging

We can adjust the window program. How can we debug the plug-in program? Only the host can call it and modify the application properties. After the project is generated, copy the generated DLL program to the plug-in directory. (C: \ Program Files \ Windows Live \ writer \ plugins is the writer plug-in directory)

Xcopy/D/y/R "$ (targetpath)" "C: \ Program Files \ Windows Live \ writer \ plugins"

The plug-in has been generated successfully. Open liverwriter to see if the plug-in has been successfully added. Click it and try to see if it has inserted Hello plugins.

More links

Compile Windows Live writer highlight plug-in Directory

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.