<?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>My Silverlight Blog : WebClient</title><link>http://blogs.msdn.com/timrule/archive/tags/WebClient/default.aspx</link><description>Tags: WebClient</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>WebClient and LINQ Demo</title><link>http://blogs.msdn.com/timrule/archive/2008/06/29/webclient-and-linq-demo.aspx</link><pubDate>Mon, 30 Jun 2008 00:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8668585</guid><dc:creator>Tim Rule</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/timrule/comments/8668585.aspx</comments><wfw:commentRss>http://blogs.msdn.com/timrule/commentrss.aspx?PostID=8668585</wfw:commentRss><description>&lt;P&gt;This sample illustrates a simple usage of the WebClient and a LINQ query. The WebClient makes requests to an RSS feed from Adobe's &lt;A href="http://labs.adobe.com/wiki/index.php/Kuler#kuler_APIs" mce_href="http://labs.adobe.com/wiki/index.php/Kuler#kuler_APIs"&gt;kuler API&lt;/A&gt; which contains color themes defined by kuler users. The themes are then used to colorize an illustration. Silverlight has a SyndicationFeed Class which is designed to work with feeds. This demo however, utilizes the WebClient to show how a xml request can be queried by LINQ.&lt;/P&gt;
&lt;P&gt;Select various color themes in the demo below to colorize the picture. &lt;/P&gt;
&lt;P&gt;&lt;IFRAME style="WIDTH: 500px; HEIGHT: 425px" src="http://silverlight.services.live.com/invoke/63894/WebClient%20LINQ%20Demo/iframe.html" frameBorder=0 scrolling=no mce_src="http://silverlight.services.live.com/invoke/63894/WebClient%20LINQ%20Demo/iframe.html"&gt;&lt;/IFRAME&gt;&lt;/P&gt;
&lt;P&gt;The WebClient makes a URI request to the RSS service. The result is handled by a DownloadStringCompleted handler.&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" border=0 alt=image src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/WebClientandLINQDemo_CBDF/image_11.png" width=636 height=230 mce_src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/WebClientandLINQDemo_CBDF/image_11.png"&gt; &lt;/P&gt;
&lt;P&gt;The LINQ builds and array of objects of an inferred type. There is also a swatches array object that is built from a LINQ sub query.&lt;A href="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/WebClientandLINQDemo_CBDF/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/WebClientandLINQDemo_CBDF/image_2.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" border=0 alt=image src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/WebClientandLINQDemo_CBDF/image_thumb.png" width=615 height=204 mce_src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/WebClientandLINQDemo_CBDF/image_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I've added an AnimateColor method to the Animate class used in previous blog posts. The method builds a ColorAnimationUsingKeyFrames animation with with a start and finish SplineColorKeyFrame to support weighted animations.&lt;/P&gt;
&lt;P&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" border=0 alt=image src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/WebClientandLINQDemo_CBDF/image_5.png" width=555 height=40 mce_src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/WebClientandLINQDemo_CBDF/image_5.png"&gt;&lt;/P&gt;
&lt;P&gt;To make this sample image I used Microsoft Expression Designer. First I drew a simple solid color illustration. I then made a compound path with the similar colored objects. Making the compound path puts the grouped shapes into one path. This means the entire image is defined as just 5 Path elements when exported to XAML. &lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" border=0 alt=ImageSteps src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/WebClientandLINQDemo_CBDF/ImageSteps_3.png" width=492 height=155 mce_src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/WebClientandLINQDemo_CBDF/ImageSteps_3.png"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8668585" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/timrule/attachment/8668585.ashx" length="47576" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/timrule/archive/tags/effects/default.aspx">effects</category><category domain="http://blogs.msdn.com/timrule/archive/tags/silverlight/default.aspx">silverlight</category><category domain="http://blogs.msdn.com/timrule/archive/tags/silverlight+2+beta+2/default.aspx">silverlight 2 beta 2</category><category domain="http://blogs.msdn.com/timrule/archive/tags/WebClient/default.aspx">WebClient</category></item></channel></rss>