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