<?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>Silverlight &#124; WPF &#124; Microsoft.Net &#187; c#</title>
	<atom:link href="http://joel.neubeck.net/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://joel.neubeck.net</link>
	<description>Simplifing structure without changing results</description>
	<lastBuildDate>Fri, 01 Apr 2011 21:34:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Nomadic is Hiring &#8211; Experienced .NET Developer</title>
		<link>http://joel.neubeck.net/2010/05/nomadic-net-developer/</link>
		<comments>http://joel.neubeck.net/2010/05/nomadic-net-developer/#comments</comments>
		<pubDate>Wed, 26 May 2010 18:31:30 +0000</pubDate>
		<dc:creator>joel</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Nomadic]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Job]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/?p=465</guid>
		<description><![CDATA[As many of you know I recently joined Nomadic, a a full service branding and interactive digital agency in North Scottsdale.  If you haven&#8217;t heard of Nomadic, check out our site http://www.nomadicagency.com.  We get to work with some amazing brands and develop some really exciting sites as well as online promotions. To keep up with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nomadicagency.com"><img class="alignleft size-full wp-image-466" title="Nomadic" src="http://joel.neubeck.net/wp-content/uploads/2010/05/n57200823107_7173.jpg" alt="" width="200" height="127" /></a>As many of you know I recently joined Nomadic, a a full service branding and interactive  digital agency in North Scottsdale.  If you haven&#8217;t heard of Nomadic, check out our site http://www.nomadicagency.com.  We get to work with some amazing brands and develop some really exciting sites as well as online promotions.</p>
<p>To keep up with the exciting work we have coming in, we are in need of a seasoned .NET developer.  Here is a quick description of the job.</p>
<p><strong>Senior .NET Developer</strong></p>
<p><strong>Key Responsibilities:</strong></p>
<ul>
<li>Serve as the lead programmer on multiple projects.</li>
<li>Ability to estimate project tasks, ensuring delivery of projects on-time and to  specification</li>
<li>Being self-directed and architecturally innovative</li>
<li>Help analyze, design, code, test, debug and provide enhancements to existing software.</li>
<li>Work closely with a team as well as interfacing with various external Client and Business Groups.</li>
</ul>
<p><strong>Qualifications</strong></p>
<ul>
<li>Bachelors Degree, MCSD certification or other advanced level of industry certification.</li>
<li>Minimum five(5) years working experience with Microsoft .Net (ASP.NET, C# and/or VB.NET).
<ul>
<li>Experience using various separation patterns such as: MVC, MVVM and MVP</li>
</ul>
</li>
<li>Minimum two (2) years experience with WCF (Windows Communication Foundation) experience</li>
<li>Minimum five(5) years working experience with SQL Server or other advanced level databases
<ul>
<li>Strong database modeling skills</li>
<li>Experience  with Object-relational mapping (ORM) using Entity Framework, Linq-To-Sql or  <em>NHibernate</em>.</li>
</ul>
</li>
<li>Excellent oral and written professional communication skills that project a positive, professional image.</li>
</ul>
<p>If you are interested in this opportunity please apply by sending a resume to careers@nomadicagency.com.</p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2010/05/nomadic-net-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight how to: RSS feed stored as JSON in Isolated Storage</title>
		<link>http://joel.neubeck.net/2008/03/silverlight-how-to-rss-feed-stored-as-json-in-isolated-storage/</link>
		<comments>http://joel.neubeck.net/2008/03/silverlight-how-to-rss-feed-stored-as-json-in-isolated-storage/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 22:07:51 +0000</pubDate>
		<dc:creator>joel</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[DataContractJsonSerializer]]></category>
		<category><![CDATA[DispatcherTimer]]></category>
		<category><![CDATA[IsolatedStorage]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/2008/03/silverlight-how-to-rss-feed-stored-as-json-in-isolated-storage/</guid>
		<description><![CDATA[This week I was reading two of my favorite Microsoft Evangelist blogs; Kirk Allen Evans&#8217; and Tim Heuer and was inspired to build upon two of their posts. Kirk wrote a great entry on Creating a JSON Service with WebGet and WCF 3.5 and Tim on Calling web services with Silverlight 2. I thought it [...]]]></description>
			<content:encoded><![CDATA[<p>This week I was reading two of my favorite Microsoft Evangelist blogs; <a href="http://blogs.msdn.com/kaevans">Kirk Allen Evans&#8217;</a> and <a href="http://timheuer.com">Tim Heuer</a> and was inspired to build upon two of their posts.  Kirk wrote a great entry on <a href="http://tinyurl.com/3cbld3">Creating a JSON Service with WebGet and WCF 3.5</a> and Tim on<br />
<a href="http://tinyurl.com/3bv5ch">Calling web services with Silverlight 2</a>.  I thought it would be interesting to take the concepts covered in both of these posts and put them together into my own how to.  In my sample I read an RSS feed into a JSON string, stores it in Isolated storage, and displays it in a ListBox.  Once displayed, I will check every 30 seconds to see if the RSS feed has changed.  Out-of-the-box my solution is not practical, but illustrates a flexible technique for caching a serialized collection of data in the event the service is unavailable. </p>
<p>In the first part of my sample I check to see if I have a cache of RSS in Isolated Storage.  If so, I use the &#8220;DataContractJsonSerializer&#8221; class to de-serialize the JSON array.  Once de-serialized, I can bind it to my ListBox control in &#8220;Page.xaml&#8221;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="c-sharp" style="font-family:monospace;">void Page_Loaded(object sender, RoutedEventArgs e)
{
    RssService.RssItem[] items;
    if (_isf.FileExists(&quot;blog.json&quot;))
    {
        //Read from IsolatedStorage the last set of blog entires
        using (IsolatedStorageFileStream isfs = 
         new IsolatedStorageFileStream(&quot;blog.json&quot;, System.IO.FileMode.Open, _isf))
        {
            //Deserialize the JSON array that was stored in Isolated storage.
            DataContractJsonSerializer djson = 
             new DataContractJsonSerializer(typeof(RssService.RssItem[]));
&nbsp;
            items = djson.ReadObject(isfs) as RssService.RssItem[];
&nbsp;
            isfs.Position = 0;
            using (StreamReader sr = new StreamReader(isfs))
            {
                this.txtBlock.Text = sr.ReadToEnd();
            }
            isfs.Close();
        }
        listBox.ItemsSource = items;
    }
&nbsp;
    . . . . . . 
}</pre></td></tr></table></div>

<p>After we update our presentation of RSS, I will insert a animating UserControl to be use when we go to retrieve additional RSS items.  This retrieval from our WCF 3.5 service will be executed every 10 seconds when our &#8220;DispatcherTimer&#8221; fires.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="c-sharp" style="font-family:monospace;">    //insert a UserControl that animates a spinner when we are retrieving 
    //an update of RSS data
    _indicator.HorizontalAlignment = HorizontalAlignment.Center;
    _indicator.VerticalAlignment = VerticalAlignment.Center;
    this.LayoutRoot.Children.Add(_indicator);
    _indicator.Visibility = Visibility.Collapsed;
&nbsp;
    //we will use a timer here to simulate a 5 second delay in grabbing 
    //the next rss update
    _dt.Interval = new TimeSpan(0, 0, 10);
    _dt.Tick += new EventHandler(_dt_Tick);
    _dt.Start();</pre></td></tr></table></div>

<p>Upon successful retrieval from our WCF service, we will update our isolated storage by serializing our array of RssItems[] into JSON, and writing that text to a file.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
</pre></td><td class="code"><pre class="c-sharp" style="font-family:monospace;">void wcf_GetFeedsCompleted(object sender, 
    IsolatedStorage.RssService.GetFeedsCompletedEventArgs e)
{
    try
    {
        RssService.RssItem[] items = e.Result as RssService.RssItem[];
        //if we were able to grab a new set of Rss items then update Isolated storage
        if (items.Length &gt; 0)
        {
            if (_isf.FileExists(&quot;blog.json&quot;))
            {
                _isf.DeleteFile(&quot;blog.json&quot;);
            }
            using (IsolatedStorageFileStream isfs = 
             new IsolatedStorageFileStream(&quot;blog.json&quot;, System.IO.FileMode.Create, _isf))
            {
                //Take the array of RssItem[] objects and convert it to a JSON array.
                DataContractJsonSerializer djson = new DataContractJsonSerializer(items.GetType());
                MemoryStream ms = new MemoryStream();
                djson.WriteObject(ms, items);
&nbsp;
                this.txtBlock.Text = System.Text.Encoding.UTF8.GetString
                   (ms.GetBuffer(), 0, Convert.ToInt16(ms.Length));
&nbsp;
                isfs.Write(ms.GetBuffer(), 0, Convert.ToInt16(ms.Length));
                isfs.Close();
            }
            listBox.ItemsSource = items;
        }
        this.listBox.Opacity = 1;
        _indicator.Animation.Stop();
        _indicator.Visibility = Visibility.Collapsed;
    }
    catch (Exception ex)
    {
        this.txtBlock.Text = ex.Message;
    }
}</pre></td></tr></table></div>

<p>Thanks again to Tim and Kirk for the majority of my example.</p>
<p>Code: <a href="/wp-content/uploads/2008/03/IsolatedStorage.zip" onClick="javascript: pageTracker._trackPageview('/code/IsolatedStorage.zip');">IsolatedStorage.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2008/03/silverlight-how-to-rss-feed-stored-as-json-in-isolated-storage/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Silverlight how to: Frame-by-Frame Animation</title>
		<link>http://joel.neubeck.net/2008/01/silverlight-how-to-frame-by-frame-animation/</link>
		<comments>http://joel.neubeck.net/2008/01/silverlight-how-to-frame-by-frame-animation/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 03:28:34 +0000</pubDate>
		<dc:creator>joel</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/2008/01/silverlight-how-to-frame-by-frame-animation/</guid>
		<description><![CDATA[For the past few weeks, Terralever has been developing our second game using the Silverlight framework. Our first, Zero Gravity was a great success and highlighted the power that Silverlight can bring to casual gaming development. For years, Terralever has been developing games in Flash and is very fortunate to have some incredible flash interactive [...]]]></description>
			<content:encoded><![CDATA[<p>For the past few weeks, Terralever has been developing our second game using the Silverlight framework. Our first, <a href="http://www.ltbennett.com/" target="_blank" title="Zero Gravity"><span>Zero Gravity</span></a> was a great success and highlighted the power that Silverlight can bring to casual gaming development. For years, Terralever has been developing games in Flash and is very fortunate to have some incredible flash interactive developers.</p>
<p>One of the essential elements found in all interactive games is frame-by-frame animations. When a character moves across the screen that movement is a combination of repositioning the character as an element, combined with a sequence of character movements (the animation).  </p>
<p>Now I don&#8217;t pretend to be a Flash developer, but what I have been told is that creating Frame-by-Frame animations in flash is very easy.  You simply create a key frame and insert an object on to that frame.<span>   </span>The combination of all key frames produces the animation sequence.</p>
<p>In Silverlight / Blend 2 December Preview creating this type of animation sequence is more difficult. Storyboards in Silverlight are  independent of any canvases that will contain the individual animation sequences. Creating a key frame in Silverlight, does not generate a new canvas. In our first Silverlight game we achieved frame-by-frame animations by stacking a series of frames (canvases) and modifying the objects opacity property to appears as if we moved through the sequence. This technique was extremely difficult to work with in blend. </p>
<p>We figured there had to be a easier way. Instead of stacking the frames on top of themselves and using opacity, I decided to position them adjacent to each other and discreetly move the parent canvas from right to left. Think of it like an image strip when the first image starts at X=0 and each adjacent frame is positioned (X+FrameWidth). The result was the canvas shown in Figure 1.</p>
<p style="text-align: center"><a href="http://joel.neubeck.net/wp-content/uploads/2008/01/framesequence.png" rel="lightbox[pics99]" title="framesequence.png"><img src="http://joel.neubeck.net/wp-content/uploads/2008/01/framesequence.thumbnail.png" alt="framesequence.png" class="imageframe imgaligncenter" height="56" width="400" /></a></p>
<p><br style="clear:both"/><br />
Once the frames are positioned in the correct sequence, I created a Canvas.Clip to clip the main canvas at position 0,0 with a width and height equal to the size of each frame.  This clip will mask all of the adjacent frames when we play the animation.</p>
<p> The next step was to create the animation storyboard. For my “less than” creative animation I generated 8 frames, each with a very simple vector. My storyboard will require 1 key frames per frame of the sequence, plus one additional key frame to get back to the starting position. By default, Blend will &#8220;tween &#8221; between each key frame. To achieve a discrete transition, you must right click on the frame and select &#8220;Hold In &#8220;. This selection will change the xaml to a &#8220;DiscreteDoubleKeyFrame &#8221; from a &#8220;SplineDoubleKeyFrame &#8220;. Once you have created a key frame you must move the strip &#8220;canvas&#8221; to its desired position.  Figure 2 shows what the completed animation sequence looks like in the designer. </p>
<p style="text-align: center"><a href="http://joel.neubeck.net/wp-content/uploads/2008/01/framestoryboard.png" rel="lightbox[pics99]" title="framestoryboard.png"><img src="http://joel.neubeck.net/wp-content/uploads/2008/01/framestoryboard.thumbnail.png" alt="framestoryboard.png" class="imageframe imgaligncenter" height="205" width="400" /></a></p>
<p><br style="clear:both"/><br />
Figure 3 shows the xaml generated from this sequence. </p>
<p style="text-align: center"><a href="http://joel.neubeck.net/wp-content/uploads/2008/01/sotryboardxaml.png" rel="lightbox[pics99]" title="sotryboardxaml.png"><img src="http://joel.neubeck.net/wp-content/uploads/2008/01/sotryboardxaml.thumbnail.png" alt="sotryboardxaml.png" class="imageframe imgaligncenter" height="148" width="400" /></a></p>
<p><br style="clear:both"/><br />
To check out my super simple animation done in Silverlight 1.1 <a href="http://sandbox.terralever.com/joel/f-b-f/" target="blank">click here</a>. </p>
<p>Download: <a href="http://joel.neubeck.net/wp-content/uploads/2008/01/page.txt" target="blank">page.xaml</a><br />
Download: <a href="http://joel.neubeck.net/wp-content/uploads/2008/01/frame-by-frame.zip" target="blank">Solution</a></p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2008/01/silverlight-how-to-frame-by-frame-animation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SimpleXmlParser</title>
		<link>http://joel.neubeck.net/2007/06/simplexmlparser/</link>
		<comments>http://joel.neubeck.net/2007/06/simplexmlparser/#comments</comments>
		<pubDate>Fri, 15 Jun 2007 15:10:00 +0000</pubDate>
		<dc:creator>joel</dc:creator>
				<category><![CDATA[Microsoft.Net 2.0]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[generics]]></category>
		<category><![CDATA[xmlwriter]]></category>

		<guid isPermaLink="false">http://www.neubeck.us/joel/?p=6</guid>
		<description><![CDATA[For the recent Facebook platform integration project I was tasked with parsing various forms of Xml returned from the Facebook REST web service. REST or Representational State Transfer, is a term coined by Roy Fielding in his Ph.D. dissertation to describe an architecture style of networked systems. In the Facebook world, to get back some [...]]]></description>
			<content:encoded><![CDATA[<p>For the recent Facebook platform integration project I was tasked with parsing various forms of Xml returned from the Facebook REST web service. REST or Representational State Transfer, is a term coined by Roy Fielding in his Ph.D. dissertation to describe an architecture style of networked systems. In the Facebook world, to get back some data from there servers you make a POST to a specific PHP page (http://api.facebook.com/restserver.php). The results are returned as an Xml document. In PHP there is a library called SimpleXmlParser which can be used to parses a XML file into a data structure. In the Microsoft.NET world we have the XmlReader class which provides forward-only, read-only access to a stream of XML data. In .Net the XmlReader is the most memory efficient approach to parsing an Xml structure. Unfortunately, those of us who choose to use this class know the level of frustration one will experience when asked to parse an Xml document which contain variable node names.</p>
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;query&gt;
  &lt;session&gt;2222222222&lt;/session&gt;
  &lt;users list="true"&gt;
    &lt;user&gt;
      &lt;uid&gt;10000001&lt;/uid&gt;
      &lt;name&gt;Person 1&lt;/name&gt;
    &lt;/user&gt;
    &lt;user&gt;
      &lt;uid&gt;10000002&lt;/uid&gt;
      &lt;name&gt;Person 2&lt;/name&gt;
    &lt;/user&gt;
  &lt;/users&gt;
&lt;/query&gt;
</pre>
<p>Examining the Xml arrangement we quickly see a pattern to how we might construct a data structure that would ease our ability to access specific keys within the information. The following is how I would like to parse the Xml data and access the list of users.</p>

<div class="wp_syntax"><div class="code"><pre class="c-sharp" style="font-family:monospace;">SimpleXmlResponse xml = SimpleXmlParser.Parse (fileContents, string.Empty);
SimpleXmlList list = xml[&quot;users&quot;] as SimpleXmlList;</pre></div></div>

<pre>
xml  Count = 2  SimpleXmlResponse
  [0]  {[session, 2222222222]}  KeyValuePair<string,object>
          Key  "session" string
          Value "2222222222"  object {string}
   [1]  {[users, SimpleXmlList]}  KeyValuePair<string,object>
          Key  "users" string
          Value Count = 2  object {SimpleXmlList}
                 [0]  {[10000001, SimpleXmlItem]} KeyValuePair<string, SimpleXmlItem>
                         Key "10000001" string
                         Value  Count = 2  SimpleXmlItem
                            [0] {[uid, 10000001]} KeyValuePair<string,string>
                            [1] {[name, Person 1]}  KeyValuePair<string,string>
                  [1] {[10000002, SimpleXmlItem]} KeyValuePair<string, SimpleXmlItem>
                          Key "10000002" string
                          Value Count = 2 SimpleXmlItem
                            [0] {[uid, 10000002]} KeyValuePair<string,string>
                            [1] {[name, Person 2]}  KeyValuePair<string,string>
</pre>
<p>Here are a few things to note:</p>
<ul>
<li>The three objects listed above (SimpleXmlResponse, SimpleXmlList, SimpleXmlItem) are nothing more than classes that inherit from System.Collections.Generic.Dictionary. There purpose is to ease readability and facilitate the casting of the result data.</li>
<li>Since SimpleXmlResponse has a value which might contain either a string or a SimpleXmlList, we store this value as an object. This data type will require us to cast the value to string for simple nodes.</li>
<li>Each child node contained within those elements flagged as lists (list attribute = true) will have more than one value key pair. As a result, we must either assume the first element is distinct and can be used as the key for the SimpleXmlList element, or we must explicitly identify which element is distinct.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2007/06/simplexmlparser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

