<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>&amp;lt;nick:node&amp;gt; : Code Sample</title><link>http://blogs.msdn.com/nick_wong/archive/tags/Code+Sample/default.aspx</link><description>Tags: Code Sample</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>MSDN Subscriber Evening - Building UX with Silverlight 2</title><link>http://blogs.msdn.com/nick_wong/archive/2008/04/14/msdn-subscriber-evening-building-ux-with-silverlight-2.aspx</link><pubDate>Tue, 15 Apr 2008 00:26:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8392879</guid><dc:creator>niwong</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/nick_wong/comments/8392879.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nick_wong/commentrss.aspx?PostID=8392879</wfw:commentRss><description>&lt;p&gt;I did a session last Wednesday (9 Apr) -- introducing our Rich Internet Application technology Silverlight to our MSDN subscribers.&lt;/p&gt; &lt;p&gt;In the session, we re-acquainted with Silverlight 1.0 and its AJAX-like programming model, but dedicated most of the time to introduce Silverlight and the new .NET development paradigm.&lt;/p&gt; &lt;p&gt;&lt;a href="http://cid-55329c755a41293f.skydrive.live.com/self.aspx/Microsoft%20Singapore%20.NET%20Briefings%20Content/MSDN%20Subscriber%20Evening%209%20April%202008"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" border="0" alt="Comic Viewer Sample" align="left" src="http://blogs.msdn.com/blogfiles/nick_wong/WindowsLiveWriter/MSDNSubscriberEveningBuildingUXwithSilve_13826/image_3.png" width="244" height="229"&gt;&lt;/a&gt;I've put the slides from the presentation, as well as the comics-book viewer sample project used for the code walk-through on my SkyDrive and you can find them &lt;a href="http://cid-55329c755a41293f.skydrive.live.com/self.aspx/Microsoft%20Singapore%20.NET%20Briefings%20Content/MSDN%20Subscriber%20Evening%209%20April%202008" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;The sample code demonstrates Silverlight 2 controls (particularly Layout), control data-binding, asynchronous data fetching and LINQ. Much of the work was based off samples by &lt;a href="http://blogs.msdn.com/jstegman" target="_blank"&gt;Joe Stegman&lt;/a&gt; and &lt;a href="http://weblogs.asp.net/scottgu" target="_blank"&gt;Scott Guthrie&lt;/a&gt;.&amp;nbsp; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8392879" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Learning+More/default.aspx">Learning More</category><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Code+Sample/default.aspx">Code Sample</category><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>Sample Code: Silverlight 1.0-enabled Quiz</title><link>http://blogs.msdn.com/nick_wong/archive/2008/02/29/sample-code-silverlight-1-0-enabled-quiz.aspx</link><pubDate>Fri, 29 Feb 2008 18:43:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8239250</guid><dc:creator>niwong</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/nick_wong/comments/8239250.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nick_wong/commentrss.aspx?PostID=8239250</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/nick_wong/WindowsLiveWriter/SampleCodeSilverlightenabledQuiz_C989/image_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="195" alt="image" src="http://blogs.msdn.com/blogfiles/nick_wong/WindowsLiveWriter/SampleCodeSilverlightenabledQuiz_C989/image_thumb.png" width="258" align="left" border="0"&gt;&lt;/a&gt;A Customer who asked if a quiz-type application can be enabled by Silverlight.&amp;nbsp; &lt;/p&gt; &lt;p&gt;The answer is yes (obviously &lt;img alt="smile_regular" src="http://spaces.live.com/rte/emoticons/smile_regular.gif"&gt;) and I had to put my rusty coding skills to work over a good part of a Saturday afternoon. &lt;/p&gt; &lt;p&gt;The result is a &lt;strong&gt;Silverlight 1.0&lt;/strong&gt; proof-of-concept application, which meant adopting an "AJAX-styled" coding model with JavaScript. In fact, just for the heck of it, I wanted to go the full client-only approach which meant no ASP.NET AJAX server-side controls, etc.&lt;/p&gt; &lt;p&gt;The code demos a couple of simple features:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Quiz questions are easily configurable with a XML data file. The Silverlight application accesses the quiz as JSON data with a simple web service. This was simply achieved by first converting the XML data to JSON format at the server-side with &lt;strong&gt;XmltoJSON&lt;/strong&gt; C# code (made available at &lt;a title="" href="http://www.phdcc.com/xml2json.htm"&gt;http://www.phdcc.com/xml2json.htm&lt;/a&gt;). To allow the web service to be accessible (invoke-able) by the client JavaScript, I also marking the web service with the &lt;font face="Courier New" size="2"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/system.web.script.services.scriptserviceattribute.aspx"&gt;System.Web.Script.Services.ScriptService&lt;/a&gt; attribute.&amp;nbsp; &lt;/li&gt; &lt;li&gt;An auto timeout (set to 10 seconds) is set for each quiz, this is done with a XAML animation storyboard to mimic a timer. &lt;strong&gt;Jesse Liberty&lt;/strong&gt; details this useful technique in his blog &lt;a href="http://silverlight.net/blogs/jesseliberty/archive/2007/12/09/did-you-know-that-you-can-create-a-timer-using-xaml-animation.aspx"&gt;here&lt;/a&gt;.&lt;/li&gt; &lt;li&gt;At the client end, I dabbled a little with the JavaScript &lt;a href="http://prototypejs.org/"&gt;Prototype library&lt;/a&gt; to demonstrate interaction between the Silverlight application and the host browser's DOM. &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;The application can definitely do with polishing (e.g., with some creative design work, one can imagine fireworks animation when the user gets a correct answer,) but this should serve as a nice simple base for extensions, tearing apart, etc.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Links:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;The source code is available for download at my SkyDrive &lt;a href="http://cid-55329c755a41293f.skydrive.live.com/self.aspx/Code/SilverlightQuiz/SilverlightQuiz.zip"&gt;here&lt;/a&gt;. &lt;/li&gt; &lt;li&gt;The application can also be viewed online &lt;a href="http://www.nicknode.net/mediacorpquiz"&gt;here&lt;/a&gt;.&amp;nbsp; &lt;/li&gt;&lt;/ul&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8239250" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Learning+More/default.aspx">Learning More</category><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Code+Sample/default.aspx">Code Sample</category><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>Microsoft Singapore .NET Briefing - Web UX Technologies</title><link>http://blogs.msdn.com/nick_wong/archive/2008/02/12/microsoft-singapore-net-briefing-web-ux-technologies.aspx</link><pubDate>Tue, 12 Feb 2008 23:19:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7672358</guid><dc:creator>niwong</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/nick_wong/comments/7672358.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nick_wong/commentrss.aspx?PostID=7672358</wfw:commentRss><description>&lt;p&gt;On 30th January, we did the first of a planned series of web-related technology talk events -- this time focusing on Web User Experience (UX). I'd like to thank everyone who attended and stayed back late (we overran by 45 minutes!)&amp;nbsp; I think we had a lively time.&lt;/p&gt; &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="211" alt="Building the PlayHellgate London Silverlight site" src="http://blogs.msdn.com/blogfiles/nick_wong/WindowsLiveWriter/MicrosoftSi.NETBriefingWebUXTechnologies_AD8B/hgl_sl2_3.jpg" width="339" border="0"&gt; &lt;/p&gt; &lt;p&gt;We covered the following in the 3 hour presentation session:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;An overview of the spectrum of Microsoft's user experience technologies. This spans from the &lt;em&gt;ubiquitous web-based&lt;/em&gt; (such as &lt;a title="ASP.NET AJAX" href="http://asp.net/ajax/" target="_blank"&gt;ASP.NET AJAX&lt;/a&gt;) to rich user interfaces leveraging &lt;em&gt;platform capabilities&lt;/em&gt; (such as &lt;a href="http://windowsclient.net/learn/videos_wpf.aspx" target="_blank"&gt;Windows Presentation Foundation&lt;/a&gt;, Windows Mobile), and finally to the new class of &lt;em&gt;Rich Internet Applications&lt;/em&gt; (enabled by &lt;a href="http://silverlight.net/" target="_blank"&gt;Silverlight&lt;/a&gt;.) We also showed (or, in a specific instance, attempted to show &lt;img alt="smile_regular" src="http://spaces.live.com/rte/emoticons/smile_regular.gif"&gt;) real-life applications deployed by customers / partners using these technologies. &lt;/li&gt; &lt;li&gt;&lt;a href="http://innovativesingapore.com/blogs/jocelyn/" target="_blank"&gt;Jocelyn&lt;/a&gt; (our ISV Developer Evangelist) then did a code-talk / demo session on ASP.NET AJAX. Be sure to check out the &lt;a href="http://www.asp.net/ajax/ajaxcontroltoolkit/" target="_blank"&gt;ASP.NET AJAX Control Toolkit&lt;/a&gt; -- you saw how easy it was to add interactivity to ASP.NET web applications! &lt;/li&gt; &lt;li&gt;We had &lt;strong&gt;Yong Hwee&lt;/strong&gt; from &lt;a href="http://www.patroids.com/" target="_blank"&gt;patroids creative works&lt;/a&gt; who shared first-hand experience on developing their first project on Silverlight.&lt;/li&gt; &lt;li&gt;I then did a code demo on how we actually developed a real-world Silverlight 1.0 application using Visual Studio and JavaScript. Of course, you can also build video-rich application in 7 steps, and no code with &lt;a href="http://www.microsoft.com/expression/products/overview.aspx?key=encoder" target="_blank"&gt;Expression Media Encoder&lt;/a&gt;.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;My presentation decks for the session can be found on my &lt;a href="http://skydrive.live.com/" target="_blank"&gt;SkyDrive&lt;/a&gt;. You can find Jocelyn's presentation deck (&lt;strong&gt;Overview of ASP.NET AJAX&lt;/strong&gt;) &lt;a href="http://innovativesingapore.com/blogs/jocelyn/archive/2008/02/08/net-briefing-overview-of-asp-net-ajax.aspx" target="_blank"&gt;here&lt;/a&gt;. &lt;/p&gt; &lt;p&gt;I have also uploaded my two slide decks, which can be accessed from the links below:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="Microsoft &amp;amp; Web 2.0 - UX Technologies.pdf" href="http://cid-55329c755a41293f.skydrive.live.com/self.aspx/Microsoft%20Singapore%20.NET%20Briefings%20Content/20080130%20-%20Web%20UX/Microsoft%20|0%20Web%202.0%20-%20UX%20Technologies.pdf" target="_blank"&gt;Microsoft &amp;amp; Web 2.0 - UX Technologies.pdf&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="Building a Rich Internet Application with Silverlight 1.0.pdf" href="http://cid-55329c755a41293f.skydrive.live.com/self.aspx/Microsoft%20Singapore%20.NET%20Briefings%20Content/20080130%20-%20Web%20UX/Building%20RIAs%20with%20Silverlight%201.pdf" target="_blank"&gt;Building a Rich Internet Application with Silverlight 1.0.pdf&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;(I will be sharing the Silverlight demo code as I clean it up for public consumption, so do check back this blog again in a week or so...)&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;font color="#868686" size="4"&gt;Prelude&lt;/font&gt;&lt;/strong&gt;:&lt;/p&gt; &lt;p&gt;Do keep a look out for the next event entitled "&lt;strong&gt;Building Web 2.0 Mash-ups&lt;/strong&gt;" -- where we will talk and demo building &lt;strong&gt;&lt;a href="http://www.facebook.com" target="_blank"&gt;Facebook&lt;/a&gt;&lt;/strong&gt; applications with Visual Studio, creating mash-ups with &lt;strong&gt;&lt;a href="http://dev.live.com/" target="_blank"&gt;Windows Live Services&lt;/a&gt;&lt;/strong&gt;, and introduce cool technologies like &lt;strong&gt;&lt;a href="http://www.popfly.ms/" target="_blank"&gt;PopFly&lt;/a&gt;&lt;/strong&gt;, etc.&amp;nbsp;&amp;nbsp; &lt;/p&gt; &lt;p&gt;This scheduled for the evening of &lt;strong&gt;12 March 2008&lt;/strong&gt; -- keep it free!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7672358" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Event+Announcements/default.aspx">Event Announcements</category><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Learning+More/default.aspx">Learning More</category><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Code+Sample/default.aspx">Code Sample</category><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>CodeProject Article: Silverlight Controls - The Path to Reusable XAML</title><link>http://blogs.msdn.com/nick_wong/archive/2007/12/25/codeproject-article-silverlight-controls-the-path-to-reusable-xaml.aspx</link><pubDate>Tue, 25 Dec 2007 04:13:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6857015</guid><dc:creator>niwong</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/nick_wong/comments/6857015.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nick_wong/commentrss.aspx?PostID=6857015</wfw:commentRss><description>&lt;p&gt;Came across this very nice article by &lt;a href="http://www.codeproject.com/script/Membership/Profiles.aspx?mid=4805713"&gt;Justin-Josef Angel&lt;/a&gt; on the &lt;a href="http://www.codeproject.com"&gt;Code Project&lt;/a&gt; web site -- &lt;a href="http://www.codeproject.com/KB/silverlight/PathToReusableXAML.aspx"&gt;&lt;strong&gt;Silverlight Controls - The Path to Reusable XAML&lt;/strong&gt;&lt;/a&gt;. &lt;/p&gt; &lt;p&gt;I've been working on a few Silverlight 1.0 projects recently, and a consistent struggle on these has been to maintain data-presentation separation, as well as to adhere to object-oriented principles when dealing with JavaScript and XAML. &lt;/p&gt; &lt;p&gt;This article provides the clearest, most prescriptive guidance I've seen to-date on the use of the &lt;a href="http://en.wikipedia.org/wiki/JavaScript#Prototype-based_features"&gt;JavaScript Prototype pattern&lt;/a&gt; to support as "code-behind" for XAML-defined user-interface elements.&amp;nbsp; &lt;/p&gt; &lt;p&gt;&lt;img height="367" alt="JellyBar - One Object Many Instances" hspace="0" src="http://blogs.microsoft.co.il/blogs/justinangel/WindowsLiveWriter/SilverlightControlsThepathtoreuseableXAM_AD24/image_fbbb36ee-4524-4817-bcf3-30d3c2d3ab97.png" width="640" border="0"&gt;&lt;/p&gt; &lt;p&gt;Justin-Angel does a code walk-through that refactors &lt;a href="http://joestegman.members.winisp.net/Jelly/Bar.htm"&gt;Richard Z's JellyBar sample&lt;/a&gt; (which emits XAML dynamically in code with JavaScript) into a "&lt;strong&gt;One JavaScript class - One XAML file&lt;/strong&gt;" model. The result, as the author says, is "it's extensible, it's maintainable, it's object oriented."&lt;/p&gt; &lt;p&gt;Also check out the cool trick with with Visual Studio 2008 JavaScript comments syntax in building the "class constructor" function! &lt;/p&gt; &lt;p&gt;To all who celebrate, Merry Christmas! &lt;img alt="smile_regular" src="http://spaces.live.com/rte/emoticons/smile_regular.gif"&gt;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:908459e3-bffd-4742-949f-a16c56f14b78" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/silverlight" rel="tag"&gt;silverlight&lt;/a&gt;,&lt;a href="http://technorati.com/tags/javascript" rel="tag"&gt;javascript&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6857015" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Learning+More/default.aspx">Learning More</category><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Code+Sample/default.aspx">Code Sample</category><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>I Want Dinner Now!</title><link>http://blogs.msdn.com/nick_wong/archive/2007/02/05/i-want-dinner-now.aspx</link><pubDate>Mon, 05 Feb 2007 18:54:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1604819</guid><dc:creator>niwong</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/nick_wong/comments/1604819.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nick_wong/commentrss.aspx?PostID=1604819</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://dinnernow.net/downloads/videos/Scenario1_web/flash/default.html" atomicselection="true"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="196" src="http://blogs.msdn.com/blogfiles/nick_wong/WindowsLiveWriter/IWantDinnerNow_14F73/dinnernow4.jpg" width="240" align="left" border="0"&gt;&lt;/a&gt;This is it - the "mother of all demos": The&amp;nbsp;demo with EVERYTHING (well, almost... &lt;img alt="smile_regular" src="http://spaces.live.com/rte/emoticons/smile_regular.gif"&gt;&amp;nbsp;) - &lt;strong&gt;ASP.NET 2.0&lt;/strong&gt;, &lt;strike&gt;Atlas&lt;/strike&gt; &lt;strong&gt;ASP.NET AJAX&lt;/strong&gt;, all the .NET 3.0 components (&lt;strong&gt;Windows CardSpace&lt;/strong&gt;, &lt;strong&gt;Windows Communications Foundation&lt;/strong&gt;, &lt;strong&gt;Windows Workflow Foundation&lt;/strong&gt;, &lt;strong&gt;Windows Presentation Foundation&lt;/strong&gt;), &lt;strong&gt;Windows Live Maps&lt;/strong&gt;, &lt;strong&gt;Vista Sidebar Gadgets&lt;/strong&gt;, &lt;strong&gt;PowerShell&lt;/strong&gt;, &lt;strong&gt;.NET Compact Framework&lt;/strong&gt;, ....&lt;/p&gt; &lt;p&gt;Click the image on the left to see a demo walkthrough &lt;a href="http://dinnernow.net/downloads/videos/Scenario1_web/flash/default.html"&gt;video&lt;/a&gt;; then go download the&amp;nbsp;&lt;a href="http://www.codeplex.com/dinnernow/release/projectreleases.aspx"&gt;source code&lt;/a&gt; from &lt;a href="http://www.codeplex.com/"&gt;CodePlex&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Now, if we can only tie in an &lt;a href="http://blogs.msdn.com/nick_wong/archive/2007/02/03/office-business-applications-obas.aspx"&gt;OBA&lt;/a&gt; in there somewhere (dinner ordering from Outlook, anyone?) and life will be so sweet!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1604819" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nick_wong/archive/tags/.NET+Framework/default.aspx">.NET Framework</category><category domain="http://blogs.msdn.com/nick_wong/archive/tags/Code+Sample/default.aspx">Code Sample</category></item></channel></rss>