怎么样做

1 在VS2005中新建类库程序。

编写Windows Live Writer高亮插件 简单插件开发(三)

2添加 WindowsLive.Writer.Api.dll程序集引用(位于LiveWriter程序集目录下)

右键->添加引用

 编写Windows Live Writer高亮插件 简单插件开发(三)

选择WindowsLive.Writer.Api.dll (位于Live Writer目录下)

编写Windows Live Writer高亮插件 简单插件开发(三)

要让人家来自动调用你,你就得引用,到这一步基本工作算是做完了。

 

3  添加类LiveWriterAdapter 继承于 ContentSource

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", "插件代码块", PublisherUrl = "http://www.cnblogs.com/yaoshiyou/", ImagePath = "image.incode.bmp", Description = "插入代码块")] [InsertableContentSource("插入代码块")] public class LiveWriterAdapter : ContentSource { /// <summary> /// 重写的CreateContent方法 /// </summary> /// <param name="dialogOwner"></param> /// <param name="content">返回给主机的内容</param> /// <returns>DialogResult.Ok </returns> public override DialogResult CreateContent(IWin32Window dialogOwner, ref string content) { content = "hello plugin"; return DialogResult.OK; } } }

相关文章: