<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ticklish Techs &#187; wordpress</title>
	<atom:link href="http://www.ticklishtechs.net/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ticklishtechs.net</link>
	<description>a mostly .NET but also some other cool techs blog</description>
	<lastBuildDate>Wed, 05 Jan 2011 21:44:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Windows Live Writer Plugin for &lt;code&gt; in WordPress</title>
		<link>http://www.ticklishtechs.net/2008/02/21/windows-live-writer-plugin-for-code-in-wordpress/</link>
		<comments>http://www.ticklishtechs.net/2008/02/21/windows-live-writer-plugin-for-code-in-wordpress/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 11:55:17 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[wlw]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2008/02/21/windows-live-writer-plugin-for-code-in-wordpress/</guid>
		<description><![CDATA[I wrote the last posts (and also this one) with Windows Live Writer (aka. WLW). It is a very powerful offline client for writing posts to many different blog systems. Although it is a Microsoft software you can post to WordPress blogs. But I was missing one function I&#8217;m using very often when I write [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote the last posts (and also this one) with <a href="http://windowslivewriter.spaces.live.com">Windows Live Writer</a> (aka. WLW). It is a very powerful offline client for writing posts to many different blog systems. Although it is a Microsoft software you can post to <a href="http://wordpress.org/">WordPress</a> blogs.</p>
<p>But I was missing one function I&#8217;m using very often when I write posts on programming. There is no way in the WYSIWYG editor of WLW to format Text <code>like this</code>. In WordPress you can use the &lt;<code>code&gt;&lt;/code&gt; </code>tags for code-like formatting. But in WLW I had to switch to the <em>HTML Code</em> view to add these tags.</p>
<p>Since there is a good API to add features to WLW I tried to write my first Windows Live Write Plugin:</p>
<pre class="code">[<span style="color: #2b91af">WriterPlugin</span>(<span style="color: #a31515">&quot;{52D29C0E-49E6-4353-B58C-458F86CA1E2B}&quot;</span>,
                                           <span style="color: #a31515">&quot;Inline Code Plugin&quot;</span>)]
[<span style="color: #2b91af">InsertableContentSource</span>(<span style="color: #a31515">&quot;Inline Code&quot;</span>)]
<span style="color: blue">public class </span><span style="color: #2b91af">WlwInlineCodePlugin </span>: <span style="color: #2b91af">ContentSource
</span>{
    <span style="color: blue">public override </span><span style="color: #2b91af">DialogResult </span>CreateContent
                (<span style="color: #2b91af">IWin32Window </span>dialogOwner, <span style="color: blue">ref string </span>newContent)
    {
        <span style="color: #2b91af">InputBox </span>box = <span style="color: blue">new </span><span style="color: #2b91af">InputBox</span>(<span style="color: #a31515">&quot;Insert inline code&quot;</span>,                          <span style="color: #a31515">&quot;Insert the following in a &lt;code&gt; block:&quot;</span>,<span style="color: #a31515">&quot;&quot;</span>);
        <span style="color: #2b91af">DialogResult </span>result = box.ShowDialog(dialogOwner);

        <span style="color: blue">if </span>(result == <span style="color: #2b91af">DialogResult</span>.OK)
            newContent = <span style="color: #a31515">&quot;&lt;code&gt;&quot; </span>+ box.Input + <span style="color: #a31515">&quot;&lt;/code&gt;&quot;</span>;

        <span style="color: blue">return </span>result;
    }
}</pre>
<p>That&#8217;s really all the code (besides the <code>InputBox</code>. Just add the two attributes to a class and override the <code>CreateContent()</code> method. The code in this method is straight forward: Show some dialog, create the new HTML content and return the <code>DialogResult</code>. </p>
<p>After compiling you have to put the dll into the <code>Plugin</code> directory of your WLW installation and you will see a new entry in the <em>Insert </em>menu and on the sidebar. This entry is called &quot;Insert Inline Code&#8230;&quot; (ah, the text from the attribute goes there). When you click it a small dialog asks for the text and if you exit the dialog with the OK button this text is added to your document inside of &lt;<code>Code&gt; </code>tags.</p>
<p>In the zip file you will find the source code and the compiled dll.</p>
<div class="wlWriterSmartContent" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:e23385e6-bfd8-4d82-9d42-62b38f1a2af0" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">
<p> <a href="http://www.ticklishtechs.net/wp-content/uploads/2008/02/wlwcodeplugin.zip">The source code and the plugin</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2008/02/21/windows-live-writer-plugin-for-code-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

