<?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>Benjii Me</title>
	<atom:link href="http://benjii.me/feed/" rel="self" type="application/rss+xml" />
	<link>http://benjii.me</link>
	<description>Web and Windows Phone 7 by Ben Cull</description>
	<lastBuildDate>Tue, 21 Feb 2012 15:40:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>What is Gadgeteer? &#8211; Getting Started</title>
		<link>http://benjii.me/2012/02/what-is-gadgeteer-getting-started/</link>
		<comments>http://benjii.me/2012/02/what-is-gadgeteer-getting-started/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 15:36:12 +0000</pubDate>
		<dc:creator>Benjii</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[.Net Micro]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[gadgeteer]]></category>
		<category><![CDATA[hardware]]></category>

		<guid isPermaLink="false">http://benjii.me/?p=362</guid>
		<description><![CDATA[Whether you’ve just purchased a Gadgeteer like me, or you’re just curious, this post will give you some quick links and helpful tips to get started. What is Microsoft .NET Gadgeteer? Really cool plug’n’play style hardware for programmers. Starting with a mainboard and a power module, you can connect an awesome array of modular components [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://benjii.me/wp-content/uploads/2012/02/WP_000288.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Ribbon cables are your friend!" border="0" alt="Ribbon cables are your friend!" align="right" src="http://benjii.me/wp-content/uploads/2012/02/WP_000288_thumb.jpg" width="244" height="184"></a>Whether you’ve just purchased a Gadgeteer like me, or you’re just curious, this post will give you some quick links and helpful tips to get started.</p>
<h2>What is Microsoft .NET Gadgeteer?</h2>
<p>
<p>Really cool plug’n’play style hardware for <em>programmers</em>. </p>
<p>Starting with a mainboard and a power module, you can connect an awesome array of modular components to form some cool little electronic projects. Check out the <a title="Gadgeteer Homepage" href="http://www.netmf.com/gadgeteer/" target="_blank">Gadgeteer Homepage</a> for examples of cool projects, the latest news and more delicious Gadgeteer related information.</p>
<p>&nbsp;</p>
<h2>What do I buy?</h2>
<p>I bought the <a title="FEZ Spider Starter Kit from GHI Electronics" href="http://www.ghielectronics.com/catalog/product/297" target="_blank">FEZ Spider Starter Kit from GHI Electronics</a> which includes a wide range of goodies including:<a href="http://benjii.me/wp-content/uploads/2012/02/297-1_large.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="FEZ Spider Starter Kit" border="0" alt="FEZ Spider Starter Kit" align="right" src="http://benjii.me/wp-content/uploads/2012/02/297-1_large_thumb.jpg" width="244" height="168"></a></p>
<ul style="list-style-type: disc">
<li><a href="http://www.ghielectronics.com/catalog/product/269">FEZ Spider Mainboard</a>
<li><a href="http://www.ghielectronics.com/catalog/product/276">Display T35 Module</a> (3.5&#8243; with touchscreen)
<li><a href="http://www.ghielectronics.com/catalog/product/280">USB Client DP Module</a> (with USB cable)
<li><a href="http://www.ghielectronics.com/catalog/product/283">Camera Module</a>
<li>2x <a href="http://www.ghielectronics.com/catalog/product/272">Multicolor LED Module </a>(DaisyLink)
<li>2x <a href="http://www.ghielectronics.com/catalog/product/274">Button Module</a>
<li><a href="http://www.ghielectronics.com/catalog/product/284">Ethernet J11D Module</a>
<li><a href="http://www.ghielectronics.com/catalog/product/271">SD Card Module</a>
<li><a href="http://www.ghielectronics.com/catalog/product/270">USB Host Module</a>
<li><a href="http://www.ghielectronics.com/catalog/product/273">Extender Module</a>
<li><a href="http://www.ghielectronics.com/catalog/product/299">Joystick Module</a>
<li><a href="http://www.ghielectronics.com/catalog/product/279">10cm IDC cables</a> (included with modules).
<li><a href="http://www.ghielectronics.com/catalog/product/310">Assorted IDC Cable Pack</a>:
<ul>
<li>4x 5cm IDC cables
<li>3x 20cm IDC cables
<li>1x 50cm IDC cable</li>
</ul>
</li>
</ul>
<p>There are a few other kits, as well as a large range of really cool modules like wifi, bluetooth, temperature and light sensors, the list goes on…</p>
<p>&nbsp;</p>
<h2>Once I have one, what do I do?</h2>
<ol>
<li>Make sure you have <a title="Visual Studio 2010" href="http://www.microsoft.com/visualstudio" target="_blank">Visual Studio 2010</a> or <a title="Visual C# Express (the free one)" href="http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-csharp-express" target="_blank">Visual C# 2010 Express (the free one)</a></li>
<li>Download and install the <a href="http://www.microsoft.com/download/en/details.aspx?id=8515">.NET Micro Framework 4.1 SDK</a></li>
<li>Download and install the SDK for your particular hardware. Check out this <a title="Getting Started Guide" href="http://www.netmf.com/gadgeteer/get-started.aspx" target="_blank">Getting Started Guide</a> if you’re unsure. If you’re using the same starter kit as me then you can download it from here: <a href="http://www.tinyclr.com/support/">http://www.tinyclr.com/support/</a></li>
</ol>
<p>&nbsp;</p>
<h2>OK, let’s build something</h2>
<p>The best way to start off is to follow the <a title="Building your first .NET Gadgeteer Device" href="http://www.ghielectronics.com/downloads/Gadgeteer/Mainboard/Spider_GettingStarted/" target="_blank">Building your first .NET Gadgeteer Device</a> tutorial which will introduce you to the basics (very important). It is specific to the kit I bought, but the concepts are the same.</p>
<p>I was worried for a short while as I thought my camera module was broken. I was getting really blurry, erratic images displaying on my touch screen. It turns out that no, it was just out of focus, and the correct focus was a bit fiddly to get (you have to unscrew the lens a little bit), until I found out how to stream bitmaps to the display instead of just taking pictures. </p>
<p>Michael Dodaro has a cool post about <a title="storing streamed bitmaps to SD" href="http://mikedodaro.net/2011/10/13/net-gadgeteer-camera-touchscreen-storage/" target="_blank">storing streamed bitmaps to SD</a>. As a challenge, try extracting just the code you need to get the camera streaming to the display, it will help you focus the camera properly and get you on your way to building cool new projects.</p>
<p>Once I’ve created something, I’ll post about my adventures to get there.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjii.me/2012/02/what-is-gadgeteer-getting-started/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Multiple Application Bars in Windows Phone Development</title>
		<link>http://benjii.me/2011/12/using-multiple-application-bars-in-windows-phone-development/</link>
		<comments>http://benjii.me/2011/12/using-multiple-application-bars-in-windows-phone-development/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 13:32:33 +0000</pubDate>
		<dc:creator>Benjii</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>

		<guid isPermaLink="false">http://benjii.me/2011/12/using-multiple-application-bars-in-windows-phone-development/</guid>
		<description><![CDATA[You know when you select multiple emails and the application bar swaps out for a different one? No? We’ll get ready to learn. This trick looks much better than enabling and disabling menu items on your application bar and is dead simple to achieve. Step 1: Create your Application Bars Make sure you have the [...]]]></description>
			<content:encoded><![CDATA[<p>You know when you select multiple emails and the application bar swaps out for a different one? No? We’ll get ready to learn. This trick looks much better than enabling and disabling menu items on your application bar and is dead simple to achieve.</p>
<h2>Step 1: Create your Application Bars</h2>
<p>Make sure you have the shell namespace reference at the top of your PhoneApplicationPage:</p>
<pre class="brush:xml; ruler: true;">xmlns:shell=&quot;clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone&quot;</pre>
<p>Create your application bars and add them to your page resources using the following XAML. I’ve created three, naming them “DefaultAppBar”, “SiungleSelectionAppBar” and “MultiSelectionAppBar”.</p>
<pre class="brush:xml; ruler: true;">&lt;phone:PhoneApplicationPage.Resources&gt;
    &lt;shell:ApplicationBar x:Key=&quot;DefaultAppBar&quot; IsVisible=&quot;True&quot;&gt;
        &lt;shell:ApplicationBarIconButton x:Name=&quot;mnuAdd&quot; IconUri=&quot;/icons/appbar.add.rest.png&quot; IsEnabled=&quot;True&quot; Text=&quot;Add&quot; Click=&quot;mnuAdd_Click&quot;/&gt;
    &lt;/shell:ApplicationBar&gt;
    &lt;shell:ApplicationBar x:Key=&quot;SingleSelectionAppBar&quot; IsVisible=&quot;True&quot;&gt;
        &lt;shell:ApplicationBarIconButton x:Name=&quot;mnuPin&quot; IconUri=&quot;/icons/appbar.pushpin.png&quot; IsEnabled=&quot;True&quot; Text=&quot;Pin&quot; Click=&quot;mnuPin_Click&quot; /&gt;
        &lt;shell:ApplicationBarIconButton x:Name=&quot;mnuDelete&quot; IconUri=&quot;/icons/appbar.delete.rest.png&quot; IsEnabled=&quot;True&quot; Text=&quot;Delete&quot; Click=&quot;mnuDelete_Click&quot;/&gt;
        &lt;shell:ApplicationBarIconButton x:Name=&quot;mnuEdit&quot; IconUri=&quot;/icons/appbar.edit.rest.png&quot; IsEnabled=&quot;True&quot; Text=&quot;Edit&quot; Click=&quot;mnuEdit_Click&quot;/&gt;
    &lt;/shell:ApplicationBar&gt;
    &lt;shell:ApplicationBar x:Key=&quot;MultiSelectionAppBar&quot; IsVisible=&quot;True&quot;&gt;
        &lt;shell:ApplicationBarIconButton x:Name=&quot;mnuDeleteMulti&quot; IconUri=&quot;/icons/appbar.delete.rest.png&quot; IsEnabled=&quot;True&quot; Text=&quot;Delete&quot; Click=&quot;mnuDelete_Click&quot;/&gt;
    &lt;/shell:ApplicationBar&gt;
&lt;/phone:PhoneApplicationPage.Resources&gt;</pre>
<p>&#160;</p>
<h2>Step 2: Use Code to Swap Between Them</h2>
<p>Firstly, we need to set a default application bar to load with the page. We can do this by adding the following code to the constructor:</p>
<pre class="brush: csharp; ruler: true;">ApplicationBar = (Microsoft.Phone.Shell.ApplicationBar)Resources[&quot;DefaultAppBar&quot;];</pre>
<p>It&#8217;s actually the exact same code to change the application bar to one of our other ones. Check out the following code I use to swap between them when my list fires a selection changed event:</p>
<pre class="brush: csharp; ruler: true;">if (list.SelectedItems.Count == 1)
{
    ApplicationBar = (Microsoft.Phone.Shell.ApplicationBar)Resources[&quot;SingleSelectionAppBar&quot;];
}
else if (list.SelectedItems.Count &gt; 1)
{
    ApplicationBar = (Microsoft.Phone.Shell.ApplicationBar)Resources[&quot;MultiSelectionAppBar&quot;];
}
else
{
    ApplicationBar = (Microsoft.Phone.Shell.ApplicationBar)Resources[&quot;DefaultAppBar&quot;];
}</pre>
<p>That&#8217;s it. You&#8217;ll also notice that when you change application bars, it uses a cool swoosh down and then back up animation. All for free.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjii.me/2011/12/using-multiple-application-bars-in-windows-phone-development/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Continuum Transition for Windows Phone Silverlight Toolkit</title>
		<link>http://benjii.me/2011/11/continuum-transition-for-windows-phone-silverlight-toolkit/</link>
		<comments>http://benjii.me/2011/11/continuum-transition-for-windows-phone-silverlight-toolkit/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 15:16:23 +0000</pubDate>
		<dc:creator>Benjii</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[continuum]]></category>
		<category><![CDATA[Silverlight Toolkit]]></category>
		<category><![CDATA[transition]]></category>
		<category><![CDATA[windows phone]]></category>

		<guid isPermaLink="false">http://benjii.me/2011/11/continuum-transition-for-windows-phone-silverlight-toolkit/</guid>
		<description><![CDATA[You know that cool swooshing transition you get when you click an email on your Windows Phone? Now you too can make use of that awesome transition using only the Silverlight Toolkit and this handy dandy Continuum Transition class. Step 1 – Go get the Silverlight Toolkit!! As always, I suggest you use Nuget to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://benjii.me/wp-content/uploads/2011/11/WP7_Email.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Check out my awesome Paint.NET skills!" border="0" alt="Check out my awesome Paint.NET skills!" align="right" src="http://benjii.me/wp-content/uploads/2011/11/WP7_Email_thumb.png" width="244" height="198" /></a>You know that cool swooshing transition you get when you click an email on your Windows Phone? Now you too can make use of that awesome transition using only the Silverlight Toolkit and this handy dandy Continuum Transition class.</p>
<h2>Step 1 – Go get the Silverlight Toolkit!!</h2>
<p>As always, I suggest you use Nuget to include it, but feel free to <a title="Download the Silverlight Toolkit for Windows Phone" href="http://silverlight.codeplex.com/" target="_blank">download it from Codeplex</a></p>
<p>&#160;</p>
<h2>Step 2 – Let’s See How to Use It</h2>
<p>The actual continuum transition class is pretty big for a blog post, so I’ll show you how to use it first and then you can copy the Continuum Transition class after that.</p>
<p>If you are already using the Silverlight Toolkit transitions using code, then this should hopefully be familar:</p>
<pre class="brush: csharp; ruler: true;">private void ListBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
    var selectedElement = (sender as ListBox).ItemContainerGenerator.ContainerFromIndex(lstSeeding.SelectedIndex) as FrameworkElement;

    var navOutTransition = new NavigationOutTransition();
    navOutTransition.Forward = new ContinuumTransition(ContinuumTransitionMode.ContinuumForwardOutStoryboard, selectedElement);

    var navInTransition = new NavigationInTransition();
    navInTransition.Backward = new ContinuumTransition(ContinuumTransitionMode.ContinuumBackwardInStoryboard, selectedElement);

    PhoneApplicationPage phoneApplicationPage =
    (PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual)).Content;

    TransitionService.SetNavigationOutTransition(phoneApplicationPage, navOutTransition);
    TransitionService.SetNavigationInTransition(phoneApplicationPage, navInTransition);

    NavigationService.Navigate(new Uri(&quot;/DetailPage.xaml&quot;, UriKind.Relative));
}</pre>
<p>I’ve used a listbox’s selection changed event as an example, as this is the most common scenario. To break it down, firstly we get the selected item’s framework element. This is the containing element that we are going to animate, in this case a list item.</p>
<p>Next, we setup the actual transitions using the awesome continuum transition class. The first parameter is the type of transition you are making and the second is the element you wish to animate.</p>
<p>After this, we obtain our phone application page and assign the transitions to the transition service.</p>
<p>Once we have done that we can navigate as per normal and the page will automatically transition for you!</p>
<p>&#160;</p>
<h2>Step 3 – Copy the Continuum Transition Class</h2>
<p>The code in full is below. It is <a title="Continuum Transition on Github" href="https://gist.github.com/1345156" target="_blank">hosted on Github</a> so you can be confident the below code is up to date.</p>
<p>Also please note the actual storyboards have come from the awesome guys at Clarity Consulting. There is an <a title="Clarity Consulting Page Transitions Sample" href="http://blogs.claritycon.com/kevinmarshall/2010/10/13/wp7-page-transitions-sample/" target="_blank">especially useful post about transitions you should go read right now</a>.</p>
<div id="gist-1345156" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">namespace</span> <span class="nn">BenjiiMe.Animation</span></div><div class='line' id='LC2'><span class="p">{</span></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">class</span> <span class="nc">ContinuumTransition</span> <span class="p">:</span> <span class="n">TransitionElement</span></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">const</span> <span class="kt">string</span> <span class="n">ContinuumElementPropertyName</span> <span class="p">=</span> <span class="s">&quot;ContinuumElement&quot;</span><span class="p">;</span></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">const</span> <span class="kt">string</span> <span class="n">ContinuumModePropertyName</span> <span class="p">=</span> <span class="s">&quot;Mode&quot;</span><span class="p">;</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="n">FrameworkElement</span> <span class="n">ContinuumElement</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">get</span> <span class="p">{</span> <span class="k">return</span> <span class="p">(</span><span class="n">FrameworkElement</span><span class="p">)</span><span class="n">GetValue</span><span class="p">(</span><span class="n">ContinuumElementProperty</span><span class="p">);</span> <span class="p">}</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">set</span> <span class="p">{</span> <span class="n">SetValue</span><span class="p">(</span><span class="n">ContinuumElementProperty</span><span class="p">,</span> <span class="k">value</span><span class="p">);</span> <span class="p">}</span></div><div class='line' id='LC12'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC13'><br/></div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="n">ContinuumTransitionMode</span> <span class="n">Mode</span></div><div class='line' id='LC15'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">get</span> <span class="p">{</span> <span class="k">return</span> <span class="p">(</span><span class="n">ContinuumTransitionMode</span><span class="p">)</span><span class="n">GetValue</span><span class="p">(</span><span class="n">ModeProperty</span><span class="p">);</span> <span class="p">}</span></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">set</span> <span class="p">{</span> <span class="n">SetValue</span><span class="p">(</span><span class="n">ModeProperty</span><span class="p">,</span> <span class="k">value</span><span class="p">);</span> <span class="p">}</span></div><div class='line' id='LC18'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC19'><br/></div><div class='line' id='LC20'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">static</span> <span class="k">readonly</span> <span class="n">DependencyProperty</span> <span class="n">ContinuumElementProperty</span> <span class="p">=</span></div><div class='line' id='LC21'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">DependencyProperty</span><span class="p">.</span><span class="n">Register</span><span class="p">(</span><span class="n">ContinuumElementPropertyName</span><span class="p">,</span> <span class="k">typeof</span><span class="p">(</span><span class="n">FrameworkElement</span><span class="p">),</span> <span class="k">typeof</span><span class="p">(</span><span class="n">ContinuumTransition</span><span class="p">),</span> <span class="k">new</span> <span class="n">PropertyMetadata</span><span class="p">(</span><span class="k">null</span><span class="p">));</span></div><div class='line' id='LC22'><br/></div><div class='line' id='LC23'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">static</span> <span class="k">readonly</span> <span class="n">DependencyProperty</span> <span class="n">ModeProperty</span> <span class="p">=</span></div><div class='line' id='LC24'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">DependencyProperty</span><span class="p">.</span><span class="n">Register</span><span class="p">(</span><span class="n">ContinuumModePropertyName</span><span class="p">,</span> <span class="k">typeof</span><span class="p">(</span><span class="n">ContinuumTransitionMode</span><span class="p">),</span> <span class="k">typeof</span><span class="p">(</span><span class="n">ContinuumTransition</span><span class="p">),</span> <span class="k">null</span><span class="p">);</span></div><div class='line' id='LC25'><br/></div><div class='line' id='LC26'><br/></div><div class='line' id='LC27'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="nf">ContinuumTransition</span><span class="p">()</span> <span class="p">{</span> <span class="p">}</span></div><div class='line' id='LC28'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="nf">ContinuumTransition</span><span class="p">(</span><span class="n">ContinuumTransitionMode</span> <span class="n">mode</span><span class="p">)</span></div><div class='line' id='LC29'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC30'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Mode</span> <span class="p">=</span> <span class="n">mode</span><span class="p">;</span></div><div class='line' id='LC31'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC32'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="nf">ContinuumTransition</span><span class="p">(</span><span class="n">ContinuumTransitionMode</span> <span class="n">mode</span><span class="p">,</span> <span class="n">FrameworkElement</span> <span class="n">element</span><span class="p">)</span></div><div class='line' id='LC33'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC34'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Mode</span> <span class="p">=</span> <span class="n">mode</span><span class="p">;</span></div><div class='line' id='LC35'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ContinuumElement</span> <span class="p">=</span> <span class="n">element</span><span class="p">;</span></div><div class='line' id='LC36'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC37'><br/></div><div class='line' id='LC38'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">override</span> <span class="n">ITransition</span> <span class="nf">GetTransition</span><span class="p">(</span><span class="n">UIElement</span> <span class="n">element</span><span class="p">)</span></div><div class='line' id='LC39'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC40'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Storyboard</span> <span class="n">storyboard</span> <span class="p">=</span> <span class="k">null</span><span class="p">;</span></div><div class='line' id='LC41'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="n">Mode</span> <span class="p">==</span> <span class="n">ContinuumTransitionMode</span><span class="p">.</span><span class="n">ContinuumBackwardInStoryboard</span><span class="p">)</span></div><div class='line' id='LC42'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">storyboard</span> <span class="p">=</span> <span class="n">XamlReader</span><span class="p">.</span><span class="n">Load</span><span class="p">(</span><span class="n">ContinuumBackwardInStoryboard</span><span class="p">)</span> <span class="k">as</span> <span class="n">Storyboard</span><span class="p">;</span></div><div class='line' id='LC43'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">Mode</span> <span class="p">==</span> <span class="n">ContinuumTransitionMode</span><span class="p">.</span><span class="n">ContinuumBackwardOutStoryboard</span><span class="p">)</span></div><div class='line' id='LC44'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">storyboard</span> <span class="p">=</span> <span class="n">XamlReader</span><span class="p">.</span><span class="n">Load</span><span class="p">(</span><span class="n">ContinuumBackwardOutStoryboard</span><span class="p">)</span> <span class="k">as</span> <span class="n">Storyboard</span><span class="p">;</span></div><div class='line' id='LC45'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">Mode</span> <span class="p">==</span> <span class="n">ContinuumTransitionMode</span><span class="p">.</span><span class="n">ContinuumForwardInStoryboard</span><span class="p">)</span></div><div class='line' id='LC46'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">storyboard</span> <span class="p">=</span> <span class="n">XamlReader</span><span class="p">.</span><span class="n">Load</span><span class="p">(</span><span class="n">ContinuumForwardInStoryboard</span><span class="p">)</span> <span class="k">as</span> <span class="n">Storyboard</span><span class="p">;</span></div><div class='line' id='LC47'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">Mode</span> <span class="p">==</span> <span class="n">ContinuumTransitionMode</span><span class="p">.</span><span class="n">ContinuumForwardOutStoryboard</span><span class="p">)</span></div><div class='line' id='LC48'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">storyboard</span> <span class="p">=</span> <span class="n">XamlReader</span><span class="p">.</span><span class="n">Load</span><span class="p">(</span><span class="n">ContinuumForwardOutStoryboard</span><span class="p">)</span> <span class="k">as</span> <span class="n">Storyboard</span><span class="p">;</span></div><div class='line' id='LC49'><br/></div><div class='line' id='LC50'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ContinuumElement</span><span class="p">.</span><span class="n">GetTransform</span><span class="p">&lt;</span><span class="n">CompositeTransform</span><span class="p">&gt;(</span><span class="n">TransformCreationMode</span><span class="p">.</span><span class="n">CreateOrAddAndIgnoreMatrix</span><span class="p">);</span></div><div class='line' id='LC51'><br/></div><div class='line' id='LC52'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">SetTargets</span><span class="p">(</span><span class="k">new</span> <span class="n">Dictionary</span><span class="p">&lt;</span><span class="kt">string</span><span class="p">,</span> <span class="n">FrameworkElement</span><span class="p">&gt;()</span></div><div class='line' id='LC53'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC54'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span> <span class="s">&quot;LayoutRoot&quot;</span><span class="p">,</span> <span class="n">element</span> <span class="k">as</span> <span class="n">FrameworkElement</span> <span class="p">},</span></div><div class='line' id='LC55'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span> <span class="n">ContinuumElementPropertyName</span><span class="p">,</span> <span class="n">ContinuumElement</span> <span class="p">}</span></div><div class='line' id='LC56'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">},</span> </div><div class='line' id='LC57'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">storyboard</span><span class="p">);</span></div><div class='line' id='LC58'><br/></div><div class='line' id='LC59'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="k">new</span> <span class="nf">Transition</span><span class="p">(</span><span class="n">element</span><span class="p">,</span> <span class="n">storyboard</span><span class="p">);</span></div><div class='line' id='LC60'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC61'><br/></div><div class='line' id='LC62'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">void</span> <span class="nf">SetTargets</span><span class="p">(</span><span class="n">Dictionary</span><span class="p">&lt;</span><span class="kt">string</span><span class="p">,</span> <span class="n">FrameworkElement</span><span class="p">&gt;</span> <span class="n">targets</span><span class="p">,</span> <span class="n">Storyboard</span> <span class="n">sb</span><span class="p">)</span></div><div class='line' id='LC63'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC64'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">foreach</span> <span class="p">(</span><span class="kt">var</span> <span class="n">kvp</span> <span class="k">in</span> <span class="n">targets</span><span class="p">)</span></div><div class='line' id='LC65'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC66'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kt">var</span> <span class="n">timelines</span> <span class="p">=</span> <span class="n">sb</span><span class="p">.</span><span class="n">Children</span><span class="p">.</span><span class="n">Where</span><span class="p">(</span><span class="n">t</span> <span class="p">=&gt;</span> <span class="n">Storyboard</span><span class="p">.</span><span class="n">GetTargetName</span><span class="p">(</span><span class="n">t</span><span class="p">)</span> <span class="p">==</span> <span class="n">kvp</span><span class="p">.</span><span class="n">Key</span><span class="p">);</span></div><div class='line' id='LC67'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">foreach</span> <span class="p">(</span><span class="n">Timeline</span> <span class="n">t</span> <span class="k">in</span> <span class="n">timelines</span><span class="p">)</span></div><div class='line' id='LC68'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Storyboard</span><span class="p">.</span><span class="n">SetTarget</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="n">kvp</span><span class="p">.</span><span class="n">Value</span><span class="p">);</span></div><div class='line' id='LC69'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC70'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC71'><br/></div><div class='line' id='LC72'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">internal</span> <span class="k">static</span> <span class="k">readonly</span> <span class="kt">string</span> <span class="n">ContinuumForwardOutStoryboard</span> <span class="p">=</span></div><div class='line' id='LC73'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">@&quot;&lt;Storyboard xmlns=&quot;&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;&quot;&gt;</span></div><div class='line' id='LC74'><span class="s">            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;&quot;(UIElement.RenderTransform).(CompositeTransform.TranslateY)&quot;&quot; Storyboard.TargetName=&quot;&quot;LayoutRoot&quot;&quot;&gt;</span></div><div class='line' id='LC75'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0&quot;&quot; Value=&quot;&quot;0&quot;&quot;/&gt;</span></div><div class='line' id='LC76'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0:0:0.15&quot;&quot; Value=&quot;&quot;70&quot;&quot;&gt;</span></div><div class='line' id='LC77'><span class="s">                    &lt;EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC78'><span class="s">                        &lt;ExponentialEase EasingMode=&quot;&quot;EaseIn&quot;&quot; Exponent=&quot;&quot;3&quot;&quot;/&gt;</span></div><div class='line' id='LC79'><span class="s">                    &lt;/EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC80'><span class="s">                &lt;/EasingDoubleKeyFrame&gt;</span></div><div class='line' id='LC81'><span class="s">            &lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC82'><span class="s">	        &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;&quot;(UIElement.Opacity)&quot;&quot; Storyboard.TargetName=&quot;&quot;LayoutRoot&quot;&quot;&gt;</span></div><div class='line' id='LC83'><span class="s">		        &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0&quot;&quot; Value=&quot;&quot;1&quot;&quot;/&gt;</span></div><div class='line' id='LC84'><span class="s">		        &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0:0:0.15&quot;&quot; Value=&quot;&quot;0&quot;&quot;&gt;</span></div><div class='line' id='LC85'><span class="s">			        &lt;EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC86'><span class="s">				        &lt;ExponentialEase EasingMode=&quot;&quot;EaseIn&quot;&quot; Exponent=&quot;&quot;3&quot;&quot;/&gt;</span></div><div class='line' id='LC87'><span class="s">			        &lt;/EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC88'><span class="s">		        &lt;/EasingDoubleKeyFrame&gt;</span></div><div class='line' id='LC89'><span class="s">	        &lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC90'><span class="s">            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;&quot;(UIElement.RenderTransform).(CompositeTransform.TranslateY)&quot;&quot; Storyboard.TargetName=&quot;&quot;ContinuumElement&quot;&quot;&gt;</span></div><div class='line' id='LC91'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0&quot;&quot; Value=&quot;&quot;0&quot;&quot;/&gt;</span></div><div class='line' id='LC92'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0:0:0.15&quot;&quot; Value=&quot;&quot;73&quot;&quot;&gt;</span></div><div class='line' id='LC93'><span class="s">                    &lt;EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC94'><span class="s">                        &lt;ExponentialEase EasingMode=&quot;&quot;EaseIn&quot;&quot; Exponent=&quot;&quot;3&quot;&quot;/&gt;</span></div><div class='line' id='LC95'><span class="s">                    &lt;/EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC96'><span class="s">                &lt;/EasingDoubleKeyFrame&gt;</span></div><div class='line' id='LC97'><span class="s">            &lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC98'><span class="s">            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;&quot;(UIElement.RenderTransform).(CompositeTransform.TranslateX)&quot;&quot; Storyboard.TargetName=&quot;&quot;ContinuumElement&quot;&quot;&gt;</span></div><div class='line' id='LC99'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0&quot;&quot; Value=&quot;&quot;0&quot;&quot;/&gt;</span></div><div class='line' id='LC100'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0:0:0.15&quot;&quot; Value=&quot;&quot;225&quot;&quot;&gt;</span></div><div class='line' id='LC101'><span class="s">                    &lt;EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC102'><span class="s">                        &lt;ExponentialEase EasingMode=&quot;&quot;EaseIn&quot;&quot; Exponent=&quot;&quot;3&quot;&quot;/&gt;</span></div><div class='line' id='LC103'><span class="s">                    &lt;/EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC104'><span class="s">                &lt;/EasingDoubleKeyFrame&gt;</span></div><div class='line' id='LC105'><span class="s">            &lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC106'><span class="s">			&lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName=&quot;&quot;ContinuumElement&quot;&quot; Storyboard.TargetProperty=&quot;&quot;(UIElement.Opacity)&quot;&quot;&gt;</span></div><div class='line' id='LC107'><span class="s">				&lt;DiscreteDoubleKeyFrame KeyTime=&quot;&quot;0:0:0.15&quot;&quot; Value=&quot;&quot;0&quot;&quot; /&gt;</span></div><div class='line' id='LC108'><span class="s">			&lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC109'><span class="s">        &lt;/Storyboard&gt;&quot;</span><span class="p">;</span></div><div class='line' id='LC110'><br/></div><div class='line' id='LC111'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">internal</span> <span class="k">static</span> <span class="k">readonly</span> <span class="kt">string</span> <span class="n">ContinuumForwardInStoryboard</span> <span class="p">=</span></div><div class='line' id='LC112'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">@&quot;&lt;Storyboard xmlns=&quot;&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;&quot;&gt;</span></div><div class='line' id='LC113'><span class="s">            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;&quot;(UIElement.RenderTransform).(CompositeTransform.TranslateY)&quot;&quot; Storyboard.TargetName=&quot;&quot;LayoutRoot&quot;&quot;&gt;</span></div><div class='line' id='LC114'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0&quot;&quot; Value=&quot;&quot;50&quot;&quot;/&gt;</span></div><div class='line' id='LC115'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0:0:0.15&quot;&quot; Value=&quot;&quot;0&quot;&quot;&gt;</span></div><div class='line' id='LC116'><span class="s">                    &lt;EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC117'><span class="s">                        &lt;ExponentialEase EasingMode=&quot;&quot;EaseOut&quot;&quot; Exponent=&quot;&quot;3&quot;&quot;/&gt;</span></div><div class='line' id='LC118'><span class="s">                    &lt;/EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC119'><span class="s">                &lt;/EasingDoubleKeyFrame&gt;</span></div><div class='line' id='LC120'><span class="s">            &lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC121'><span class="s">            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;&quot;(UIElement.RenderTransform).(CompositeTransform.TranslateY)&quot;&quot; Storyboard.TargetName=&quot;&quot;ContinuumElement&quot;&quot;&gt;</span></div><div class='line' id='LC122'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0&quot;&quot; Value=&quot;&quot;-70&quot;&quot;/&gt;</span></div><div class='line' id='LC123'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0:0:0.15&quot;&quot; Value=&quot;&quot;0&quot;&quot;&gt;</span></div><div class='line' id='LC124'><span class="s">                    &lt;EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC125'><span class="s">                        &lt;ExponentialEase EasingMode=&quot;&quot;EaseOut&quot;&quot; Exponent=&quot;&quot;3&quot;&quot;/&gt;</span></div><div class='line' id='LC126'><span class="s">                    &lt;/EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC127'><span class="s">                &lt;/EasingDoubleKeyFrame&gt;</span></div><div class='line' id='LC128'><span class="s">            &lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC129'><span class="s">            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;&quot;(UIElement.RenderTransform).(CompositeTransform.TranslateX)&quot;&quot; Storyboard.TargetName=&quot;&quot;ContinuumElement&quot;&quot;&gt;</span></div><div class='line' id='LC130'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0&quot;&quot; Value=&quot;&quot;130&quot;&quot;/&gt;</span></div><div class='line' id='LC131'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0:0:0.15&quot;&quot; Value=&quot;&quot;0&quot;&quot;&gt;</span></div><div class='line' id='LC132'><span class="s">                    &lt;EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC133'><span class="s">                        &lt;ExponentialEase EasingMode=&quot;&quot;EaseOut&quot;&quot; Exponent=&quot;&quot;3&quot;&quot;/&gt;</span></div><div class='line' id='LC134'><span class="s">                    &lt;/EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC135'><span class="s">                &lt;/EasingDoubleKeyFrame&gt;</span></div><div class='line' id='LC136'><span class="s">            &lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC137'><span class="s">            &lt;DoubleAnimation Storyboard.TargetProperty=&quot;&quot;(UIElement.Opacity)&quot;&quot; From=&quot;&quot;0&quot;&quot; To=&quot;&quot;1&quot;&quot; Duration=&quot;&quot;0:0:0.15&quot;&quot; </span></div><div class='line' id='LC138'><span class="s">                                 Storyboard.TargetName=&quot;&quot;LayoutRoot&quot;&quot;&gt;</span></div><div class='line' id='LC139'><span class="s">                &lt;DoubleAnimation.EasingFunction&gt;</span></div><div class='line' id='LC140'><span class="s">                    &lt;ExponentialEase EasingMode=&quot;&quot;EaseOut&quot;&quot; Exponent=&quot;&quot;6&quot;&quot;/&gt;</span></div><div class='line' id='LC141'><span class="s">                &lt;/DoubleAnimation.EasingFunction&gt;</span></div><div class='line' id='LC142'><span class="s">            &lt;/DoubleAnimation&gt;</span></div><div class='line' id='LC143'><span class="s">        &lt;/Storyboard&gt;&quot;</span><span class="p">;</span></div><div class='line' id='LC144'><br/></div><div class='line' id='LC145'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">internal</span> <span class="k">static</span> <span class="k">readonly</span> <span class="kt">string</span> <span class="n">ContinuumBackwardOutStoryboard</span> <span class="p">=</span></div><div class='line' id='LC146'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">@&quot;&lt;Storyboard  xmlns=&quot;&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;&quot;&gt;</span></div><div class='line' id='LC147'><span class="s">            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;&quot;(UIElement.RenderTransform).(CompositeTransform.TranslateY)&quot;&quot; </span></div><div class='line' id='LC148'><span class="s">                                           Storyboard.TargetName=&quot;&quot;LayoutRoot&quot;&quot;&gt;</span></div><div class='line' id='LC149'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0&quot;&quot; Value=&quot;&quot;0&quot;&quot;/&gt;</span></div><div class='line' id='LC150'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0:0:0.15&quot;&quot; Value=&quot;&quot;50&quot;&quot;&gt;</span></div><div class='line' id='LC151'><span class="s">                    &lt;EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC152'><span class="s">                        &lt;ExponentialEase EasingMode=&quot;&quot;EaseIn&quot;&quot; Exponent=&quot;&quot;6&quot;&quot;/&gt;</span></div><div class='line' id='LC153'><span class="s">                    &lt;/EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC154'><span class="s">                &lt;/EasingDoubleKeyFrame&gt;</span></div><div class='line' id='LC155'><span class="s">            &lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC156'><span class="s">            &lt;DoubleAnimation Storyboard.TargetProperty=&quot;&quot;(UIElement.Opacity)&quot;&quot; From=&quot;&quot;1&quot;&quot; To=&quot;&quot;0&quot;&quot; Duration=&quot;&quot;0:0:0.15&quot;&quot; </span></div><div class='line' id='LC157'><span class="s">                                 Storyboard.TargetName=&quot;&quot;LayoutRoot&quot;&quot;&gt;</span></div><div class='line' id='LC158'><span class="s">                &lt;DoubleAnimation.EasingFunction&gt;</span></div><div class='line' id='LC159'><span class="s">                    &lt;ExponentialEase EasingMode=&quot;&quot;EaseIn&quot;&quot; Exponent=&quot;&quot;6&quot;&quot;/&gt;</span></div><div class='line' id='LC160'><span class="s">                &lt;/DoubleAnimation.EasingFunction&gt;</span></div><div class='line' id='LC161'><span class="s">            &lt;/DoubleAnimation&gt;</span></div><div class='line' id='LC162'><span class="s">        &lt;/Storyboard&gt;&quot;</span><span class="p">;</span></div><div class='line' id='LC163'><br/></div><div class='line' id='LC164'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">internal</span> <span class="k">static</span> <span class="k">readonly</span> <span class="kt">string</span> <span class="n">ContinuumBackwardInStoryboard</span> <span class="p">=</span></div><div class='line' id='LC165'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">@&quot;&lt;Storyboard xmlns=&quot;&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;&quot;&gt;</span></div><div class='line' id='LC166'><span class="s">            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;&quot;(UIElement.RenderTransform).(CompositeTransform.TranslateX)&quot;&quot; Storyboard.TargetName=&quot;&quot;ContinuumElement&quot;&quot;&gt;</span></div><div class='line' id='LC167'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0&quot;&quot; Value=&quot;&quot;-70&quot;&quot;/&gt;</span></div><div class='line' id='LC168'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0:0:0.15&quot;&quot; Value=&quot;&quot;0&quot;&quot;&gt;</span></div><div class='line' id='LC169'><span class="s">                    &lt;EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC170'><span class="s">                        &lt;ExponentialEase EasingMode=&quot;&quot;EaseOut&quot;&quot; Exponent=&quot;&quot;3&quot;&quot;/&gt;</span></div><div class='line' id='LC171'><span class="s">                    &lt;/EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC172'><span class="s">                &lt;/EasingDoubleKeyFrame&gt;</span></div><div class='line' id='LC173'><span class="s">            &lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC174'><span class="s">            &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;&quot;(UIElement.RenderTransform).(CompositeTransform.TranslateY)&quot;&quot; Storyboard.TargetName=&quot;&quot;ContinuumElement&quot;&quot;&gt;</span></div><div class='line' id='LC175'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0&quot;&quot; Value=&quot;&quot;-30&quot;&quot;/&gt;</span></div><div class='line' id='LC176'><span class="s">                &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0:0:0.15&quot;&quot; Value=&quot;&quot;0&quot;&quot;&gt;</span></div><div class='line' id='LC177'><span class="s">                    &lt;EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC178'><span class="s">                        &lt;ExponentialEase EasingMode=&quot;&quot;EaseOut&quot;&quot; Exponent=&quot;&quot;3&quot;&quot;/&gt;</span></div><div class='line' id='LC179'><span class="s">                    &lt;/EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC180'><span class="s">                &lt;/EasingDoubleKeyFrame&gt;</span></div><div class='line' id='LC181'><span class="s">            &lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC182'><span class="s">			&lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName=&quot;&quot;ContinuumElement&quot;&quot; Storyboard.TargetProperty=&quot;&quot;(UIElement.Opacity)&quot;&quot;&gt;</span></div><div class='line' id='LC183'><span class="s">				&lt;DiscreteDoubleKeyFrame KeyTime=&quot;&quot;0:0:0&quot;&quot; Value=&quot;&quot;1&quot;&quot; /&gt;</span></div><div class='line' id='LC184'><span class="s">			&lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC185'><span class="s">	        &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;&quot;(UIElement.Opacity)&quot;&quot; Storyboard.TargetName=&quot;&quot;LayoutRoot&quot;&quot;&gt;</span></div><div class='line' id='LC186'><span class="s">		        &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0&quot;&quot; Value=&quot;&quot;0&quot;&quot;/&gt;</span></div><div class='line' id='LC187'><span class="s">		        &lt;EasingDoubleKeyFrame KeyTime=&quot;&quot;0:0:0.15&quot;&quot; Value=&quot;&quot;1&quot;&quot;&gt;</span></div><div class='line' id='LC188'><span class="s">			        &lt;EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC189'><span class="s">				        &lt;ExponentialEase EasingMode=&quot;&quot;EaseOut&quot;&quot; Exponent=&quot;&quot;6&quot;&quot;/&gt;</span></div><div class='line' id='LC190'><span class="s">			        &lt;/EasingDoubleKeyFrame.EasingFunction&gt;</span></div><div class='line' id='LC191'><span class="s">		        &lt;/EasingDoubleKeyFrame&gt;</span></div><div class='line' id='LC192'><span class="s">	        &lt;/DoubleAnimationUsingKeyFrames&gt;</span></div><div class='line' id='LC193'><span class="s">            &lt;DoubleAnimation Duration=&quot;&quot;0&quot;&quot; To=&quot;&quot;0&quot;&quot; Storyboard.TargetProperty=&quot;&quot;(UIElement.RenderTransform).(CompositeTransform.TranslateY)&quot;&quot; Storyboard.TargetName=&quot;&quot;LayoutRoot&quot;&quot;/&gt;</span></div><div class='line' id='LC194'><span class="s">        &lt;/Storyboard&gt;&quot;</span><span class="p">;</span></div><div class='line' id='LC195'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC196'><br/></div><div class='line' id='LC197'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">enum</span> <span class="n">ContinuumTransitionMode</span></div><div class='line' id='LC198'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC199'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ContinuumForwardOutStoryboard</span><span class="p">,</span></div><div class='line' id='LC200'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ContinuumForwardInStoryboard</span><span class="p">,</span></div><div class='line' id='LC201'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ContinuumBackwardOutStoryboard</span><span class="p">,</span></div><div class='line' id='LC202'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ContinuumBackwardInStoryboard</span></div><div class='line' id='LC203'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC204'><span class="p">}</span></div><div class='line' id='LC205'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1345156/e792e6160c27eefadadb756b15ca1e5d7be03ff9/ContinuumTransition.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1345156#file_continuum_transition.cs" style="float:right;margin-right:10px;color:#666">ContinuumTransition.cs</a>
            <a href="https://gist.github.com/1345156">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>Welcome to the bottom of the post, please spread the word about this transition to better the Windows Phone platform for everyone <img src='http://benjii.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://benjii.me/2011/11/continuum-transition-for-windows-phone-silverlight-toolkit/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Use the Long List Selector for Windows Phone Mango</title>
		<link>http://benjii.me/2011/10/how-to-use-the-long-list-selector-for-windows-phone-mango/</link>
		<comments>http://benjii.me/2011/10/how-to-use-the-long-list-selector-for-windows-phone-mango/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 14:25:43 +0000</pubDate>
		<dc:creator>Benjii</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Long List Selector]]></category>
		<category><![CDATA[Silverlight Toolkit]]></category>

		<guid isPermaLink="false">http://benjii.me/2011/10/how-to-use-the-long-list-selector-for-windows-phone-mango/</guid>
		<description><![CDATA[One of the cool new controls in the Silverlight Toolkit for Windows Phone Mango is the Long List Selector. This post will show you how to get one looking nice, complete with alphabetised grouping. Step 1: Make sure you have the Silverlight Toolkit referenced The best way to do this is via Nuget: &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>One of the cool new controls in the Silverlight Toolkit for Windows Phone Mango is the Long List Selector. This post will show you how to get one looking nice, complete with alphabetised grouping.</p>
<h2>Step 1: Make sure you have the Silverlight Toolkit referenced</h2>
<p>The best way to do this is via Nuget: <a title="Silverlight Toolkit for Windows Phone - Nuget" href="http://nuget.org/List/Packages/SilverlightToolkitWP" target="_blank"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="nuget_silverlight_toolkit" border="0" alt="nuget_silverlight_toolkit" align="left" src="http://benjii.me/wp-content/uploads/2011/10/nuget_silverlight_toolkit.png" width="763" height="87" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>or directly from Codeplex:</p>
<p><a title="Silverlight Toolkit for Windows Phone" href="http://silverlight.codeplex.com/releases/view/71550" target="_blank"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="augtk_3" border="0" alt="augtk_3" src="http://benjii.me/wp-content/uploads/2011/10/augtk_3.png" width="273" height="82" /></a></p>
<h2>&#160;</h2>
<h2>Step 2: Drop that bad boy onto the page</h2>
<p>Paste the following XAML where you would like to use the control.</p>
<pre class="brush:xml; ruler: true;">&lt;toolkit:LongListSelector x:Name=&quot;lstMain&quot;
GroupHeaderTemplate=&quot;{StaticResource LongListGroupHeader}&quot; GroupItemTemplate=&quot;{StaticResource LongListGroupItemTemplate}&quot;&gt;
    &lt;toolkit:LongListSelector.ItemTemplate&gt;
        &lt;DataTemplate&gt;
            &lt;Grid Margin=&quot;0,12.5,12.5,12.5&quot;&gt;
                &lt;!-- Main List Item Template Here --&gt;
            &lt;/Grid&gt;
        &lt;/DataTemplate&gt;
    &lt;/toolkit:LongListSelector.ItemTemplate&gt;
    &lt;toolkit:LongListSelector.GroupItemsPanel&gt;
        &lt;ItemsPanelTemplate&gt;
            &lt;toolkit:WrapPanel /&gt;
        &lt;/ItemsPanelTemplate&gt;
    &lt;/toolkit:LongListSelector.GroupItemsPanel&gt;
&lt;/toolkit:LongListSelector&gt;</pre>
<p>You&#8217;ll notice we need to implement a few templates, these include: </p>
<ul>
<li>ItemTemplate – Each actual list item </li>
<li>GroupItemsPanel – The panel that holds the popup overlay for selecting a new group </li>
<li>GroupHeaderTemplate – The item at the beginning of each group in the list </li>
<li>GroupItemTemplate – The individual items inside the popup overlay </li>
</ul>
<p>The first two I’ve included above for simplicity, this includes the item template (which you will need to create yourself) and the group items panel, in which I’ve used a wrap panel. The second two templates we will add to the resources section of the page as follows:</p>
<pre class="brush:xml; ruler: true;">&lt;phone:PhoneApplicationPage.Resources&gt;
    &lt;DataTemplate x:Key=&quot;LongListGroupHeader&quot;&gt;
        &lt;Grid Margin=&quot;12,0,0,0&quot;&gt;
            &lt;Grid Width=&quot;75&quot; Height=&quot;75&quot; HorizontalAlignment=&quot;Left&quot;&gt;
                &lt;TextBlock Margin=&quot;12,0,1,7&quot; TextWrapping=&quot;Wrap&quot; d:LayoutOverrides=&quot;Width, Height&quot; Style=&quot;{StaticResource PhoneTextLargeStyle}&quot; Text=&quot;{Binding Title}&quot; VerticalAlignment=&quot;Bottom&quot;/&gt;
                &lt;Border BorderThickness=&quot;1&quot;&gt;
                    &lt;Border.BorderBrush&gt;
                        &lt;SolidColorBrush Color=&quot;{StaticResource PhoneAccentColor}&quot;/&gt;
                    &lt;/Border.BorderBrush&gt;
                &lt;/Border&gt;
            &lt;/Grid&gt;
        &lt;/Grid&gt;
    &lt;/DataTemplate&gt;
    &lt;DataTemplate x:Key=&quot;LongListGroupItemTemplate&quot;&gt;
        &lt;Border Background=&quot;{Binding GroupBackgroundBrush}&quot; Width=&quot;99&quot; Height=&quot;99&quot; Margin=&quot;6&quot; IsHitTestVisible=&quot;{Binding HasItems}&quot;&gt;
            &lt;TextBlock Text=&quot;{Binding Title}&quot;
                                   FontFamily=&quot;{StaticResource PhoneFontFamilySemiBold}&quot;
                                   FontSize=&quot;36&quot;
                                   Margin=&quot;{StaticResource PhoneTouchTargetOverhang}&quot;
                                   Foreground=&quot;{StaticResource PhoneForegroundBrush}&quot;
                                   VerticalAlignment=&quot;Bottom&quot;/&gt;
        &lt;/Border&gt;
    &lt;/DataTemplate&gt;
&lt;/phone:PhoneApplicationPage.Resources&gt;</pre>
<p>You now have all the XAML you need to rock a kick ass selector like the below screenshots:</p>
<p><a href="http://benjii.me/wp-content/uploads/2011/10/ItemTemplates.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="ItemTemplates" border="0" alt="ItemTemplates" src="http://benjii.me/wp-content/uploads/2011/10/ItemTemplates_thumb.png" width="148" height="244" /></a><a href="http://benjii.me/wp-content/uploads/2011/10/ItemTemplates2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="ItemTemplates2" border="0" alt="ItemTemplates2" src="http://benjii.me/wp-content/uploads/2011/10/ItemTemplates2_thumb.png" width="148" height="244" /></a></p>
<p>&#160;</p>
<h2>Step 3: Sweet XAML bro, but how do I bind data?</h2>
<p>Excellent question, you cant just bind a list of items to the itemsource with a long list selector. What you need is the following class and linq queries.</p>
<pre class="brush: csharp; ruler: true;">public class Group&lt;T&gt; : IEnumerable&lt;T&gt;
{
    public Group(string name, IEnumerable&lt;T&gt; items)
    {
        this.Title = name;
        this.Items = new List&lt;T&gt;(items);
    }

    public override bool Equals(object obj)
    {
        Group&lt;T&gt; that = obj as Group&lt;T&gt;;

        return (that != null) &amp;&amp; (this.Title.Equals(that.Title));
    }

    public override int GetHashCode()
    {
        return this.Title.GetHashCode();
    }

    public string Title
    {
        get;
        set;
    }

    public IList&lt;T&gt; Items
    {
        get;
        set;
    }

    public bool HasItems
    {
        get
        {
            return Items.Count &gt; 0;
        }
    }

    public Brush GroupBackgroundBrush
    {
        get
        {
            if (HasItems)
                return (SolidColorBrush)Application.Current.Resources[&quot;PhoneAccentBrush&quot;];
            else
                return (SolidColorBrush)Application.Current.Resources[&quot;PhoneChromeBrush&quot;];
        }
    }

    #region IEnumerable&lt;T&gt; Members

    public IEnumerator&lt;T&gt; GetEnumerator()
    {
        return this.Items.GetEnumerator();
    }

    #endregion

    #region IEnumerable Members

    System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
    {
        return this.Items.GetEnumerator();
    }

    #endregion
}</pre>
<p>The group class is fairly simple, and is mostly just a container with a title and a list of items. What makes it handy are the other properties that it provides to the long list selector, such as the background colour and hit test (whether or not a group item can be clicked).</p>
<p>The idea is we are going to bind a list of groups to our long list selector. Check out the following code and then meet me on the other side for an explanation.</p>
<pre class="brush: csharp; ruler: true;">var allTorrents = (from torrent in model
                select new TorrentListItemViewModel(torrent));

var emptyGroups = new List&lt;Group&lt;TorrentListItemViewModel&gt;&gt;()
{
    new Group&lt;TorrentListItemViewModel&gt;(&quot;#&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;a&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;b&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;c&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;d&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;e&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;f&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;g&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;h&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;i&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;j&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;k&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;l&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;m&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;n&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;o&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;p&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;q&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;r&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;s&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;t&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;u&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;v&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;w&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;x&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;y&quot;, new List&lt;TorrentListItemViewModel&gt;()),
    new Group&lt;TorrentListItemViewModel&gt;(&quot;z&quot;, new List&lt;TorrentListItemViewModel&gt;())
};

var groupedTorrents = (from t in allTorrents
                group t by t.GroupHeader into grp
                orderby grp.Key
                select new Group&lt;TorrentListItemViewModel&gt;(grp.Key, grp));

lstMain.ItemsSource = (from t in groupedTorrents.Union(emptyGroups)
                orderby t.Title
                select t).ToList();</pre>
<p>We start off by fetching the data I need and creating a list of my item view models (TorrentListItemViewModel). Next I create a base list of groups that I want to appear on my screen, regardless of whether or not they have data.</p>
<p>Next I turn my flat list of torrents into a list of groups based on the first letter of their name. The magic coming from the GroupHeader property on my view model, which i’ve shared below:</p>
<pre class="brush: csharp; ruler: true;">public string GroupHeader
{
    get
    {
        switch (Name.ToLower().Substring(0,1))
        {
            case &quot;a&quot;: return &quot;a&quot;;
            case &quot;b&quot;: return &quot;b&quot;;
            case &quot;c&quot;: return &quot;c&quot;;
            case &quot;d&quot;: return &quot;d&quot;;
            case &quot;e&quot;: return &quot;e&quot;;
            case &quot;f&quot;: return &quot;f&quot;;
            case &quot;g&quot;: return &quot;g&quot;;
            case &quot;h&quot;: return &quot;h&quot;;
            case &quot;i&quot;: return &quot;i&quot;;
            case &quot;j&quot;: return &quot;j&quot;;
            case &quot;k&quot;: return &quot;k&quot;;
            case &quot;l&quot;: return &quot;l&quot;;
            case &quot;m&quot;: return &quot;m&quot;;
            case &quot;n&quot;: return &quot;n&quot;;
            case &quot;o&quot;: return &quot;o&quot;;
            case &quot;p&quot;: return &quot;p&quot;;
            case &quot;q&quot;: return &quot;q&quot;;
            case &quot;r&quot;: return &quot;r&quot;;
            case &quot;s&quot;: return &quot;s&quot;;
            case &quot;t&quot;: return &quot;t&quot;;
            case &quot;u&quot;: return &quot;u&quot;;
            case &quot;v&quot;: return &quot;v&quot;;
            case &quot;w&quot;: return &quot;w&quot;;
            case &quot;x&quot;: return &quot;x&quot;;
            case &quot;y&quot;: return &quot;y&quot;;
            case &quot;z&quot;: return &quot;z&quot;;
            default: return &quot;#&quot;;
        }
    }
}</pre>
<p>Basically I calculate on the fly which group the torrent belongs to based on it&#8217;s Name property, defaulting to symbol if no letter is found.</p>
<p>Lastly I Union together the list of torrent groups and empty groups to create a fully filled list of groups that I bind to the long list selector’s ItemsSource property.</p>
<p>That should be all you need to create an alphabetical long list selector. A bit long winded in places, but it does the job nicely.</p>
<h2>&#160;</h2>
<h2>Step 4: Where else can I get info?</h2>
<p>Please check out the <a title="Silverlight Toolkit for Windows Phone Sample Project" href="http://silverlight.codeplex.com/releases/view/71550" target="_blank">silverlight toolkit’s sample project</a> for a succinct and easy to follow piece of sample code for the long list selector and other cool controls.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjii.me/2011/10/how-to-use-the-long-list-selector-for-windows-phone-mango/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Using the MVC-Mini-Profiler with Entity Framework</title>
		<link>http://benjii.me/2011/07/using-the-mvc-mini-profiler-with-entity-framework/</link>
		<comments>http://benjii.me/2011/07/using-the-mvc-mini-profiler-with-entity-framework/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 04:07:56 +0000</pubDate>
		<dc:creator>Benjii</dc:creator>
				<category><![CDATA[MVC]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[entity framework]]></category>
		<category><![CDATA[mvc mini profiler]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://benjii.me/?p=325</guid>
		<description><![CDATA[The MVC Mini Profiler is an awesome tool that can help you reduce your page load times by showing you exactly how long each action, database query, view and even partial view took to load. It can be a little tricky to get right, especially using Entity Framework, but if you follow these steps you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://benjii.me/wp-content/uploads/2011/07/starting-a-blog-how-do-you-measure-success.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="Notice how the success sign points at the title?" border="0" alt="Notice how the success sign points at the title?" align="right" src="http://benjii.me/wp-content/uploads/2011/07/starting-a-blog-how-do-you-measure-success_thumb.jpg" width="244" height="183" /></a>The MVC Mini Profiler is an awesome tool that can help you reduce your page load times by showing you exactly how long each action, database query, view and even partial view took to load. It can be a little tricky to get right, especially using Entity Framework, but if you follow these steps you should be up and running in no time.</p>
<h2>Step 1: Nuget it Baby</h2>
<p>       <a href="http://nuget.org/List/Packages/MiniProfiler"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Mini Profiler Nuget Package" border="0" alt="PM&gt; Install-Package MiniProfiler" src="http://benjii.me/wp-content/uploads/2011/07/image_5.png" width="445" height="92" /></a></p>
<p>If you haven’t used Nuget yet, now would be an excellent time to start as it makes adding references to third party assemblies a breeze. Click the link above to go to the package page to find out more.</p>
<p>By the time you’re done with this step, you should end up with a reference to the mini profiler in your project.</p>
<h2>Step 2: Hook it up</h2>
<p>To get the profiler profiling all we need to do is add the following to our Global.asax.cs:</p>
<pre class="brush: csharp; ruler: true;">protected void Application_BeginRequest()
{
    if (Request.IsLocal)
    {
        MiniProfiler.Start();
    }
}

protected void Application_EndRequest()
{
    MiniProfiler.Stop();
}</pre>
<p>Adding the check for Request.IsLocal means that the profiler will only run when the site is loaded locally. Feel free to add your own check&#8217;s. It&#8217;s usually handy to check for a cookie or an admin login, to see performance on a production website.</p>
<h2>Step 3: Add the includes (and you’re finished)</h2>
<p>Add this quick line of code to your _layout view or at the end of your head section. This adds the necessary javascript and css to keep it neat and tidy in the corner.</p>
<pre class="brush: csharp; ruler: true;">@MvcMiniProfiler.MiniProfiler.RenderIncludes()</pre>
<p>By this point you can fire up your web pages and watch the pretty profiler in action, however it will be a bit bare. Read on to add extra bits and pieces to your fancy new profiler.</p>
<h2>Step 4 (Optional): I want SQL profiling!</h2>
<p>Very good sir, the profiler supports quite a number of database providers. I’m going to focus on using Entity Framework, as that’s where I had the most trouble. Luckily the good community at Stack Overflow have done the leg work here so we can benefit from their genius. Simply use the following code to retrieve your DB context:</p>
<pre class="brush: csharp; ruler: true;">public static T GetProfiledContext&lt;T&gt;() where T : System.Data.Objects.ObjectContext
{
    var conn = ProfiledDbConnection.Get(GetStoreConnection&lt;T&gt;());
    return ObjectContextUtils.CreateObjectContext&lt;T&gt;(conn);
}

public static DbConnection GetStoreConnection&lt;T&gt;() where T : System.Data.Objects.ObjectContext
{
    return GetStoreConnection(&quot;name=&quot; + typeof(T).Name);
}

public static DbConnection GetStoreConnection(string entityConnectionString)
{
    // Build the initial connection string.
    var builder = new EntityConnectionStringBuilder(entityConnectionString);

    // If the initial connection string refers to an entry in the configuration, load that as the builder.
    object configName;
    if (builder.TryGetValue(&quot;name&quot;, out configName))
    {
        var configEntry = WebConfigurationManager.ConnectionStrings[configName.ToString()];
        builder = new EntityConnectionStringBuilder(configEntry.ConnectionString);
    }

    // Find the proper factory for the underlying connection.
    var factory = DbProviderFactories.GetFactory(builder.Provider);

    // Build the new connection.
    DbConnection tempConnection = null;
    try
    {
        tempConnection = factory.CreateConnection();
        tempConnection.ConnectionString = builder.ProviderConnectionString;

        var connection = tempConnection;
        tempConnection = null;
        return connection;
    }
    finally
    {
        // If creating of the connection failed, dispose the connection.
        if (tempConnection != null)
        {
            tempConnection.Dispose();
        }
    }
}</pre>
<p>Just call the GetProfiledContext Method with your entities class like so:</p>
<pre class="brush: csharp; ruler: true;">var context = GetProfiledContext&lt;MyModelEntities&gt;();</pre>
<p>Finally, we need to add this snippet to our web.config to allow for the DbProviderFactories class to do it’s job properly:</p>
<pre class="brush:xml; ruler: true;">&lt;system.data&gt;
    &lt;dbproviderfactories&gt;
        &lt;remove invariant=&quot;MvcMiniProfiler.Data.ProfiledDbProvider&quot; /&gt;
        &lt;add description=&quot;MvcMiniProfiler.Data.ProfiledDbProvider&quot; invariant=&quot;MvcMiniProfiler.Data.ProfiledDbProvider&quot; type=&quot;MvcMiniProfiler.Data.ProfiledDbProviderFactory, MvcMiniProfiler, Version=1.6.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3&quot; name=&quot;MvcMiniProfiler.Data.ProfiledDbProvider&quot; /&gt;
    &lt;/dbproviderfactories&gt;
&lt;/system.data&gt;</pre>
<p>Note that this config is for assembly version 1.6.0.0, in future you may need to change this number.</p>
<p>That&#8217;s it! You should now see some sql load times to your page load times, and if you click the link it will show you the queries generated, duplicate queries and other sql goodies.</p>
<h2>Step 5 (Optional): I want Automatic Controller, View and Partial Profiling!</h2>
<p>Well have you come to the right place. Just the other day Sam Saffron posted about automatic controller and view profiling and it couldn’t be simpler. Create these two classes:</p>
<p>ProfilingActionFilter.cs</p>
<pre class="brush: csharp; ruler: true;">public class ProfilingActionFilter : ActionFilterAttribute
{
    const string stackKey = &quot;ProfilingActionFilterStack&quot;;

    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        var mp = MiniProfiler.Current;
        if (mp != null)
        {
            var stack = HttpContext.Current.Items[stackKey] as Stack&lt;IDisposable&gt;;
            if (stack == null)
            {
                stack = new Stack&lt;IDisposable&gt;();
                HttpContext.Current.Items[stackKey] = stack;
            }

            var prof = MiniProfiler.Current.Step(&quot;Controller: &quot; + filterContext.Controller.ToString() + &quot;.&quot; + filterContext.ActionDescriptor.ActionName);
            stack.Push(prof);

        }
        base.OnActionExecuting(filterContext);
    }

    public override void OnActionExecuted(ActionExecutedContext filterContext)
    {
        base.OnActionExecuted(filterContext);
        var stack = HttpContext.Current.Items[stackKey] as Stack&lt;IDisposable&gt;;
        if (stack != null &amp;&amp; stack.Count &gt; 0)
        {
            stack.Pop().Dispose();
        }
    }
}</pre>
<p>ProfilingViewEngine.cs</p>
<pre class="brush: csharp; ruler: true;">public class ProfilingViewEngine : IViewEngine
{
    class WrappedView : IView
    {
        IView wrapped;
        string name;
        bool isPartial;

        public WrappedView(IView wrapped, string name, bool isPartial)
        {
            this.wrapped = wrapped;
            this.name = name;
            this.isPartial = isPartial;
        }

        public void Render(ViewContext viewContext, System.IO.TextWriter writer)
        {
            using (MiniProfiler.Current.Step(&quot;Render &quot; + (isPartial ? &quot;partial&quot; : &quot;&quot;) + &quot;: &quot; + name))
            {
                wrapped.Render(viewContext, writer);
            }
        }
    }

    IViewEngine wrapped;

    public ProfilingViewEngine(IViewEngine wrapped)
    {
        this.wrapped = wrapped;
    }

    public ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache)
    {
        var found = wrapped.FindPartialView(controllerContext, partialViewName, useCache);
        if (found != null &amp;&amp; found.View != null)
        {
            found = new ViewEngineResult(new WrappedView(found.View, partialViewName, isPartial: true), this);
        }
        return found;
    }

    public ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache)
    {
        var found = wrapped.FindView(controllerContext, viewName, masterName, useCache);
        if (found != null &amp;&amp; found.View != null)
        {
            found = new ViewEngineResult(new WrappedView(found.View, viewName, isPartial: false), this);
        }
        return found;
    }

    public void ReleaseView(ControllerContext controllerContext, IView view)
    {
        wrapped.ReleaseView(controllerContext, view);
    }
}</pre>
<p>Finally, add this snippet of code to your Global.asax.cs &#8211; Application_Start() method to hook it up:</p>
<pre class="brush: csharp; ruler: true;">// Add Profiling Action Filter (mvc mini profiler)
GlobalFilters.Filters.Add(new ProfilingActionFilter());

// Add Profiling View Engine (mvc mini profiler)
var copy = ViewEngines.Engines.ToList();
ViewEngines.Engines.Clear();
foreach (var item in copy)
{
    ViewEngines.Engines.Add(new ProfilingViewEngine(item));
}

RegisterGlobalFilters(GlobalFilters.Filters);</pre>
<h2>References and More Information</h2>
<p>Enjoy your brand new MVC Mini Profiler. Many thanks go to the following collection of awesome links that I&#8217;ve sourced the different code snippets from. Be sure to check them out for extra details and clarity.</p>
<p><a href="http://code.google.com/p/mvc-mini-profiler/">The MVC Mini Profiler Home Page</a></p>
<p><a href="http://www.hanselman.com/blog/NuGetPackageOfTheWeek9ASPNETMiniProfilerFromStackExchangeRocksYourWorld.aspx">Scott Hanselman&#8217;s post about using the MVC Mini Profiler</a></p>
<p><a href="http://stackoverflow.com/questions/6296444/using-mvc-mini-profiler-with-ef-4-0-and-ninject">Stack Overflow solution to the EF connection problem</a></p>
<p><a href="http://stackoverflow.com/questions/6550046/using-mvc-mini-profiler-database-profiling-with-entity-framework-code-first">Stack Overflow inspiration for web config changes</a></p>
<p><a href="http://samsaffron.com/archive/2011/07/25/Automatically+instrumenting+an+MVC3+app">Sam Saffron&#8217;s post on Automatic Controller and View Profiling</a></p>
]]></content:encoded>
			<wfw:commentRss>http://benjii.me/2011/07/using-the-mvc-mini-profiler-with-entity-framework/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Scrollfixed Sidebar Tutorial with jQuery</title>
		<link>http://benjii.me/2011/06/scrollfixed-sidebar-tutorial-with-jquery/</link>
		<comments>http://benjii.me/2011/06/scrollfixed-sidebar-tutorial-with-jquery/#comments</comments>
		<pubDate>Sun, 05 Jun 2011 14:20:32 +0000</pubDate>
		<dc:creator>Benjii</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://benjii.me/2011/06/scrollfixed-sidebar-tutorial-with-jquery/</guid>
		<description><![CDATA[With the unveiling of my brand new blog theme, you may notice a cool little quirk that appears every time you scroll past the header. That’s right not only does the sidebar follow you, but it also pops up a cool mini version of my main header. This post will describe the surprisingly difficult time [...]]]></description>
			<content:encoded><![CDATA[<p>With the unveiling of my brand new blog theme, you may notice a cool little quirk that appears every time you scroll past the header. That’s right not only does the sidebar follow you, but it also pops up a cool mini version of my main header. This post will describe the surprisingly difficult time I had getting my head around the usage of the position fixed css property.</p>
<h2>A little bit of CSS</h2>
<p>The CSS for this isn’t actually the hard part, see below:</p>
<pre class="brush: css; ruler: true;">#wrapper
{
    margin: 0 auto;
    min-width: 1000px;
    width:80%;
    max-width:1400px;
    overflow:hidden;
    position:relative;
}
aside
{
    padding-top:30px;
    overflow: hidden;
    width: 300px;
    float: right;
    clear: none;
}
aside.fixed
{
    position:fixed;
    top:0;
}</pre>
<p>Here I include the fluid width for the wrapper, and set the sidebar to it’s regular place of floated right with 300px width. Simple. The tricky part comes when trying to position the sidebar with a fixed position. Little did I know that position relative has no effect on the position fixed child. <strong>Position fixed is always relative to the viewport.</strong></p>
<h2>jQuery to the Rescue</h2>
<p>Luckily for us, jQuery makes this a very simple problem to fix. At the same time we detect if the sidebar has scrolled far enough, we’ll also measure the correct position for the left property of the sidebar. Thus solving the problem forever. Take a look:</p>
<pre class="brush: javascript; ruler: true;">$(document).ready(function () {

    var $sidebar = $(&quot;aside&quot;),
        $window = $(window),
        offset = $sidebar.offset();

    var bodyRight = $(&quot;#wrapper&quot;).offset().left + $(&quot;#wrapper&quot;).width();

    $window.scroll(function () {
        if ($window.scrollTop() &gt; offset.top) {
            $(&quot;aside&quot;).addClass(&quot;fixed&quot;);
            $(&quot;aside&quot;).css(&quot;left&quot;, bodyRight - $(&quot;aside&quot;).width());
            $(&quot;.miniHeader&quot;).slideDown(&quot;fast&quot;);
        } else {
            $(&quot;aside&quot;).removeClass(&quot;fixed&quot;);
            $(&quot;.miniHeader&quot;).slideUp(&quot;fast&quot;);
        }
    });

});</pre>
<p>Here you’ll notice that we calculate the correct position of the sidebar, then if the window has scrolled far enough, we apply the class and position. You’ll also notice I slide down the mini header. It was just hiding with display none.</p>
<p>These simple pieces of code result in quite a snappy looking sidebar if I do say so myself <img src='http://benjii.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://benjii.me/2011/06/scrollfixed-sidebar-tutorial-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TwitLinkz Wp7 App &#8211; Summarizing a Twitter Feed Near You!</title>
		<link>http://benjii.me/2011/05/twitlinkz-wp7-app-summarizing-a-twitter-feed-near-you/</link>
		<comments>http://benjii.me/2011/05/twitlinkz-wp7-app-summarizing-a-twitter-feed-near-you/#comments</comments>
		<pubDate>Tue, 24 May 2011 13:57:09 +0000</pubDate>
		<dc:creator>Benjii</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://benjii.me/2011/05/twitlinkz-wp7-app-summarizing-a-twitter-feed-near-you/</guid>
		<description><![CDATA[TwitLinkz takes your favourite twitter feeds, pulls out the links and summarizes the articles for you. It’s as simple as that. If you source your up to the minute news from twitter, Twitlinkz is a great way to browse the headlines. Available in the marketplace now, TwitLinkz is free and is set to change the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://benjii.me/wp-content/uploads/2011/05/SmallMobileTile_99x99.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 20px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top: 0px; border-right: 0px; padding-top: 0px" title="SmallMobileTile_99x99" border="0" alt="SmallMobileTile_99x99" align="left" src="http://benjii.me/wp-content/uploads/2011/05/SmallMobileTile_99x99_thumb.png" width="103" height="103" /></a></p>
<p>TwitLinkz takes your favourite twitter feeds, pulls out the links and summarizes the articles for you. It’s as simple as that.</p>
<p>If you source your up to the minute news from twitter, Twitlinkz is a great way to browse the headlines.</p>
<p>Available in the marketplace now, <strong>TwitLinkz is free </strong>and is set to change the way you get your real-time information.</p>
<p>&#160;</p>
<h2><a href="http://benjii.me/wp-content/uploads/2011/05/loadingScreen.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="loadingScreen" border="0" alt="loadingScreen" src="http://benjii.me/wp-content/uploads/2011/05/loadingScreen_thumb.png" width="148" height="244" /></a><a href="http://benjii.me/wp-content/uploads/2011/05/search.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="search" border="0" alt="search" src="http://benjii.me/wp-content/uploads/2011/05/search_thumb.png" width="148" height="244" /></a><a href="http://benjii.me/wp-content/uploads/2011/05/watching2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="watching2" border="0" alt="watching2" src="http://benjii.me/wp-content/uploads/2011/05/watching2_thumb.png" width="148" height="244" /></a><a href="http://benjii.me/wp-content/uploads/2011/05/linklist.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="linklist" border="0" alt="linklist" src="http://benjii.me/wp-content/uploads/2011/05/linklist_thumb.png" width="148" height="244" /></a><a href="http://benjii.me/wp-content/uploads/2011/05/article.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="article" border="0" alt="article" src="http://benjii.me/wp-content/uploads/2011/05/article_thumb.png" width="148" height="244" /></a></h2>
<h2>What does it actually do?</h2>
<p>Here’s the step by step:</p>
<ol>
<li>Follow a twitter feed like #wp7, @benjii22 or “Australia”</li>
<li>TwitLinkz searches the twitter feed for any links that were posted</li>
<li>TwitLinkz fetches and summarizes the articles</li>
<li>You enjoy a list of headlines with article summaries relevant to you</li>
</ol>
<p>&#160;</p>
<h2>Future Features</h2>
<p>I love building Windows Phone 7 apps, so you guys can expect these features to land on your doorstep just as soon as you can say, “Why the hell did he put a z on the end…”</p>
<ul>
<li>Save your articles for later with Instapaper and other exciting web apps</li>
<li>Push Notifications and Live Tiles</li>
<li>Sign in with twitter for more personalised use</li>
</ul>
<p>&#160;</p>
<h2 align="center">Download TwitLinkz Now, It’s Free!</h2>
<p>&#160;</p>
<p><a title="Download TwitLinkz for Windows Phone 7" href="http://social.zune.net/redirect?type=phoneApp&amp;id=15b26053-f17e-e011-986b-78e7d1fa76f8" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="wp7_278x92_blue" border="0" alt="wp7_278x92_blue" src="http://benjii.me/wp-content/uploads/2011/05/wp7_English_278x92_blue.png" width="244" height="83" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://benjii.me/2011/05/twitlinkz-wp7-app-summarizing-a-twitter-feed-near-you/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Torrential – uTorrent WP7 App – Version 1.3 Available Now!</title>
		<link>http://benjii.me/2011/05/torrential-utorrent-wp7-app-version-1-3-available-now/</link>
		<comments>http://benjii.me/2011/05/torrential-utorrent-wp7-app-version-1-3-available-now/#comments</comments>
		<pubDate>Sun, 08 May 2011 09:15:04 +0000</pubDate>
		<dc:creator>Benjii</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Torrential]]></category>

		<guid isPermaLink="false">http://benjii.me/2011/05/torrential-utorrent-wp7-app-version-1-3-available-now/</guid>
		<description><![CDATA[After taking a while to explore other ventures, I’ve finally come back strong with a gleaming new update to Torrential, the WP7 uTorrent Remote Control App. The update is now with Microsoft so you should be receiving it soon, but while we wait, let’s check out what I’ve done: Live Tiles Expect to see these [...]]]></description>
			<content:encoded><![CDATA[<p>After taking a while to explore other ventures, I’ve finally come back strong with a gleaming new update to Torrential, the WP7 uTorrent Remote Control App.</p>
<p>The update is now with Microsoft so you should be receiving it soon, but while we wait, let’s check out what I’ve done:</p>
<h2>Live Tiles</h2>
<p>Expect to see these tiles hitting your home screen during the course of this week. At the moment they’ll be swapping out intermittently during downloads, but you should be able to select your preferred version next release.</p>
<p><a href="http://benjii.me/wp-content/uploads/2011/05/nextupgreen1.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="nextupgreen" border="0" alt="nextupgreen" src="http://benjii.me/wp-content/uploads/2011/05/nextupgreen_thumb1.png" width="177" height="177" /></a><a href="http://benjii.me/wp-content/uploads/2011/05/updowngreen1.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="updowngreen" border="0" alt="updowngreen" src="http://benjii.me/wp-content/uploads/2011/05/updowngreen_thumb1.png" width="177" height="177" /></a></p>
<p>&#160;</p>
<h2>EzTv Integrated Search</h2>
<p>Just like the Isohunt integrated search you’ve come to know and love, you can now search EzTv for your favourite goodies while on the run.</p>
<p><a href="http://benjii.me/wp-content/uploads/2011/05/favouritegoodies.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="favouritegoodies" border="0" alt="favouritegoodies" src="http://benjii.me/wp-content/uploads/2011/05/favouritegoodies_thumb.png" width="148" height="244" /></a></p>
<p>&#160;</p>
<h2>Favourite Websites</h2>
<p>Tired of navigating to the same websites every time you want to download a new torrent? So was I, so now you can save your favourite websites and navigate to them with ease.</p>
<p><a href="http://benjii.me/wp-content/uploads/2011/05/AddFavourite.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="AddFavourite" border="0" alt="AddFavourite" src="http://benjii.me/wp-content/uploads/2011/05/AddFavourite_thumb.png" width="148" height="244" /></a><a href="http://benjii.me/wp-content/uploads/2011/05/Favourites.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Favourites" border="0" alt="Favourites" src="http://benjii.me/wp-content/uploads/2011/05/Favourites_thumb.png" width="148" height="244" /></a></p>
<p>&#160;</p>
<p>There’s also a couple of performance updates in there helping speed things up.</p>
<p>As always you can <a title="Request a New Feature" href="http://torrential.uservoice.com/forums/88381?lang=en&amp;referer=http://benjii.me/torrential/" target="_blank">Request a New Feature</a> thanks to the awesome people at Uservoice.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjii.me/2011/05/torrential-utorrent-wp7-app-version-1-3-available-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Brand New Set of Live Tiles for Torrential Coming Soon</title>
		<link>http://benjii.me/2011/05/a-brand-new-set-of-live-tiles-for-torrential-coming-soon/</link>
		<comments>http://benjii.me/2011/05/a-brand-new-set-of-live-tiles-for-torrential-coming-soon/#comments</comments>
		<pubDate>Thu, 05 May 2011 15:02:51 +0000</pubDate>
		<dc:creator>Benjii</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Torrential]]></category>

		<guid isPermaLink="false">http://benjii.me/2011/05/a-brand-new-set-of-live-tiles-for-torrential-coming-soon/</guid>
		<description><![CDATA[Last week I was asked to provide the live tiles for my application to put towards a “Wall of Live Tiles” display that Microsoft will be showing off in an upcoming event for Windows Phone 7. I was more than happy to join the wall, but my tiles weren’t exactly the greatest looking things in [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I was asked to provide the live tiles for my application to put towards a “Wall of Live Tiles” display that Microsoft will be showing off in an upcoming event for Windows Phone 7. I was more than happy to join the wall, but my tiles weren’t exactly the greatest looking things in the world. I’d like to say they were “practical” but really I was just being lazy. Either way I needed to come up with some new tiles, and fast. Here are the results of my spree in my favourite accent colours:</p>
<p>&#160;</p>
<p><a href="http://benjii.me/wp-content/uploads/2011/05/mainblue.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="mainblue" border="0" alt="mainblue" src="http://benjii.me/wp-content/uploads/2011/05/mainblue_thumb.png" width="177" height="177" /></a><a href="http://benjii.me/wp-content/uploads/2011/05/nextupblue.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="nextupblue" border="0" alt="nextupblue" src="http://benjii.me/wp-content/uploads/2011/05/nextupblue_thumb.png" width="177" height="177" /></a><a href="http://benjii.me/wp-content/uploads/2011/05/updownblue.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="updownblue" border="0" alt="updownblue" src="http://benjii.me/wp-content/uploads/2011/05/updownblue_thumb.png" width="177" height="177" /></a></p>
<p><a href="http://benjii.me/wp-content/uploads/2011/05/maingreen.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="maingreen" border="0" alt="maingreen" src="http://benjii.me/wp-content/uploads/2011/05/maingreen_thumb.png" width="177" height="177" /></a><a href="http://benjii.me/wp-content/uploads/2011/05/nextupgreen.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="nextupgreen" border="0" alt="nextupgreen" src="http://benjii.me/wp-content/uploads/2011/05/nextupgreen_thumb.png" width="177" height="177" /></a><a href="http://benjii.me/wp-content/uploads/2011/05/updowngreen.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="updowngreen" border="0" alt="updowngreen" src="http://benjii.me/wp-content/uploads/2011/05/updowngreen_thumb.png" width="177" height="177" /></a></p>
<p><a href="http://benjii.me/wp-content/uploads/2011/05/mainorange.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="mainorange" border="0" alt="mainorange" src="http://benjii.me/wp-content/uploads/2011/05/mainorange_thumb.png" width="177" height="177" /></a><a href="http://benjii.me/wp-content/uploads/2011/05/nextuporange.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="nextuporange" border="0" alt="nextuporange" src="http://benjii.me/wp-content/uploads/2011/05/nextuporange_thumb.png" width="177" height="177" /></a><a href="http://benjii.me/wp-content/uploads/2011/05/updownorange.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="updownorange" border="0" alt="updownorange" src="http://benjii.me/wp-content/uploads/2011/05/updownorange_thumb.png" width="177" height="177" /></a></p>
<p>&#160;</p>
<p>Expect these bad boys to be hitting your copy of Torrential soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjii.me/2011/05/a-brand-new-set-of-live-tiles-for-torrential-coming-soon/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Push Notifications in Windows Phone 7 – #3 Push that Notification</title>
		<link>http://benjii.me/2011/04/push-notifications-in-windows-phone-7-3-push-that-notification/</link>
		<comments>http://benjii.me/2011/04/push-notifications-in-windows-phone-7-3-push-that-notification/#comments</comments>
		<pubDate>Sat, 23 Apr 2011 05:02:00 +0000</pubDate>
		<dc:creator>Benjii</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[entity framework]]></category>
		<category><![CDATA[Push Notifications]]></category>

		<guid isPermaLink="false">http://benjii.me/2011/04/push-notifications-in-windows-phone-7-3-push-that-notification/</guid>
		<description><![CDATA[Finally we arrive at the thrilling conclusion to my push notifications miniseries. This time we will actually push a notification to a device we have previously recorded. Posts in the series: Code on the device – This will handle everything you need to put into your wp7 app Code on the server – This will [...]]]></description>
			<content:encoded><![CDATA[<p>Finally we arrive at the thrilling conclusion to my push notifications miniseries. This time we will actually push a notification to a device we have previously recorded.</p>
<h4>Posts in the series:</h4>
<ol>
<li><a href="http://benjii.me/2010/12/push-notifications-in-windows-phone-7-1-code-on-the-device/"><strong>Code on the device</strong> – This will handle everything you need to put into your wp7 app</a></li>
<li><a href="http://benjii.me/2011/01/push-notifications-in-windows-phone-7-2-code-on-the-server/" target="_blank"><strong>Code on the server</strong> – This will handle receiving and storing your user’s device URIs on the server</a> </li>
<li><strong>Push that Notification</strong> – This will handle actually pushing notifications</li>
</ol>
<p>&#160;</p>
<h2>Step 1 – Create a Project to do the Pushing</h2>
<p>When we left off, we had created a WP7 App Project and a WCF Rest Service Project. Now we need to create a Windows Service or Console Application to run on the server, pushing notifications when it is necessary. So that we can see the results of our pushing easily, I’ve opted to create a Console Application.</p>
<p>&#160;</p>
<h2>Step 2 &#8211; Copy this Super Useful Notifications Class</h2>
<p>If you take a quick look at this code, you’ll see that we are simply sending some XML to a URI given to us by Microsoft. We picked up the URI in my last post, so read back if you haven’t got one yet. Regardless, here’s the code:</p>
<pre class="brush: csharp; ruler: true;">public class PushNotifications
{
    public string SendToast(string uri, string text1, string text2)
    {
        string template =
	        &quot;&lt;?xml version='1.0' encoding='utf-8'?&gt;&quot; +
	        &quot;&lt;wp:notification xmlns:wp='WPNotification'&gt;&quot; +
	            &quot;&lt;wp:toast&gt;&quot; +
	                &quot;&lt;wp:text1&gt;{0}&lt;/wp:text1&gt;&quot; +
	                &quot;&lt;wp:text2&gt;{1}&lt;/wp:text2&gt;&quot; +
	            &quot;&lt;/wp:toast&gt;&quot; +
	        &quot;&lt;/wp:notification&gt;&quot;;

        string toastXML = string.Format(template, text1, text2);

        HttpWebRequest sendNotificationRequest = (HttpWebRequest)WebRequest.Create(uri);

        sendNotificationRequest.Method = &quot;POST&quot;;
        sendNotificationRequest.Headers = new WebHeaderCollection();

        sendNotificationRequest.ContentType = &quot;text/xml&quot;;
        sendNotificationRequest.Headers.Add(&quot;X-WindowsPhone-Target&quot;, &quot;toast&quot;);
        sendNotificationRequest.Headers.Add(&quot;X-NotificationClass&quot;, &quot;2&quot;);

        byte[] notificationMessage = new UTF8Encoding().GetBytes(toastXML);
        sendNotificationRequest.ContentLength = notificationMessage.Length;

        using (Stream requestStream = sendNotificationRequest.GetRequestStream())
        {
            requestStream.Write(notificationMessage, 0, notificationMessage.Length);
        }

        // Sends the notification and gets the response.
        HttpWebResponse response = (HttpWebResponse)sendNotificationRequest.GetResponse();
        string notificationStatus = response.Headers[&quot;X-NotificationStatus&quot;];
        string notificationChannelStatus = response.Headers[&quot;X-SubscriptionStatus&quot;];
        string deviceConnectionStatus = response.Headers[&quot;X-DeviceConnectionStatus&quot;];

        return notificationStatus;
    }

    public string SendLiveTile(string uri, string backgroundImageUrl, string title, int count)
    {
        string template =
            &quot;&lt;?xml version='1.0' encoding='utf-8'?&gt;&quot; +
            &quot;&lt;wp:notification xmlns:wp='WPNotification'&gt;&quot; +
                &quot;&lt;wp:tile&gt;&quot; +
                    &quot;&lt;wp:backgroundimage&gt;{0}&lt;/wp:backgroundimage&gt;&quot; +
                    &quot;&lt;wp:count&gt;{1}&lt;/wp:count&gt;&quot; +
                    &quot;&lt;wp:title&gt;{2}&lt;/wp:title&gt;&quot; +
                &quot;&lt;/wp:tile&gt;&quot; +
            &quot;&lt;/wp:notification&gt;&quot;;

        string tileXML = string.Format(template, backgroundImageUrl, count.ToString(), title);

        HttpWebRequest sendNotificationRequest = (HttpWebRequest)WebRequest.Create(uri);

        sendNotificationRequest.Method = &quot;POST&quot;;
        sendNotificationRequest.Headers = new WebHeaderCollection();

        sendNotificationRequest.ContentType = &quot;text/xml&quot;;
        sendNotificationRequest.Headers.Add(&quot;X-WindowsPhone-Target&quot;, &quot;token&quot;);
        sendNotificationRequest.Headers.Add(&quot;X-NotificationClass&quot;, &quot;1&quot;);

        byte[] notificationMessage = new UTF8Encoding().GetBytes(tileXML);
        sendNotificationRequest.ContentLength = notificationMessage.Length;

        using (Stream requestStream = sendNotificationRequest.GetRequestStream())
        {
            requestStream.Write(notificationMessage, 0, notificationMessage.Length);
        }

        // Sends the notification and gets the response.
        HttpWebResponse response = (HttpWebResponse)sendNotificationRequest.GetResponse();
        string notificationStatus = response.Headers[&quot;X-NotificationStatus&quot;];
        string notificationChannelStatus = response.Headers[&quot;X-SubscriptionStatus&quot;];
        string deviceConnectionStatus = response.Headers[&quot;X-DeviceConnectionStatus&quot;];

        return notificationStatus;
    }
}</pre>
<p>There are a few things to note with the above code. First of all, the XML should be used exactly as is. I’ve heard of a few people having trouble because they missed a capital letter, or didn’t have all of the correct parameters. </p>
<p>Secondly, pay close attention to the headers we are sending. The X-WindowsPhone-Target header sets the type of notification we are pushing (Toast, Live Tile or Raw) and the X-NotificationClass header sets how quickly the notification will be delivered. I’ve only ever seen people use the most urgent value.</p>
<p>You can find some more info about the above code from <a href="http://msdn.microsoft.com/en-us/library/ff402545%28v=VS.92%29.aspx" target="_blank">How To: Send a Push Notification for Windows Phone</a></p>
<p>Lastly, to see if our message was successfully received by Microsoft’s servers, pay attention to the three headers we receive back from our web call. I pass the X-NotificationStatus back as it gives the best indicator of whether or not the notification worked.</p>
<p>I encourage you to take a look at the <a href="http://msdn.microsoft.com/en-us/library/ff941100%28v=VS.92%29.aspx" target="_blank">Push Notification Service Response Codes for Windows Phone</a> to get an idea of the kinds of responses you could receive.</p>
<p>&#160;</p>
<h2>Step 3 – Push that Notification!</h2>
<p>Just as an example, I’m going to setup our console app so that it pushes a notification to the last device added to our database whenever you press “P”. Check out the code:</p>
<pre class="brush: csharp; ruler: true;">public class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(&quot;Welcome to the sample push notification server&quot;);

        Console.WriteLine(&quot;Running... Press enter to exit&quot;);

        bool running = true;
        while (running)
        {
            var key = Console.ReadKey(true);

            if (key.Key == ConsoleKey.Enter)
            {
                running = false;
            }
            else if (key.Key == ConsoleKey.P)
            {
                using (var context = new WP7AppDBEntities())
                {
                    // First try to find an existing device
                    var device = (from d in context.Devices
                                    orderby d.Added descending
                                    select d).FirstOrDefault();

                    if (device != null)
                    {
                        PushMessage(device.URI, &quot;Success&quot;, &quot;We sent you a message!&quot;);
                    }
                }
            }
        }
    }

    static void PushMessage(string uri, string mainText, string secondaryText)
    {
        Console.WriteLine(DateTime.UtcNow.ToString(&quot;dd/MM/yyyy hh:mm:ss &quot;) + &quot;Ready to Push Message - &quot; + mainText);

        if (!string.IsNullOrEmpty(uri))
        {
            try
            {
                PushNotifications p = new PushNotifications();
                var pushresult = p.SendToast(uri, mainText, secondaryText);

                Console.WriteLine(DateTime.UtcNow.ToString(&quot;dd/MM/yyyy hh:mm:ss &quot;) + &quot;Push Notification Sent: &quot; + pushresult);
            }
            catch (Exception ex)
            {
                Console.WriteLine(DateTime.UtcNow.ToString(&quot;dd/MM/yyyy hh:mm:ss &quot;) + &quot;Error pushing toast notification: &quot; + ex.Message + &quot; - &quot; + ex.StackTrace);
            }
        }
    }
}</pre>
<p>Essentially the above code waits for you to press “P”, pulls the most recently added device from the database we setup earlier and then sends a toast message to the device. I’ve also added some Console.Writes around the place so you can see what’s going on.</p>
<p>You can also use the above code to send a Live Tile update to a device, but that’s a blog post for another day.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjii.me/2011/04/push-notifications-in-windows-phone-7-3-push-that-notification/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

