锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
[鏃墮棿]:2009-10-04
[鎽樿]: 寮鍙戜竴涓猈indows Live Writer鎻掍歡錛屽湪鍐欏崥瀹㈡椂錛屾坊鍔犺嚜宸辯殑浠g爜鏍峰紡銆傛渶緇堟晥鏋滄槸錛屽湪Windows Live Writer涓変腑浠g爜錛岀劧鍚庣偣鍑繪彃浠訛紝灝嗕唬鐮佸寘鍚湪<div class="mycode">your code</div>涓?
[鍏抽敭瀛梋: plugin銆乄indows Live Writer銆乧ode銆乫ormat銆乭ighlight銆?鎻掍歡銆佸崥瀹€乥log銆乵si銆乸ackage銆佹墦鍖呫丆#銆佸墠緙銆佸悗緙銆佺畝鍗曚唬鐮併佹牱寮?br />
[鐜]: Windows Live Writer 14.0.8089.726 zh-cn, Visual Studio 2008 , Windows XP SP3 , Wordpress 2.8.4
[浣滆匽:Winty (wintys@gmail.com) http://m.tkk7.com/wintys
[姝f枃]:
寮鍙戜竴涓猈indows Live Writer鎻掍歡錛屽湪鍐欏崥瀹㈡椂錛屾坊鍔犺嚜宸辯殑浠g爜鏍峰紡銆傛渶緇堟晥鏋滄槸錛屽湪Windows Live Writer涓変腑浠g爜錛岀劧鍚庣偣鍑繪彃浠訛紝灝嗕唬鐮佸寘鍚湪<div class="mycode">your code</div>涓傚綋鐒惰鍦ㄦ渶緇堝彂琛ㄧ殑鍗氬涓婃坊鍔?mycode 鐨凜SS鏍峰紡鎵嶆湁鏁堟灉銆?/p>
.mycode鏍峰紡濡備笅:
閫変腑浠g爜錛岀偣鍑?WintyCodeArea":
鏁堟灉濡備笅鍥?/pre>(鍦╓riter闇鍚敤"浣跨敤涓婚緙栬緫"錛屽茍宸蹭粠鍗氬涓幏鍙栦富棰橈紝鎵嶈兘绔嬪嵆鐪嬪埌鏁堟灉):![]()
0銆佸噯澶囧伐浣?/h3>
- 鍦╒isual Studio 2008涓柊寤篊#"Class Library"欏圭洰
- 鍦ㄩ」鐩腑娣誨姞References:"C:\Program Files\Windows Live\Writer\WindowsLive.Writer.Api.dll"
- 鍦ㄩ」鐩睘鎬х殑"Build Events"=>"Post Build Event command line"娣誨姞:(XCOPY /D /Y /R "$(TargetPath)" "C:\Program Files\Windows Live\Writer\Plugins")
1銆?Class Library"涓葷被錛岀戶鎵夸簬ContentSource
WintyCodeArea.cs:
using System.Windows.Forms;
using WindowsLive.Writer.Api;/*
2009-10-02http://m.tkk7.com/wintys
*/
namespace MyWindowsLiveWriterPlugin
{
/*Plugin 涓葷被*/
[WriterPlugin("{7DFB5431-D7DA-4e61-9E4B-056D30DFDB63}",
"WintyCodeArea",
PublisherUrl = "http://m.tkk7.com/wintys",
ImagePath = "image.jpg",
HasEditableOptions = true,
Description = "Insert <div class=\"mycode\">your code</div>\nhttp://m.tkk7.com/wintys\nwintys@gmail.com")]
[InsertableContentSource("WintyCodeArea")]
public class WintyCodeArea : ContentSource
{
WintyCodeAreaSettings m_settings;public override void Initialize(IProperties pluginOptions)
{
base.Initialize(pluginOptions);
m_settings = new WintyCodeAreaSettings(pluginOptions);
}
public override DialogResult CreateContent(IWin32Window dialogOwner, ref string content)
{
string originalContent = content;content = m_settings.FrontCode;
if(m_settings.EscapeCode)
content += System.Web.HttpUtility.HtmlEncode(originalContent);
else
content += originalContent;
content += m_settings.BackCode;return DialogResult.OK;
}public override void EditOptions(IWin32Window dialogOwner)
{
SettingForm settingForm = new SettingForm(m_settings);
settingForm.ShowDialog(dialogOwner);
}
}
}
Initialize()銆丒ditOptions()騫朵笉鏄繀欏葷殑錛岃繖閲屽洜涓虹敤鍒頒簡"璁劇疆閫夐」"紿楀彛錛屾墠闇瑕併?/p>
CreateContent(IWin32Window dialogOwner, ref string content)鍦ㄦ涓哄繀欏伙紝content浼犲叆鍊間負Live Writer褰撳墠琚変腑鐨勯珮浜尯鐨凥TML浠g爜錛屾棤璁哄湪緙栬緫榪樻槸鍦ㄦ簮浠g爜瑙嗗浘涓兘鏄繖鏍風殑銆俢ontent鐨勪紶鍑哄間負浣犱慨鏀瑰悗鐨凥TML浠g爜錛屾渶緇堝皢鍦↙ive Writer涓樉紺虹殑銆?/p>
鍦–reateContent()涓篃鍙互寮瑰嚭紿椾綋錛屾澶勫茍鏈敤鍒般備互涓嬫槸浠g爜紺轟緥:
public override DialogResult CreateContent(IWin32Window dialogOwner, ref string content)
{
using (InsertCodeForm insertCodeForm = new InsertCodeForm())
{
DialogResult result = insertCodeForm.ShowDialog();
content = insertCodeForm.MyCode;
return result;
}
}鐩稿簲鐨処nsertCodeForm綾葷殑閮ㄥ垎浠g爜濡備笅:
public partial class InsertCodeForm : Form
{
private string m_MyCode;
public string MyCode
{
get { return m_MyCode; }
set { m_MyCode = value; }
}public InsertCodeForm()
{
InitializeComponent();
}private void buttonInsert_Click(object sender, EventArgs e)
{
if (textBoxCode.Text == string.Empty)
{
return;
}m_MyCode = "<div class=\"mycode\">";
m_MyCode += System.Web.HttpUtility.HtmlEncode(textBoxCode.Text);
m_MyCode += "</div>";this.DialogResult = DialogResult.OK;
}
}
2銆佺敤浜庤緗甒intyCodeArea鎻掍歡琛屼負鐨勭被
WintyCodeAreaSettings.cs:
using WindowsLive.Writer.Api;
namespace MyWindowsLiveWriterPlugin
{
class WintyCodeAreaSettings
{
IProperties m_properties;private const string FRONT_CODE = "FRONT_CODE";//鍓嶇紑浠g爜
private const string BACK_CODE = "BACK_CODE";//鍚庣紑浠g爜
private const string ESCAPE_CODE = "ESCAPE_CODE";//鏄惁杞箟浠g爜public const string DEFAULT_FRONT_CODE = "<div class=\"mycode\">";
public const string DEFAULT_BACK_CODE = "</div>";
public const bool DEFAULT_ESCAPE_CODE = false;public WintyCodeAreaSettings(IProperties properties)
{
m_properties = properties;
}public string FrontCode
{
get
{
return m_properties.GetString(FRONT_CODE, DEFAULT_FRONT_CODE);
}
set
{
m_properties.SetString(FRONT_CODE, value);
}
}public string BackCode
{
get
{
return m_properties.GetString(BACK_CODE, DEFAULT_BACK_CODE);
}
set
{
m_properties.SetString(BACK_CODE, value);
}
}public bool EscapeCode
{
get
{
return m_properties.GetBoolean(ESCAPE_CODE, DEFAULT_ESCAPE_CODE);
}
set
{
m_properties.SetBoolean(ESCAPE_CODE, value);
}
}}
}
3銆?璁劇疆紿楀彛"鐨勪唬鐮?
鐐瑰嚮"宸ュ叿=>閫夐」"灝卞彲浠ユ壘鍒拌繖涓緗獥鍙c?/p>
WintyCodeArea鐨勮緗獥鍙?
鎵璋撶殑杞箟鍘熷鍐呭錛屽氨鏄皢鎵閫夊唴瀹逛腑鐨勭壒孌奌TML瀛楃榪涜緙栫爜(絀烘牸涓庢崲琛屼笉鍙?銆?/p>
SettingForm.cs:
using System;
using System.Windows.Forms;namespace MyWindowsLiveWriterPlugin
{
partial class SettingForm : Form
{
WintyCodeAreaSettings m_settings;public SettingForm(WintyCodeAreaSettings settings)
{
InitializeComponent();
//Winty's initialization
m_settings = settings;
txtFrontCode.Text = m_settings.FrontCode;
chkEscapeCode.Checked = m_settings.EscapeCode;
textBackCode.Text = m_settings.BackCode;
}/*淇濆瓨璁劇疆*/
private void btnOK_Click(object sender, EventArgs e)
{
m_settings.FrontCode = txtFrontCode.Text;
m_settings.EscapeCode = chkEscapeCode.Checked;
m_settings.BackCode = textBackCode.Text;Close();
}/*鎭㈠榛樿璁劇疆*/
private void btnRestoreDefault_Click(object sender, EventArgs e)
{
m_settings.FrontCode = WintyCodeAreaSettings.DEFAULT_FRONT_CODE;
m_settings.EscapeCode = WintyCodeAreaSettings.DEFAULT_ESCAPE_CODE;
m_settings.BackCode = WintyCodeAreaSettings.DEFAULT_BACK_CODE;txtFrontCode.Text = m_settings.FrontCode;
chkEscapeCode.Checked = m_settings.EscapeCode;
textBackCode.Text = m_settings.BackCode;
}
}
}
SettingForm.Designer.cs(榪欐槸Visual Studio鏍規嵁璁捐鐨勭獥浣撶敓鎴愮殑浠g爜):
namespace MyWindowsLiveWriterPlugin
{
partial class SettingForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnOK = new System.Windows.Forms.Button();
this.chkEscapeCode = new System.Windows.Forms.CheckBox();
this.labelFont = new System.Windows.Forms.Label();
this.labelBack = new System.Windows.Forms.Label();
this.txtFrontCode = new System.Windows.Forms.TextBox();
this.textBackCode = new System.Windows.Forms.TextBox();
this.btnRestoreDefault = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(222, 211);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(113, 29);
this.btnOK.TabIndex = 0;
this.btnOK.Text = "璁劇疆";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// chkEscapeCode
//
this.chkEscapeCode.AutoSize = true;
this.chkEscapeCode.Location = new System.Drawing.Point(127, 94);
this.chkEscapeCode.Name = "chkEscapeCode";
this.chkEscapeCode.Size = new System.Drawing.Size(96, 16);
this.chkEscapeCode.TabIndex = 1;
this.chkEscapeCode.Text = "杞箟鍘熷鍐呭";
this.chkEscapeCode.UseVisualStyleBackColor = true;
//
// labelFont
//
this.labelFont.AutoSize = true;
this.labelFont.Location = new System.Drawing.Point(48, 12);
this.labelFont.Name = "labelFont";
this.labelFont.Size = new System.Drawing.Size(53, 12);
this.labelFont.TabIndex = 2;
this.labelFont.Text = "鍓嶇紑浠g爜";
//
// labelBack
//
this.labelBack.AutoSize = true;
this.labelBack.Location = new System.Drawing.Point(48, 125);
this.labelBack.Name = "labelBack";
this.labelBack.Size = new System.Drawing.Size(53, 12);
this.labelBack.TabIndex = 4;
this.labelBack.Text = "鍚庣紑浠g爜";
//
// txtFrontCode
//
this.txtFrontCode.Location = new System.Drawing.Point(125, 12);
this.txtFrontCode.Multiline = true;
this.txtFrontCode.Name = "txtFrontCode";
this.txtFrontCode.Size = new System.Drawing.Size(247, 64);
this.txtFrontCode.TabIndex = 5;
//
// textBackCode
//
this.textBackCode.Location = new System.Drawing.Point(125, 125);
this.textBackCode.Multiline = true;
this.textBackCode.Name = "textBackCode";
this.textBackCode.Size = new System.Drawing.Size(247, 64);
this.textBackCode.TabIndex = 6;
//
// btnRestoreDefault
//
this.btnRestoreDefault.Location = new System.Drawing.Point(88, 211);
this.btnRestoreDefault.Name = "btnRestoreDefault";
this.btnRestoreDefault.Size = new System.Drawing.Size(106, 29);
this.btnRestoreDefault.TabIndex = 7;
this.btnRestoreDefault.Text = "鎭㈠榛樿璁劇疆";
this.btnRestoreDefault.UseVisualStyleBackColor = true;
this.btnRestoreDefault.Click += new System.EventHandler(this.btnRestoreDefault_Click);
//
// SettingForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(420, 252);
this.Controls.Add(this.btnRestoreDefault);
this.Controls.Add(this.textBackCode);
this.Controls.Add(this.txtFrontCode);
this.Controls.Add(this.labelBack);
this.Controls.Add(this.labelFont);
this.Controls.Add(this.chkEscapeCode);
this.Controls.Add(this.btnOK);
this.Name = "SettingForm";
this.Text = "WintyCodeArea Settings";
this.ResumeLayout(false);
this.PerformLayout();}
#endregion
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.CheckBox chkEscapeCode;
private System.Windows.Forms.Label labelFont;
private System.Windows.Forms.Label labelBack;
private System.Windows.Forms.TextBox txtFrontCode;
private System.Windows.Forms.TextBox textBackCode;
private System.Windows.Forms.Button btnRestoreDefault;
}
}
4銆佹葷粨
宸ョ▼鏈緇堢敓鎴怶intyCodeArea.dll錛屽皢鍏跺鍒跺埌"C:\Program Files\Windows Live\Writer\Plugins"鐩綍錛屽惎鍔╓indows Live Writer灝卞彲浠ヤ嬌鐢ㄨ繖涓彃浠朵簡銆傛垨灝嗗叾鍋氭垚WintyCodeAreaWLWPluginSetup.msi(瑙侀檮浠?錛岀偣瀹夎鍗沖彲(msi鍒朵綔鏂規硶鍙傝僛11])銆?/p>
姝ゆ彃浠朵富瑕佷緵鑷繁浣跨敤錛屽叾浠栦漢鍙兘涓嶄細鎯寵鎴戠殑榪欑鏁堟灉錛屾墍浠ユ殏鍛藉悕WintyCodeArea銆備絾鏄櫎浜嗘坊鍔?lt;div class="mycode">your code</div>澶栵紝榪樺彲浠ヨ繘琛屼唬鐮佽漿涔夎緗紝騫朵笖鍓嶅悗緙浠g爜閮藉彲浠ヨ嚜瀹氫箟錛屾牴鎹渶瑕佽嚜宸辨坊鍔犲墠緙鍚庣紑浠g爜灝辮浜嗭紝鎵浠ワ紝甯屾湜瀵瑰埆浜烘湁鐐圭敤澶勩?/p>
琛ュ厖:
濡傛灉鎻掍歡闇瑕佽闂壀璐存澘錛屽彲鍙傝冨涓嬩唬鐮?
//System.Windows.Forms.Clipboard
IDataObject iData = Clipboard.GetDataObject();
if (iData.GetDataPresent(DataFormats.Text))
{
str = (String)iData.GetData(DataFormats.Text);
......
}
[鍙傝冭祫鏂橾:
[1]*銆?a >Developing Plugins for Windows Live Writer 銆?: http://www.devx.com/codemag/Article/38214/1954
[2]*銆?a >涓篧indows Live Writer寮鍙戞彃浠?#8212;—InsertSearchPageLink銆?: http://www.cnblogs.com/dflying/archive/2006/12/03/580602.html
[3]*銆?a >Writing a simple Windows Live Writer plugin銆?: http://blog.boyet.com/blog/blog/writing-a-simple-windows-live-writer-plugin/
[4] 銆?a >The New Live Writer SDK銆? http://www.liveside.net/developer/archive/2008/06/03/the-new-live-writer-sdk.aspx
[5] 銆?a >Writing Plugins For Windows Live Writer - Working With Forms銆?nbsp; : http://www.liveside.net/developer/archive/2006/10/19/Writing-Plugins-For-Windows-Live-Writer-_2D00_-Working-With-Forms.aspx
[6] 銆?a >Writing Plugins For Windows Live Writer - Using PluginHttpRequest Instead of HttpWebRequest銆?: http://www.liveside.net/developer/archive/2007/10/20/writing-plugins-for-windows-live-writer-using-pluginhttprequest-instead-of-httpwebrequest.aspx
[7] 銆?a >Windows Live Writer Plugin - Properties Panel銆?: http://blog.benhall.me.uk/2007/09/windows-live-writer-plugin-properties.html
[8] 銆?a >Windows Live Writer Plugin - Display a form / OpenFileDialog銆?: http://blog.benhall.me.uk/2007/09/windows-live-writer-plugin-display-form.html
[9] LiveSide Source Code : http://cid-fabdddc5cad93494.skydrive.live.com/self.aspx/LiveSide%20-%20Public/SourceCode/MyNewPlugin%20-%20Adding%20An%20Icon.zip?wa=wsignin1.0&sa=732043521
[10] 銆?a >Windows Live Writer Plugin - Hello World!銆?: http://blog.benhall.me.uk/2007/09/windows-live-writer-plugin-hello-world.html
[11]*銆?a >Windows Live Writer Plugin - Installation銆?: http://blog.benhall.me.uk/2007/10/windows-live-writer-plugin-installation.html
[12] MSDN Windows Live Writer SDK : http://msdn.microsoft.com/en-us/library/aa738906.aspx
[13] Windows Live Writer Blog : http://www.live-writer.net/
[14] Windows Live Gallery : http://gallery.live.com/results.aspx?bt=9&pl=8
[闄勪歡]:[1] WintyCodeAreaProject.zip(Visual Studio宸ョ▼) : WintyCodeAreaProject.zip
[2] WintyCodeAreaWLWPluginSetup.zip(WintyCodeArea鎻掍歡瀹夎紼嬪簭,msi鏍煎紡) : http://m.tkk7.com/Files/wintys/WintyCodeAreaWLWPluginSetup.zip
鍘熷垱浣滃搧錛岃漿杞借娉ㄦ槑鍑哄銆?br /> 浣滆?Winty (wintys@gmail.com)
鍗氬:http://m.tkk7.com/wintys
]]> 主站蜘蛛池模板: 亚洲午夜成激人情在线影院| 18勿入网站免费永久| 亚洲人成小说网站色| 亚洲国产精品一区二区第一页| 日韩电影免费在线观看视频| 99久久久国产精品免费蜜臀 | 98精品全国免费观看视频| 一级毛片免费视频网站| 亚洲午夜福利在线视频| 亚洲高清资源在线观看| 亚洲乱码日产一区三区| 亚洲另类少妇17p| 国产a不卡片精品免费观看| 搡女人真爽免费视频大全| 国产92成人精品视频免费| 国产精品视频白浆免费视频| 久久久久久久国产免费看| 有色视频在线观看免费高清在线直播 | 亚洲男人第一av网站| 亚洲综合在线另类色区奇米| 亚洲国产精品视频| 精品国产精品久久一区免费式| 日韩免费a级毛片无码a∨ | 亚洲美女大bbbbbbbbb| 亚洲国产精品人久久| 亚洲福利在线观看| 亚洲国产精品无码久久久蜜芽 | 999zyz**站免费毛片| 亚洲阿v天堂在线2017免费| 曰批全过程免费视频免费看 | 永久免费看bbb| 妞干网在线免费观看| 中字幕视频在线永久在线观看免费| 久久午夜夜伦鲁鲁片免费无码影视| 四虎影视成人永久免费观看视频 | 亚洲精品天天影视综合网 | 91成人免费观看| 免费黄色福利视频| 91在线视频免费播放| 免费无码又爽又刺激高潮| 日韩毛片免费在线观看|