<?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>JAPF &#187; Windows Phone</title>
	<atom:link href="http://www.japf.fr/category/windows-phone/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.japf.fr</link>
	<description>Jeremy Alles Presentation Foundation: WPF, Silverlight, Windows Phone 7, Windows 8</description>
	<lastBuildDate>Fri, 27 Jan 2012 07:57:31 +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>Windows Phone performance analysis &amp; optimization during TechDays</title>
		<link>http://www.japf.fr/2012/01/windows-phone-performance-analysis-optimization-during-techdays/</link>
		<comments>http://www.japf.fr/2012/01/windows-phone-performance-analysis-optimization-during-techdays/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 07:57:31 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[analysis]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[techdays]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=1065</guid>
		<description><![CDATA[In about 2 weeks now, I&#8217;ll have the chance to be part of the French TechDays in Paris as a speaker. This year, I&#8217;ll own a session called &#8220;Windows Phone performance analysis &#38; optimisation&#8221; with my colleague Charlotte. The agenda looks like the following: why performance analysis ? device vs emulator leveraging WP7 threads using [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/LogoTechDays.png" rel="lightbox[1065]"><img class="alignnone size-full wp-image-1067" title="LogoTechDays" src="http://www.japf.fr/wp-content/uploads/2012/01/LogoTechDays.png" alt="" width="223" height="79" /></a></p>
<p>In about 2 weeks now, I&#8217;ll have the chance to be part of the French TechDays in Paris as a speaker. This year, I&#8217;ll own a session called &#8220;Windows Phone performance analysis &amp; optimisation&#8221; with my colleague Charlotte.</p>
<p>The agenda looks like the following:</p>
<ul>
<li>why performance analysis ?</li>
<li>device vs emulator</li>
<li>leveraging WP7 threads</li>
<li>using the VS profiler for WP7</li>
<li>tips and tricks</li>
</ul>
<p>During the session we will use a &#8220;real&#8221; app we&#8217;re working on for a few months now (I&#8217;ll share more details after the session). We have some cool tips that haven&#8217;t been shared anywhere before, so if performance is a topic of interest for you, stat tuned !</p>
<p>Click on the following image for a link to the TechDays website:</p>
<p><a href="http://www.microsoft.com/france/mstechdays/programmes/parcours.aspx#DomID=9e0aee6e-9896-4c59-ad3f-d4cd48109eaa&amp;SessionID=db46a2a8-566e-4954-8903-e133f2217857"><img class="alignnone  wp-image-1066" title="SessionTechDays" src="http://www.japf.fr/wp-content/uploads/2012/01/SessionTechDays.png" alt="" width="553" height="281" /></a></p>
<p>I&#8217;m planning to share the most of the content of this session on my blog soon after the event.</p>
<p>Don&#8217;t hesitate to stop by and say hi&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2012/01/windows-phone-performance-analysis-optimization-during-techdays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>If you like typing XAML you will love ReSharper 6.1 !</title>
		<link>http://www.japf.fr/2012/01/if-you-like-typing-xaml-you-will-love-resharper-6-1/</link>
		<comments>http://www.japf.fr/2012/01/if-you-like-typing-xaml-you-will-love-resharper-6-1/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 17:42:25 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[resharper]]></category>
		<category><![CDATA[xaml]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=1029</guid>
		<description><![CDATA[Resharper is an amazing tool for any .Net developers. The latest version 6.1 has been released just a couple of weeks ago and I wanted to share with you a brief overview of the new workflow available in the XAML world ! Visual Studio 2010 introduced 2 new design time properties: d:DesignInstance and d:DesignData. Those [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jetbrains.com/resharper/">Resharper</a> is an amazing tool for any .Net developers. The latest version 6.1 has been released just a couple of weeks ago and I wanted to share with you a brief overview of the new workflow available in the XAML world !</p>
<p>Visual Studio 2010 introduced 2 new design time properties: d:DesignInstance and d:DesignData. Those properties can be used in order to specify a design time DataContext in order to have more help during the creation of a binding.</p>
<p>For example, when you create a binding using the Property dialog of VS2010 you can browse your DataContext to select the right property (image from this <a href="http://karlshifflett.wordpress.com/2009/10/28/ddesigninstance-ddesigndata-in-visual-studio-2010-beta2/">blog post</a> from <a href="http://karlshifflett.wordpress.com/">Karl Shifflet</a>):</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/bindingbuilder_thumb.png" rel="lightbox[1029]"><img class="alignnone size-medium wp-image-1031" title="bindingbuilder_thumb" src="http://www.japf.fr/wp-content/uploads/2012/01/bindingbuilder_thumb-300x291.png" alt="" width="300" height="291" /></a></p>
<p>Resharper 6.1 is now able to use those metadata in order to improve the experience you have while typing XAML (which I personally do a LOT!). Here is how it works:</p>
<ul>
<li>you create a new ViewModel with a simple property (this property has just get/set because we don&#8217;t need much more in the context of this post&#8230;)</li>
</ul>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/01.png" rel="lightbox[1029]"><img class="alignnone size-medium wp-image-1034" title="01" src="http://www.japf.fr/wp-content/uploads/2012/01/01-300x99.png" alt="" width="300" height="99" /></a></p>
<ul>
<li>you setup a binding in your view</li>
</ul>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/02.png" rel="lightbox[1029]"><img class="alignnone size-full wp-image-1035" title="02" src="http://www.japf.fr/wp-content/uploads/2012/01/02.png" alt="" width="514" height="126" /></a></p>
<p>At this point the ReSharper magic comes into play&#8230;</p>
<ul>
<li>ReSharper warns you the DataContext is unknown</li>
</ul>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/02.1.png" rel="lightbox[1029]"><img class="alignnone size-full wp-image-1043" title="02.1" src="http://www.japf.fr/wp-content/uploads/2012/01/02.1.png" alt="" width="565" height="126" /></a></p>
<ul>
<li>Offer the ability to fix this</li>
</ul>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/03.png" rel="lightbox[1029]"><img title="03" src="http://www.japf.fr/wp-content/uploads/2012/01/03.png" alt="" width="545" height="271" /></a></p>
<ul>
<li>Note that like in C#, you can very easily resolve namespace issues</li>
</ul>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/041.png" rel="lightbox[1029]"><img class="alignnone size-full wp-image-1046" title="04" src="http://www.japf.fr/wp-content/uploads/2012/01/041.png" alt="" width="602" height="192" /></a></p>
<ul>
<li>Then notice that the warning is gone (the Title property is no longer underlined)</li>
</ul>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/06.png" rel="lightbox[1029]"><img class="alignnone size-full wp-image-1039" title="06" src="http://www.japf.fr/wp-content/uploads/2012/01/06.png" alt="" width="577" height="191" /></a></p>
<ul>
<li>You can now add a new binding</li>
</ul>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/07.png" rel="lightbox[1029]"><img class="alignnone size-full wp-image-1040" title="07" src="http://www.japf.fr/wp-content/uploads/2012/01/07.png" alt="" width="576" height="207" /></a></p>
<ul>
<li>You can then ask ReSharper to create the property in your ViewModel</li>
</ul>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/08.png" rel="lightbox[1029]"><img class="alignnone size-full wp-image-1041" title="08" src="http://www.japf.fr/wp-content/uploads/2012/01/08.png" alt="" width="580" height="378" /></a></p>
<ul>
<li>Choosing the first option will get you to the ViewModel definition</li>
</ul>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/09.png" rel="lightbox[1029]"><img class="alignnone size-full wp-image-1042" title="09" src="http://www.japf.fr/wp-content/uploads/2012/01/09.png" alt="" width="417" height="242" /></a></p>
<p>Now that I&#8217;ve upgraded my installation to version 6.1, I think this is a must have !</p>
<p>That&#8217;s all for today ! Hope it helps <img src='http://www.japf.fr/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2012/01/if-you-like-typing-xaml-you-will-love-resharper-6-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Track memory usage of your Windows Phone 7.1 app in real time</title>
		<link>http://www.japf.fr/2011/11/track-memory-usage-of-your-windows-phone-7-1-app-in-real-time/</link>
		<comments>http://www.japf.fr/2011/11/track-memory-usage-of-your-windows-phone-7-1-app-in-real-time/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 11:51:38 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[windowsphone]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=1001</guid>
		<description><![CDATA[Update January 17th: I just found out that Peter Torr released more than a year ago a similar helper class which is very nice. You can check out his solution here. Memory usage is an important aspect, especially on mobile device. If you want to publish an app on the Windows Phone marketplace you must [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update January 17th:</strong> I just found out that <a href="http://blogs.msdn.com/b/ptorr">Peter Torr</a> released more than a year ago a similar helper class which is very nice. You can check out his solution <a href="http://blogs.msdn.com/b/ptorr/archive/2010/10/30/that-memory-thing-i-promised-you.aspx">here</a>.</p>
<p>Memory usage is an important aspect, especially on mobile device. If you want to publish an app on the Windows Phone marketplace you must satisfy the <em>Technical Certification Requirements: &#8220;5.2.5 Memory Consumption: An application must not exceed 90 MB of RAM usage, except on devices that have more than 256 MB of memory.&#8221; </em></p>
<p>In this post, I&#8217;m sharing <strong>a technique to track the memory usage of a WP7 app in real tile in every single page of the app</strong>. By adding only one line of code in your existing app, you’ll be able to display memory usage in all your pages (without any changes):</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/11/memorywatcher.png" rel="lightbox[1001]"><img class="alignnone size-full wp-image-1014" title="memorywatcher" src="http://www.japf.fr/wp-content/uploads/2011/11/memorywatcher.png" alt="" width="525" height="474" /></a></p>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/11/MemoryWatcherDemo.zip">Download source code and example</a></p>
<p><span style="text-decoration: underline;">How to integrate the component in your existing app?</span></p>
<ol>
<li>import the <em>MemoryWatcher</em> class in your existing project</li>
<li>in the InitializePhoneApplication method, add a new line after the creation of the RootFrame:</li>
</ol>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1001code3'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10013"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p1001code3"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// Create the frame but don't set it as RootVisual yet; this allows the splash</span>
<span style="color: #008080; font-style: italic;">// screen to remain active until the application is ready to render.</span>
RootFrame <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> PhoneApplicationFrame<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008080; font-style: italic;">// Add the following line !</span>
<span style="color: #008000;">new</span> MemoryWatcher<span style="color: #008000;">&#40;</span>RootFrame<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> IsDisplayed <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span> <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p><span style="text-decoration: underline;">How it works?</span></p>
<p>During its initialization, the <em>MemoryWatcher</em> control will set an event handler to have a callback whenever the user navigates to a new page. When the new page is loaded, it checks if it can dynamically insert the <em>MemoryWatcher</em> control. This is done by checking the root UI element of the page and inserting the watcher control in it. Here is the full code of the <em>MemoryWatcher</em> class:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1001code4'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10014"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
</pre></td><td class="code" id="p1001code4"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Linq</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Windows</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Windows.Controls</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Windows.Media</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Windows.Navigation</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Windows.Threading</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.Phone.Controls</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.Phone.Info</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> MemoryWatcherDemo
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> MemoryWatcher <span style="color: #008000;">:</span> ContentControl
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">readonly</span> DispatcherTimer timer<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">readonly</span> PhoneApplicationFrame frame<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">float</span> ByteToMega <span style="color: #008000;">=</span> <span style="color: #FF0000;">1024</span> <span style="color: #008000;">*</span> <span style="color: #FF0000;">1024</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">bool</span> IsDisplayed <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> MemoryWatcher<span style="color: #008000;">&#40;</span>PhoneApplicationFrame frame<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>frame <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ArgumentNullException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;frame&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">frame</span> <span style="color: #008000;">=</span> frame<span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">frame</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Navigated</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> NavigatedEventHandler<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">OnFrameNavigated</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">frame</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Navigating</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> NavigatingCancelEventHandler<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">OnFrameNavigating</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">timer</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> DispatcherTimer <span style="color: #008000;">&#123;</span> Interval <span style="color: #008000;">=</span> TimeSpan<span style="color: #008000;">.</span><span style="color: #0000FF;">FromMilliseconds</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">100</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">timer</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Tick</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> EventHandler<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">OnTimerTick</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// setup some basic properties to ensure the content will be visible</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Foreground</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SolidColorBrush<span style="color: #008000;">&#40;</span>Colors<span style="color: #008000;">.</span><span style="color: #0000FF;">Red</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">VerticalContentAlignment</span> <span style="color: #008000;">=</span> VerticalAlignment<span style="color: #008000;">.</span><span style="color: #0000FF;">Center</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">HorizontalContentAlignment</span> <span style="color: #008000;">=</span> HorizontalAlignment<span style="color: #008000;">.</span><span style="color: #0000FF;">Center</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Margin</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Thickness<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span>, <span style="color: #008000;">-</span><span style="color: #FF0000;">35</span>, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> OnFrameNavigated<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, NavigationEventArgs e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsDisplayed</span><span style="color: #008000;">&#41;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span>
&nbsp;
            var page <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">frame</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #0600FF; font-weight: bold;">as</span> PhoneApplicationPage<span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>page <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                Panel host <span style="color: #008000;">=</span> page<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #0600FF; font-weight: bold;">as</span> Panel<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>host <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;&amp;</span> <span style="color: #008000;">!</span>host<span style="color: #008000;">.</span><span style="color: #0000FF;">Children</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Any</span><span style="color: #008000;">&#40;</span>c <span style="color: #008000;">=&gt;</span> c <span style="color: #008000;">is</span> MemoryWatcher<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">timer</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Start</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    host<span style="color: #008000;">.</span><span style="color: #0000FF;">Children</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> OnFrameNavigating<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, NavigatingCancelEventArgs navigatingCancelEventArgs<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            var page <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">frame</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #0600FF; font-weight: bold;">as</span> PhoneApplicationPage<span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>page <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                Panel host <span style="color: #008000;">=</span> page<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #0600FF; font-weight: bold;">as</span> Panel<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>host <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;&amp;</span> host<span style="color: #008000;">.</span><span style="color: #0000FF;">Children</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">timer</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Stop</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    host<span style="color: #008000;">.</span><span style="color: #0000FF;">Children</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Remove</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> OnTimerTick<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">try</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #6666cc; font-weight: bold;">string</span> currentMemory <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>DeviceStatus<span style="color: #008000;">.</span><span style="color: #0000FF;">ApplicationCurrentMemoryUsage</span> <span style="color: #008000;">/</span> ByteToMega<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;#.00&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #6666cc; font-weight: bold;">string</span> peakMemory <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>DeviceStatus<span style="color: #008000;">.</span><span style="color: #0000FF;">ApplicationPeakMemoryUsage</span> <span style="color: #008000;">/</span> ByteToMega<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;#.00&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Current: {0}MB Peak: {1}MB&quot;</span>, currentMemory, peakMemory<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
            <span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span>Exception<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">timer</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Stop</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p><span style="text-decoration: underline;">Note:</span></p>
<ul>
<li>The MemoryWatcher is looking for a Panel type in order to add itself to the list of children in the page. You might want to modify and improve this portion in order to better fit your needs.</li>
<li>The attached project targets Windows Phone 7.1, if you want to use the code in a 7.0 version, you should change the way the memory values are read (see <a href="http://msdn.microsoft.com/en-us/library/microsoft.phone.info.deviceextendedproperties%28v=vs.92%29.aspx">this article</a> for more details)</li>
</ul>
<p>Enjoy the code and start tracking memory leaks <img src='http://www.japf.fr/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/11/MemoryWatcherDemo.zip">Download source code and example</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2011/11/track-memory-usage-of-your-windows-phone-7-1-app-in-real-time/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Meet me during the Microsoft Days in Lyon next Wednesday !</title>
		<link>http://www.japf.fr/2011/11/meet-me-during-the-microsoft-days-in-lyon-next-wednesday/</link>
		<comments>http://www.japf.fr/2011/11/meet-me-during-the-microsoft-days-in-lyon-next-wednesday/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 12:59:32 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[build]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[techdays]]></category>
		<category><![CDATA[windows8]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=1005</guid>
		<description><![CDATA[Next Wednesday (November 9th), I&#8217;ll be at the Microsoft Days 11 as a member of the Ask The Expert team. I&#8217;ll be playing with the Samsung Slate I got at //BUILD/, discussing WPF, Silverlight, Windows Phone 7 and Windows 8. Don&#8217;t hesitate to stop by and say hi if you&#8217;re coming to this event !]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.japf.fr/wp-content/uploads/2011/11/msdays.png" rel="lightbox[1005]"><img class="alignnone size-full wp-image-1006" title="msdays" src="http://www.japf.fr/wp-content/uploads/2011/11/msdays.png" alt="" width="349" height="69" /></a></p>
<p><strong>Next Wednesday (November 9th), I&#8217;ll be at the Microsoft Days 11 as a member of the <em>Ask The Expert</em> team</strong>. I&#8217;ll be playing with the Samsung Slate I got at //BUILD/, discussing WPF, Silverlight, Windows Phone 7 and Windows 8.</p>
<p>Don&#8217;t hesitate to stop by and say hi if you&#8217;re coming to this event !</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/11/slate.png" rel="lightbox[1005]"><img class="alignnone size-full wp-image-1008" title="slate" src="http://www.japf.fr/wp-content/uploads/2011/11/slate.png" alt="" width="342" height="256" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2011/11/meet-me-during-the-microsoft-days-in-lyon-next-wednesday/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Property change notifications when using SQL CE on Windows Phone 7.1</title>
		<link>http://www.japf.fr/2011/10/property-change-notifications-when-using-sql-ce-on-windows-phone-7-1/</link>
		<comments>http://www.japf.fr/2011/10/property-change-notifications-when-using-sql-ce-on-windows-phone-7-1/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 09:52:31 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[sqlce]]></category>
		<category><![CDATA[wp7]]></category>
		<category><![CDATA[wp7dev]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=989</guid>
		<description><![CDATA[I wanted to share a quick syntax trick I&#8217;m using to send property change notifications in a Windows Phone 7.1 application. As you already know, the Mango release of Windows Phone introduce local database storage using SQL Compact Edition and Linq-To-SQL. In the MSDN documentation Local Database Best Practices for Windows Phone, you can find [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to share a quick syntax trick I&#8217;m using to send property change notifications in a Windows Phone 7.1 application. As you already know, the Mango release of Windows Phone introduce local database storage using SQL Compact Edition and Linq-To-SQL.</p>
<p>In the MSDN documentation <a href="http://msdn.microsoft.com/en-us/library/hh286406%28v=VS.92%29.aspx"><em>Local Database Best Practices for Windows Phone</em></a>, you can find the following recommendation:</p>
<p><em>&#8220;<strong>Minimizing Memory Usage</strong></em></p>
<p><em>LINQ to SQL change tracking works by maintaining two copies of each object (&#8230;)</em></p>
<p><em>By default, LINQ to SQL will create the two copies of the object when the objects are materialized. Frequently, however, only a handful of objects in the materialized collection will actually get modified within a specific transaction. In this case, there is no reason to keep a second copy of the object.</em></p>
<p><em>The INotifyPropertyChanging interface allows the application to notify the DataContext when it is modifying a property that will ultimately be submitted as an update to the database. The DataContext can use that notification as a trigger to create the copy. This way, only the items that are actually changing need to be duplicated.&#8221;</em></p>
<p>It means that to optimize memory usage, your model class should implement both the INotifyPropertyChanged and INotifyPropertyChanging interface. Memory usage is an important aspect, especially on mobile device ! On the Windows Phone platform the certification requires your app to use less than 90MB of memory.</p>
<p>So you&#8217;ll probably end up creating a base class for all your model, maybe something like this <em>EntityBase</em>:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p989code9'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9899"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code" id="p989code9"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> EntityBase <span style="color: #008000;">:</span> INotifyPropertyChanged, INotifyPropertyChanging
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">event</span> PropertyChangedEventHandler PropertyChanged<span style="color: #008000;">;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">event</span> PropertyChangingEventHandler PropertyChanging<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #6666cc; font-weight: bold;">void</span> RaisePropertyChanged<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> propertyName<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>propertyName <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ArgumentNullException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;propertyName&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">PropertyChanged</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">PropertyChanged</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span>, <span style="color: #008000;">new</span> PropertyChangedEventArgs<span style="color: #008000;">&#40;</span>propertyName<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #6666cc; font-weight: bold;">void</span> RaisePropertyChanging<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> propertyName<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>propertyName <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ArgumentNullException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;propertyName&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">PropertyChanging</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">PropertyChanging</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span>, <span style="color: #008000;">new</span> PropertyChangingEventArgs<span style="color: #008000;">&#40;</span>propertyName<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>And you&#8217;ll define a property like the following</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p989code10'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98910"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code" id="p989code10"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Title
<span style="color: #008000;">&#123;</span>
    get
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">title</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
    set 
    <span style="color: #008000;">&#123;</span> 
        <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">title</span> <span style="color: #008000;">!=</span> value<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">RaisePropertyChanging</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Title&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">title</span> <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">RaisePropertyChanged</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Title&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Because I&#8217;m not a big fan of this syntax (property name is duplicated, and it&#8217;s easy to use either the first call or the second one&#8230;), I tried to find another solution. Here is my proposal</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p989code11'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98911"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code" id="p989code11"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Title
<span style="color: #008000;">&#123;</span>
    get
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">title</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
    set 
    <span style="color: #008000;">&#123;</span> 
        <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">title</span> <span style="color: #008000;">!=</span> value<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">NotifyChange</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Title&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">title</span> <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>This syntax is based on the <em>using</em> operator and the <a href="http://msdn.microsoft.com/en-us/library/system.idisposable.aspx">IDisposable</a> interface. The IDisposable interface used to be implemented by objects which must explicitly release resources when they are no longer needed. But you can use it for any other reason and benefit the <em>using</em> operator !</p>
<p>Here is the additional code in my <em>EntityBase</em> class:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p989code12'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98912"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code" id="p989code12"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">protected</span> IDisposable NotifyChange<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">params</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> propertyNames<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">new</span> PropertyChange<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span>, propertyNames<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">class</span> PropertyChange <span style="color: #008000;">:</span> IDisposable
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> ModelEntityBase entity<span style="color: #008000;">;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">readonly</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> propertyNames<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> PropertyChange<span style="color: #008000;">&#40;</span>ModelEntityBase entity, <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> propertyNames<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">entity</span> <span style="color: #008000;">=</span> entity<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">propertyNames</span> <span style="color: #008000;">=</span> propertyNames<span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>var propertyName <span style="color: #0600FF; font-weight: bold;">in</span> propertyNames<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">entity</span><span style="color: #008000;">.</span><span style="color: #0000FF;">RaisePropertyChanging</span><span style="color: #008000;">&#40;</span>propertyName<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>                    
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> Dispose<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>var propertyName <span style="color: #0600FF; font-weight: bold;">in</span> propertyNames<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">entity</span><span style="color: #008000;">.</span><span style="color: #0000FF;">RaisePropertyChanged</span><span style="color: #008000;">&#40;</span>propertyName<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>                    
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">entity</span> <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Not that if setting your property might invalidate other properties as well, you can give more than one parameter to the NotifyChange method. </p>
<p>Hope this helps !</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2011/10/property-change-notifications-when-using-sql-ce-on-windows-phone-7-1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>MVVM Framework explorer updated</title>
		<link>http://www.japf.fr/2011/09/mvvm-framework-explorer-updated/</link>
		<comments>http://www.japf.fr/2011/09/mvvm-framework-explorer-updated/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 11:57:50 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[model-view-viewmodel]]></category>
		<category><![CDATA[mvvm]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=954</guid>
		<description><![CDATA[I just updated my MVVM frameworks explorer Silverlight application. You can find the updated application here. Here is the top 5 of MVVM frameworks supporting WPF, Silverlight and Windows Phone 7: MVVM Light (61k downloads) nRoute (19k downloads) Caliburn Micro (18k downloads) Simple MVVM toolkit (5k downloads) Catel (5k downloads)]]></description>
			<content:encoded><![CDATA[<p>I just updated my MVVM frameworks explorer Silverlight application. You can find the updated application <a href="http://www.japf.fr/silverlight/mvvm/index.html">here</a>.</p>
<p>Here is the top 5 of MVVM frameworks supporting WPF, Silverlight and Windows Phone 7:</p>
<ol>
<li><a href="http://mvvmlight.codeplex.com/">MVVM Light</a> (61k downloads)</li>
<li><a href="http://nroute.codeplex.com/">nRoute</a> (19k downloads)</li>
<li><a href="http://caliburnmicro.codeplex.com/">Caliburn Micro</a> (18k downloads)</li>
<li><a href="http://simplemvvmtoolkit.codeplex.com/">Simple MVVM toolkit</a> (5k downloads)</li>
<li><a href="http://catel.codeplex.com/">Catel</a> (5k downloads)</li>
</ol>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/09/mvvm-frameworks.png" rel="lightbox[954]"><img class="alignnone size-full wp-image-955" title="mvvm-frameworks" src="http://www.japf.fr/wp-content/uploads/2011/09/mvvm-frameworks.png" alt="" width="464" height="80" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2011/09/mvvm-framework-explorer-updated/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>When enough ViewModel is enough</title>
		<link>http://www.japf.fr/2011/04/when-enough-viewmodel-is-enough/</link>
		<comments>http://www.japf.fr/2011/04/when-enough-viewmodel-is-enough/#comments</comments>
		<pubDate>Tue, 19 Apr 2011 12:26:59 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[mvvm]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=906</guid>
		<description><![CDATA[In the last few years, we&#8217;ve seen the WPF and Silverlight community embracing the MVVM methodology. As one of the early adopters of MVVM (one of my first post about the subject was late 2008), I&#8217;ve seen the pattern evolving both in the web community and with developers I&#8217;ve met in my daily life. Today, [...]]]></description>
			<content:encoded><![CDATA[<p>In the last few years, we&#8217;ve seen the WPF and Silverlight community embracing the MVVM methodology. As one of the early adopters of MVVM (one of <a href="http://www.japf.fr/2008/12/why-should-i-use-model-view-viewmodel-pattern/">my first post</a> about the subject was late 2008), I&#8217;ve seen the pattern evolving both in the web community and with developers I&#8217;ve met in my daily life.</p>
<p>Today, I&#8217;d like to share with you a simple concept I try to stick to when I&#8217;m doing WPF, Silverlight or Windows Phone 7 development. It can be summarized as &#8220;Enough ViewModel is enough&#8221;.</p>
<p>The simple idea behind this slogan is that there ARE stuff which are view-related and SHOULD NOT be embedded in the ViewModel layer. I&#8217;ve seen too many developers going the &#8220;100% viewmodel way&#8221; which means for them absolutely no code-behind without any dispensation.</p>
<p>For example, I came across this code. It&#8217;s the ViewModel layer associated to a simple view where the user fills various input and has immediate feedback about the progress (like &#8220;75% of the fields are completed&#8221;). If by the way you&#8217;re interested in implementing this behavior you can check out <a href="http://www.codeproject.com/KB/smart/WPF_Validation_Attribute.aspx">this article</a> I wrote on CodeProject)</p>
<p>The following code is simplified to the sake of the article:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p906code15'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p90615"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
</pre></td><td class="code" id="p906code15"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> ViewModel
<span style="color: #008000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">// data field acts as the model object behind the VM layer</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> Data data<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">// missing code...</span>
    <span style="color: #008080; font-style: italic;">// public properties used by the view using databinding</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> ViewModel<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #008080; font-style: italic;">// very simplified for this article...</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">data</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Data<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">data</span><span style="color: #008000;">.</span><span style="color: #0000FF;">SelectedValuesChanged</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> EventHandler<span style="color: #008000;">&#40;</span>data_SelectedValuesChanged<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> UpdateProgress<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #008080; font-style: italic;">// some code...</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #6666cc; font-weight: bold;">void</span> data_SelectedValuesChanged<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">UpdateProgress</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Initialize</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> Initialize<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        var item <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">data</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetItem</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;id1&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>item <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            item<span style="color: #008000;">.</span><span style="color: #0000FF;">PropertyChanged</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> PropertyChangedEventHandler<span style="color: #008000;">&#40;</span>item_PropertyChanged<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            item<span style="color: #008000;">.</span><span style="color: #0000FF;">SelectedValuesChanged</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> EventHandler<span style="color: #008000;">&#40;</span>item_SelectedValuesChanged<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>var value <span style="color: #0600FF; font-weight: bold;">in</span> item<span style="color: #008000;">.</span><span style="color: #0000FF;">Values</span><span style="color: #008000;">&#41;</span>
                value<span style="color: #008000;">.</span><span style="color: #0000FF;">PropertyChanged</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> PropertyChangedEventHandler<span style="color: #008000;">&#40;</span>item_PropertyChanged<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        item <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">data</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetItem</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;id2&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>item <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            item<span style="color: #008000;">.</span><span style="color: #0000FF;">PropertyChanged</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> PropertyChangedEventHandler<span style="color: #008000;">&#40;</span>item_PropertyChanged<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            item<span style="color: #008000;">.</span><span style="color: #0000FF;">SelectedValuesChanged</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> EventHandler<span style="color: #008000;">&#40;</span>item_SelectedValuesChanged<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>var value <span style="color: #0600FF; font-weight: bold;">in</span> item<span style="color: #008000;">.</span><span style="color: #0000FF;">Values</span><span style="color: #008000;">&#41;</span>
                value<span style="color: #008000;">.</span><span style="color: #0000FF;">PropertyChanged</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> PropertyChangedEventHandler<span style="color: #008000;">&#40;</span>item_PropertyChanged<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #6666cc; font-weight: bold;">void</span> item_PropertyChanged<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, <span style="color: #000000;">System.<span style="color: #0000FF;">ComponentModel</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">PropertyChangedEventArgs</span> e<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">UpdateProgress</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #6666cc; font-weight: bold;">void</span> item_SelectedValuesChanged<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">UpdateProgress</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>The idea is simple, as soon as the user changes a value in the View, we must compute the current progress. Because the ViewModel have several levels, we end-up having to register to every single PropertyChanged event which leads to cumbersome code. By the way, this code can also creates memory leaks since we register a lot of event handlers without removing them, but that&#8217;s another discussion&#8230;</p>
<p>Here is my way to solve this problem:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p906code16'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p90616"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code" id="p906code16"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">partial</span> <span style="color: #6666cc; font-weight: bold;">class</span> View <span style="color: #008000;">:</span> UserControl
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">readonly</span> ViewModel viewmodel<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> View<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        InitializeComponent<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">viewmodel</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ViewModel<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AddHandler</span><span style="color: #008000;">&#40;</span>
            FocusManager<span style="color: #008000;">.</span><span style="color: #0000FF;">LostFocusEvent</span>,
            <span style="color: #008000;">new</span> RoutedEventHandler<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">OnLostFocus</span><span style="color: #008000;">&#41;</span>,
            <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> OnLostFocus<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, RoutedEventArgs e<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">viewmodel</span><span style="color: #008000;">.</span><span style="color: #0000FF;">UpdateProgress</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>      
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>What is wrong with this way ? The View has code-behind ? That&#8217;s not a big deal: the code is more readable, maintainable. It makes also more sense: when a view-related operation occurs (in this case, focus has changed), update the progress.</p>
<p>The simple message I&#8217;d like to spread is the fact that there is nothing wrong with the fact to have <strong>sometime</strong>, a <strong>little bit of code-behind</strong> in your view<strong> if</strong> that facilitates your architecture. There is no need to create a complicated infrastructure with behaviors, commands or bindings just to keep the view empty if that does not make sense.</p>
<p>Another great example in a real application is available in the <a href="http://stores.lulu.com/joshsmithonwpf">Advanced MVVM</a> book by <a href="http://joshsmithonwpf.wordpress.com/">Josh Smith</a>.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2011/04/when-enough-viewmodel-is-enough/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Mix11: Windows Phone 7 news</title>
		<link>http://www.japf.fr/2011/04/mix11-windows-phone-7-news/</link>
		<comments>http://www.japf.fr/2011/04/mix11-windows-phone-7-news/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 17:27:20 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=884</guid>
		<description><![CDATA[Today is Mix day ! After yesterday keynote about HTML5, IE10 preview and other web stuff, it&#8217;s time for serious Silverlight and Windows Phone announcements ! Today&#8217;s keynote starts with Joe Belfiore talking about the update process for the NoDo update of WP7. As you know this update was not delivered &#8220;properly&#8221;, but at least [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.japf.fr/wp-content/uploads/2011/04/logoMix111.png" rel="lightbox[884]"><img class="alignnone size-full wp-image-885" title="logoMix11" src="http://www.japf.fr/wp-content/uploads/2011/04/logoMix111.png" alt="" width="182" height="151" /></a></p>
<p>Today is <a href="http://live.visitmix.com">Mix</a> day ! After yesterday keynote about HTML5, IE10 preview and other web stuff, it&#8217;s time for serious Silverlight and Windows Phone announcements !</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/04/wp7-mix.png" rel="lightbox[884]"><img class="alignnone size-full wp-image-895" title="wp7-mix" src="http://www.japf.fr/wp-content/uploads/2011/04/wp7-mix.png" alt="" width="280" height="160" /></a></p>
<p>Today&#8217;s keynote starts with Joe Belfiore talking about the update process for the NoDo update of WP7. As you know this update was not delivered &#8220;properly&#8221;, but at least we know have a good communication from Microsoft about that (you can for exemple check-out the <a href="http://www.microsoft.com/windowsphone/en-us/features/update-schedules.aspx">Where&#8217;s my phone update</a> website)</p>
<p><strong>Nokia partnership</strong></p>
<ul>
<li>Marco Argenti, Head of Dev Experience comes on stage</li>
<li>Nokia is &#8220;working very hard&#8221; to deliver the very first WP7 device</li>
</ul>
<p><strong>General</strong></p>
<ul>
<li>update is schedule for the fall</li>
<li>all existing phones and new phones will get the update</li>
<li>16 additional languages will be supported</li>
<li>more countries where we can create apps (from 30 to 38)</li>
<li>more countries where we can buy apps (from 16 to 35)</li>
</ul>
<p><strong>Marketplace / Search</strong></p>
<ul>
<li>better apps list: filter by letters (like with the contacts)</li>
<li>new search button to search for a particular app</li>
<li>better marketplace
<ul>
<li>more information with less confusion (music and apps are no longer mixed)</li>
<li>search for podcasts</li>
<li>new &#8220;related&#8221; pivot item when seeing an app for related app</li>
</ul>
</li>
<li>we can integrate an app with the search feature of the phone</li>
</ul>
<p><strong>Web Experience</strong></p>
<ul>
<li>the update include IE9</li>
<li>the core engine is the same code base that the one we found desktop : including HW acceleration</li>
<li>address bar is moved to the bottom</li>
<li>support background audio for HTML5: you can leave IE and keep listening to the music !</li>
<li>tabbed UI for navigating between tabs</li>
<li>support for H264 video</li>
</ul>
<p><strong>Platform</strong></p>
<ul>
<li>improved panorama and pivot control</li>
<li>improvements for live tiles</li>
<li>access to the ring tones settings (set a music files as ring tone programmatically)</li>
<li>TCP/IP sockets</li>
<li>SQL database</li>
<li>more launchers and choosers</li>
<li>data access to the contacts and calendars on the phone</li>
<li>better integration with the sensors on the phone (like RAW camera access)</li>
<li>Skype coming to the platform this fall (leveraging many of those new features)</li>
<li>pin live tiles with deep link to our apps (which would launch the app and give the link as parameter)</li>
<li>Silverlight 4 features support</li>
<li>applications can now contains both Silverlight and XNA content</li>
</ul>
<p><strong>Multitasking</strong></p>
<ul>
<li>Spotify coming to WP7 using new multitasking capabilities</li>
<li>fast-app switching</li>
<li>use &#8220;live agents&#8221; to prevent battery life</li>
</ul>
<p><strong>Tooling</strong></p>
<ul>
<li>new version of tools will be available next month !</li>
<li>new capabilities in the emulator: simulate accelerometer and location sensors right from the emulator</li>
</ul>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/04/emulator-acc.png" rel="lightbox[884]"><img class="alignnone size-full wp-image-890" title="emulator-acc" src="http://www.japf.fr/wp-content/uploads/2011/04/emulator-acc.png" alt="" width="418" height="220" /></a></p>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/04/emulator-loc.png" rel="lightbox[884]"><img class="alignnone size-full wp-image-891" title="emulator-loc" src="http://www.japf.fr/wp-content/uploads/2011/04/emulator-loc.png" alt="" width="418" height="220" /></a></p>
<ul>
<li>new profiling support</li>
</ul>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/04/tool-perf.png" rel="lightbox[884]"><img class="alignnone size-full wp-image-892" title="tool-perf" src="http://www.japf.fr/wp-content/uploads/2011/04/tool-perf.png" alt="" width="418" height="220" /></a></p>
<p><strong>Performance</strong></p>
<ul>
<li>scrolling: totally smooth scrolling without any changes in our applications !</li>
<li>image decoding</li>
<li>garbage collection</li>
<li>memory usage</li>
</ul>
<p><strong>Conclusion</strong></p>
<ul>
<li>A lot of new features available to developers + Silverlight 4 features coming to the phone</li>
<li>An development experience which is definitively the best out on the market for mobile development</li>
<li>Microsoft is listening to our feedback</li>
<li>Update is schedule for this fall !</li>
<li>New version of the tools next month</li>
</ul>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/04/wp7-new-stuff.png" rel="lightbox[884]"><img class="alignnone size-full wp-image-893" title="wp7-new-stuff" src="http://www.japf.fr/wp-content/uploads/2011/04/wp7-new-stuff.png" alt="" width="418" height="228" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2011/04/mix11-windows-phone-7-news/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TechDays 2011: Rx talk, slides and source code</title>
		<link>http://www.japf.fr/2011/02/techdays-2011-rx-talk-slides-and-source-code/</link>
		<comments>http://www.japf.fr/2011/02/techdays-2011-rx-talk-slides-and-source-code/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 15:53:21 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Rx]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[rx]]></category>
		<category><![CDATA[techdays]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=791</guid>
		<description><![CDATA[As promised, here is a blog post which shares source code and slides for the Rx talk I gave during last TechDays in Paris. I animated this session with my co-worker Charlotte and with Mitsu. Download slides here. Download source code here. Demo1: Drag&#8217;n'drop in a WPF application The goal was to implement a basic [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.japf.fr/wp-content/uploads/2011/02/techdays.png" rel="lightbox[791]"><img class="alignnone size-full wp-image-783" title="techdays" src="http://www.japf.fr/wp-content/uploads/2011/02/techdays.png" alt="" width="389" height="48" /></a></p>
<p>As promised, here is a blog post which shares source code and slides for the Rx talk I gave during last TechDays in Paris. I animated this session with my co-worker Charlotte and with <a href="http://mitsufu.wordpress.com/">Mitsu</a>.</p>
<p>Download slides <a href="http://www.japf.fr/wp-content/uploads/2011/02/TechDays2011_RxSlides.pdf">here</a>.<br />
Download source code <a href="http://www.japf.fr/wp-content/uploads/2011/02/TechDays2011_RxDemos.zip">here</a>.</p>
<p><strong>Demo1: Drag&#8217;n'drop in a WPF application</strong></p>
<p>The goal was to implement a basic drag&#8217;n'drop functionality in a WPF application. The Rx query looks like the following:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p791code20'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p79120"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p791code20"><pre class="csharp" style="font-family:monospace;">var query <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">from</span> mouseDown <span style="color: #0600FF; font-weight: bold;">in</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">image</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetMouseLeftButtonDownObservable</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
            let downPosition <span style="color: #008000;">=</span> mouseDown<span style="color: #008000;">.</span><span style="color: #0000FF;">EventArgs</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetPosition</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#41;</span>
            let rect <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Rect<span style="color: #008000;">&#40;</span>downPosition<span style="color: #008000;">.</span><span style="color: #0000FF;">X</span> <span style="color: #008000;">-</span> <span style="color: #FF0000;">10</span>, downPosition<span style="color: #008000;">.</span><span style="color: #0000FF;">Y</span> <span style="color: #008000;">-</span> <span style="color: #FF0000;">10</span>, <span style="color: #FF0000;">20</span>, <span style="color: #FF0000;">20</span><span style="color: #008000;">&#41;</span>
            let delta <span style="color: #008000;">=</span> mouseDown<span style="color: #008000;">.</span><span style="color: #0000FF;">EventArgs</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetPosition</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">image</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">from</span> mouseMove <span style="color: #0600FF; font-weight: bold;">in</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetMouseMoveObservable</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Select</span><span style="color: #008000;">&#40;</span>ea <span style="color: #008000;">=&gt;</span> ea<span style="color: #008000;">.</span><span style="color: #0000FF;">EventArgs</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetPosition</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">.</span><span style="color: #0000FF;">SkipWhile</span><span style="color: #008000;">&#40;</span>p <span style="color: #008000;">=&gt;</span> rect<span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span>p<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">.</span><span style="color: #0000FF;">DoOnce</span><span style="color: #008000;">&#40;</span>p <span style="color: #008000;">=&gt;</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">onMouseEnter</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Begin</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">image</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Select</span><span style="color: #008000;">&#40;</span>p <span style="color: #008000;">=&gt;</span> p<span style="color: #008000;">.</span><span style="color: #0000FF;">Offset</span><span style="color: #008000;">&#40;</span>delta<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">.</span><span style="color: #0000FF;">TakeUntil</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetMouseLeftButtonUpObservable</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Finally</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">=&gt;</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">onMouseLeave</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Begin</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">image</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">select</span> mouseMove<span style="color: #008000;">;</span>
&nbsp;
query<span style="color: #008000;">.</span><span style="color: #0000FF;">Subscribe</span><span style="color: #008000;">&#40;</span>p <span style="color: #008000;">=&amp;</span>gt<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">image</span><span style="color: #008000;">.</span><span style="color: #0000FF;">SetPosition</span><span style="color: #008000;">&#40;</span>p<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p><br/><br />
<strong>Demo2: online Twitter search and Bing map </strong>geolocalization</p>
<p>This time, the goal was to query Twitter asynchronously and to geolocalize the associated Tweets. The Rx query:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p791code21'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p79121"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code" id="p791code21"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">textbox</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetTextChangedObservable</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">.</span><span style="color: #0000FF;">DistinctUntilChanged</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>ea<span style="color: #008000;">&#41;</span> <span style="color: #008000;">=&amp;</span>gt<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">textbox</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Text</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">.</span><span style="color: #0000FF;">Throttle</span><span style="color: #008000;">&#40;</span>TimeSpan<span style="color: #008000;">.</span><span style="color: #0000FF;">FromMilliseconds</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">300</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">.</span><span style="color: #0000FF;">ObserveOnDispatcher</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Do</span><span style="color: #008000;">&#40;</span>ea <span style="color: #008000;">=&gt;</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ShowLoadingIndicator</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Select</span><span style="color: #008000;">&#40;</span>ea <span style="color: #008000;">=&gt;</span> TweeterHelper<span style="color: #008000;">.</span><span style="color: #0000FF;">Search</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">textbox</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Text</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Switch</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">.</span><span style="color: #0000FF;">ObserveOn</span><span style="color: #008000;">&#40;</span>Scheduler<span style="color: #008000;">.</span><span style="color: #0000FF;">Dispatcher</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Select</span><span style="color: #008000;">&#40;</span>page <span style="color: #008000;">=&gt;</span> TweeterHelper<span style="color: #008000;">.</span><span style="color: #0000FF;">ParseTwitterSearch</span><span style="color: #008000;">&#40;</span>page<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">.</span><span style="color: #0000FF;">Subscribe</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>tweets<span style="color: #008000;">&#41;</span> <span style="color: #008000;">=&gt;</span>
                    <span style="color: #008000;">&#123;</span>
                        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">HideLoadingIndicator</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">listbox</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ItemsSource</span> <span style="color: #008000;">=</span> tweets<span style="color: #008000;">;</span>
&nbsp;
                        TweeterHelper<span style="color: #008000;">.</span><span style="color: #0000FF;">LocalizeTweets</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">map</span>, tweets<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    <span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p><br/><br />
<strong>Demo3: using the accelerometer in a Windows Phone 7 application</strong></p>
<p>The last demo was about the usage of the accelerometer in a Windows Phone 7 application. Here is the relevant Rx query:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p791code22'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p79122"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p791code22"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> MoveEllipse<span style="color: #008000;">&#40;</span>IObservable<span style="color: #008000;">&lt;</span>Acceleration<span style="color: #008000;">&gt;</span> accelerationObservable<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    accelerationObservable
        <span style="color: #008000;">.</span><span style="color: #0000FF;">SlidingBuffer</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Select</span><span style="color: #008000;">&#40;</span>accCouple <span style="color: #008000;">=&gt;</span> <span style="color: #008000;">new</span> Acceleration<span style="color: #008000;">&#40;</span>accCouple<span style="color: #008000;">.</span><span style="color: #0000FF;">First</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, accCouple<span style="color: #008000;">.</span><span style="color: #0000FF;">Last</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">.</span><span style="color: #0000FF;">ObserveOnDispatcher</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Do</span><span style="color: #008000;">&#40;</span>acc <span style="color: #008000;">=&gt;</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">textBlock</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> acc<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">.</span><span style="color: #0000FF;">Scan</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> Point<span style="color: #008000;">&#40;</span>x0, y0<span style="color: #008000;">&#41;</span>, <span style="color: #008000;">&#40;</span>point, acc<span style="color: #008000;">&#41;</span> <span style="color: #008000;">=&gt;</span> point<span style="color: #008000;">.</span><span style="color: #0000FF;">Move</span><span style="color: #008000;">&#40;</span>acc<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ClipTo</span><span style="color: #008000;">&#40;</span>horizontalInterval, verticaInterval<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">.</span><span style="color: #0000FF;">Subscribe</span><span style="color: #008000;">&#40;</span>p <span style="color: #008000;">=&gt;</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ellipse</span><span style="color: #008000;">.</span><span style="color: #0000FF;">SetCenter</span><span style="color: #008000;">&#40;</span>p<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Doing this session was a really great experience ! I&#8217;d like to thank Charlotte and Mitsu for doing it with me. Also, I&#8217;d like to thank all users who came to the presentation !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2011/02/techdays-2011-rx-talk-slides-and-source-code/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>TechDays 2011: Rx talk in Paris</title>
		<link>http://www.japf.fr/2011/02/techdays-2011-rx-talk-in-paris/</link>
		<comments>http://www.japf.fr/2011/02/techdays-2011-rx-talk-in-paris/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 15:56:23 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Rx]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[rx]]></category>
		<category><![CDATA[techdays]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=780</guid>
		<description><![CDATA[During the next 3 days, the &#8220;Palais des Congrès&#8221; in Paris will hosting the TechDays 2011. For the very first time, I&#8217;ll have the chance to be part of it as a speaker for a talk about Rx (Reactive Extensions). The session will take place in room 241, tomorrow Thursday 8, from 1pm to 2pm. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.japf.fr/wp-content/uploads/2011/02/728x90_inscription.gif" rel="lightbox[780]"><img class="alignnone size-full wp-image-781 jzlhsoljhgbqhvqemcua jzlhsoljhgbqhvqemcua jzlhsoljhgbqhvqemcua jzlhsoljhgbqhvqemcua jzlhsoljhgbqhvqemcua jzlhsoljhgbqhvqemcua jzlhsoljhgbqhvqemcua jzlhsoljhgbqhvqemcua dffmfrpvuitqtkhgypts dffmfrpvuitqtkhgypts" title="728x90_inscription" src="http://www.japf.fr/wp-content/uploads/2011/02/728x90_inscription.gif" alt="" width="728" height="90" /></a><a href="http://www.japf.fr/wp-content/uploads/2011/02/techdays.png" rel="lightbox[780]"><img class="alignnone size-full wp-image-783" title="techdays" src="http://www.japf.fr/wp-content/uploads/2011/02/techdays.png" alt="" width="461" height="57" /></a></p>
<p>During the next 3 days, the <em>&#8220;Palais des Congrès&#8221;</em> in Paris will hosting the TechDays 2011. For the very first time, I&#8217;ll have the chance to be part of it as a speaker for a talk about Rx (<a href="http://msdn.microsoft.com/fr-fr/data/gg577609">Reactive Extensions</a>).</p>
<p>The <strong>session will take place in room 241</strong>, tomorrow Thursday 8, from 1pm to 2pm. Here is <a href="http://www.microsoft.com/france/mstechdays/programmes/Session.aspx?CellID=fc95ffb7-3dee-4365-acbf-971c586937a6&amp;DomID=3b2f53d1-855e-4d14-b76d-e5c8686da6ec">the link</a> to the session&#8217;s description (in French).</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/02/rxlogo.png" rel="lightbox[780]"><img class="alignnone size-full wp-image-786" title="rxlogo" src="http://www.japf.fr/wp-content/uploads/2011/02/rxlogo.png" alt="" width="249" height="95" /></a></p>
<p>I&#8217;ll share presentation slides and source code by the end of the week <img src='http://www.japf.fr/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2011/02/techdays-2011-rx-talk-in-paris/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

