<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.1" -->
<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/"
	>

<channel>
	<title>IProgrammable &#187; Vista Sidebar Gadget</title>
	<link>http://www.iprogrammable.com</link>
	<description>Kawalerowicz Consulting News</description>
	<pubDate>Thu, 21 Jan 2010 16:11:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>
	<language>en</language>
			<item>
		<title>Developing Vista Sidebar Gadget with Script#</title>
		<link>http://www.iprogrammable.com/2008_01_19/developing-vista-sidebar-gadget/en/</link>
		<comments>http://www.iprogrammable.com/2008_01_19/developing-vista-sidebar-gadget/en/#comments</comments>
		<pubDate>Sat, 19 Jan 2008 13:08:37 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[MSBuild]]></category>

		<category><![CDATA[Vista Sidebar Gadget]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2008_01_19/developing-vista-sidebar-gadget/</guid>
		<description><![CDATA[C# to JavaScript compiler? What? Jea! I thought the same way. It&#8217;s amazing what smart people can invent. My men is Nikhil Kothari with his Script#. What do I need the C# to JavaScript compiler for, you ask. Is IL not enough? Well think of enriching your ASP.NET web sites with JavaScript written in C#. [...]]]></description>
			<content:encoded><![CDATA[<p>C# to JavaScript compiler? What? Jea! I thought the same way. It&#8217;s amazing what smart people can invent. My men is <a href="http://www.nikhilk.net/">Nikhil Kothari</a> with his Script#. What do I need the C# to JavaScript compiler for, you ask. Is IL not enough? Well think of enriching your ASP.NET web sites with JavaScript written in C#. Or using Ajax with scripts written in Visual Studio with Intelisense and refactoring. Or developing the Vista Sidebar Gadgets without writing a single line of code in Javascript!</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/01/image4.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/01/image-thumb4.png" style="border: 0px none " alt="Leasing Calculator" align="right" border="0" height="162" width="162" /></a> I instantly lookd at the third possibility. since I have Vista on board I was thinking about writing my own Sidebar Gadget (you know the little programs written in HTML an JavaScript, sticked to the right side of your screen). Of course I wonted it to by at least useful ;-) I thought about writing a small Leasing Calculator. I had my leasing mathematics library ready, but it was written in C#. I didn&#8217;t feel like rewriting it in JavaScript - what for? So Script# was a blast for me. I had my Leasing Calculator gadget in view hours.</p>
<p>What do you need to start working with Script#:</p>
<p>1. download the latest binaries from <a href="http://www.nikhilk.net/Project.ScriptSharp.aspx">Script# project page</a></p>
<p>2. install it</p>
<p>3. create new <em>Visual C# -&gt; Script# -&gt; Sidebar Gadget</em> project in Visual Studio</p>
<p>You will get quite useful project template. The inside of Content folder is your gadget. If you compile everything Script# will transform your C# into JavaScript and place it in this folder. The last thing you have to do is to copy this folder into your Vista Gadgets folder (<em>C:\Users\user\AppData\Local\Microsoft\Windows Sidebar\Gadgets\</em>). You will have to do the same every time you will compile. Surely it is something to automate. The easiest way is to use the Post-build event in your project and a small MSBuild script that will copy the needed files to the place they should by.</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/01/image5.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/01/image-thumb5.png" style="border: 0px none " alt="VS2005 post build event" border="0" height="396" width="542" /></a></p>
<p>$(WinDir)\Microsoft.NET\Framework\v2.0.50727\msbuild.exe $(SolutionDir)build.msbuild</p>
<p>And use this script:</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">Project </span><span style="color: red">DefaultTargets</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Deploy</span>&#8221; <span style="color: red">xmlns</span><span style="color: blue">=</span>&#8220;<span style="color: blue">http://schemas.microsoft.com/developer/msbuild/2003</span>&#8220;<span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">PropertyGroup</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">DeploymentFolder</span><span style="color: blue">&gt;</span>YourVistaGadgetFolder.gadget<span style="color: blue">&lt;/</span><span style="color: #a31515">DeploymentFolder</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">PropertyGroup</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">ItemGroup</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">DeploymentSourceFiles </span><span style="color: red">Include</span><span style="color: blue">=</span>&#8220;<span style="color: blue">LeasingCalculatorContent***.*</span>&#8221; <span style="color: blue">/&gt;
  &lt;/</span><span style="color: #a31515">ItemGroup</span><span style="color: blue">&gt;
   &lt;</span><span style="color: #a31515">Target </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Deploy</span>&#8220;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">RemoveDir </span><span style="color: red">Directories</span><span style="color: blue">=</span>&#8220;<span style="color: blue">$(DeploymentFolder)</span>&#8221; <span style="color: red">ContinueOnError</span><span style="color: blue">=</span>&#8220;<span style="color: blue">false</span>&#8220;<span style="color: blue">&gt;&lt;/</span><span style="color: #a31515">RemoveDir</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Copy </span><span style="color: red">SourceFiles</span><span style="color: blue">=</span>&#8220;<span style="color: blue">@(DeploymentSourceFiles)</span>&#8221;
      <span style="color: red">DestinationFiles</span><span style="color: blue">=</span>&#8220;<span style="color: blue">@(DeploymentSourceFiles-&gt;
      &#8216;$(DeploymentFolder)%(RecursiveDir)%(Filename)%(Extension)&#8217;)</span>&#8220;<span style="color: blue">/&gt;
   &lt;/</span><span style="color: #a31515">Target</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">Project</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<p>So you are equipped with fully functional development platform for Vista Sidebar Gadgets.</p>
<p>One more thing. I do think that writing a JavaScript in C# is a good idea ;) but if you are new to Sidebar Gadgets you probably would like to take one <a href="http://microsoftgadgets.com/Sidebar/DevelopmentOverview.aspx">step by step tutorial</a>. It would help to understand Gadgets on the low level an d will get you up to speed with Schipr# later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2008_01_19/developing-vista-sidebar-gadget/en/feed/en/</wfw:commentRss>
		</item>
	</channel>
</rss>
