<?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</title>
	<atom:link href="http://www.japf.fr/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>ReSharper and code generation</title>
		<link>http://www.japf.fr/2012/01/resharper-and-code-generation/</link>
		<comments>http://www.japf.fr/2012/01/resharper-and-code-generation/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 12:58:39 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[resharper]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=1053</guid>
		<description><![CDATA[I don&#8217;t know why I&#8217;ve found this feature only today, but I wanted to share another great feature of ReSharper. Let say you need to implement a C# structure. You may start with the following code: ?View Code CSHARP1 2 3 4 5 6 public struct ServerItem &#123; public string Id &#123; get; private set; [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know why I&#8217;ve found this feature only today, but I wanted to share another great feature of ReSharper. Let say you need to implement a C# structure. You may start with the following code:</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('p1053code4'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10534"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p1053code4"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">struct</span> ServerItem
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Id <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">private</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> DateTime<span style="color: #008000;">?</span> Added <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">private</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> ChildCount <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">private</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Then you start thinking, &#8220;I need to setup a constructor&#8230;&#8221; You can do it manually, but you can also ask ReSharper do to the job for you. All you have to do is press ALT+Enter (this might depend on your configuration obviously&#8230;)</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/GeneratorCtor.png" rel="lightbox[1053]"><img class="alignnone size-full wp-image-1056" title="GeneratorCtor" src="http://www.japf.fr/wp-content/uploads/2012/01/GeneratorCtor.png" alt="" width="324" height="237" /></a></p>
<p>ReSharper will generate the constructor for you:</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('p1053code5'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10535"><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="p1053code5"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">struct</span> ServerItem
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> ServerItem<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> id, DateTime<span style="color: #008000;">?</span> added, <span style="color: #6666cc; font-weight: bold;">int</span> childCount<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">:</span> <span style="color: #0600FF; font-weight: bold;">this</span><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;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Id</span> <span style="color: #008000;">=</span> id<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Added</span> <span style="color: #008000;">=</span> added<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ChildCount</span> <span style="color: #008000;">=</span> childCount<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;">string</span> Id <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">private</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> DateTime<span style="color: #008000;">?</span> Added <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">private</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> ChildCount <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">private</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Fine. Then you remember that you also need to setup equality members properly&#8230; You have to override Equals, GetHashCode&#8230; This is not complicated but it can become cumbersome and it often feels like a waste of time. Here is the ReSharper way of doing this:</p>
<p>1. Press ALT+Enter</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/GenerateEquals0.png" rel="lightbox[1053]"><img class="alignnone size-full wp-image-1054" title="GenerateEquals0" src="http://www.japf.fr/wp-content/uploads/2012/01/GenerateEquals0.png" alt="" width="433" height="236" /></a></p>
<p>2. Choose &#8220;Equality members&#8221; and setup the code generation:</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/GenerateEquals1.png" rel="lightbox[1053]"><img class="alignnone  wp-image-1055" title="GenerateEquals1" src="http://www.japf.fr/wp-content/uploads/2012/01/GenerateEquals1.png" alt="" width="378" height="378" /></a></p>
<p>And BOOOM ! You&#8217;re done:</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('p1053code6'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10536"><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
</pre></td><td class="code" id="p1053code6"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">struct</span> ServerItem
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> ServerItem<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> id, DateTime<span style="color: #008000;">?</span> added, <span style="color: #6666cc; font-weight: bold;">int</span> childCount<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">:</span> <span style="color: #0600FF; font-weight: bold;">this</span><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;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Id</span> <span style="color: #008000;">=</span> id<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Added</span> <span style="color: #008000;">=</span> added<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ChildCount</span> <span style="color: #008000;">=</span> childCount<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;">string</span> Id <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">private</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> DateTime<span style="color: #008000;">?</span> Added <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">private</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> ChildCount <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">private</span> set<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;">bool</span> Equals<span style="color: #008000;">&#40;</span>ServerItem other<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">return</span> Equals<span style="color: #008000;">&#40;</span>other<span style="color: #008000;">.</span><span style="color: #0000FF;">Id</span>, <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Id</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&amp;&amp;</span> other<span style="color: #008000;">.</span><span style="color: #0000FF;">Added</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Equals</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;">Added</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&amp;&amp;</span> other<span style="color: #008000;">.</span><span style="color: #0000FF;">ChildCount</span> <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ChildCount</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: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">bool</span> Equals<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> obj<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>ReferenceEquals<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">null</span>, obj<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;">return</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>obj<span style="color: #008000;">.</span><span style="color: #0000FF;">GetType</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">!=</span> <span style="color: #008000;">typeof</span><span style="color: #008000;">&#40;</span>ServerItem<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;">return</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">return</span> Equals<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>ServerItem<span style="color: #008000;">&#41;</span>obj<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: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">int</span> GetHashCode<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #008000;">unchecked</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> result <span style="color: #008000;">=</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;">Id</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">?</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Id</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetHashCode</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">:</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            result <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>result <span style="color: #008000;">*</span> <span style="color: #FF0000;">397</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">^</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;">Added</span><span style="color: #008000;">.</span><span style="color: #0000FF;">HasValue</span> <span style="color: #008000;">?</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Added</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetHashCode</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">:</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            result <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>result <span style="color: #008000;">*</span> <span style="color: #FF0000;">397</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;">ChildCount</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> result<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: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">bool</span> <span style="color: #0600FF; font-weight: bold;">operator</span> <span style="color: #008000;">==</span><span style="color: #008000;">&#40;</span>ServerItem left, ServerItem right<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">return</span> left<span style="color: #008000;">.</span><span style="color: #0000FF;">Equals</span><span style="color: #008000;">&#40;</span>right<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: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">bool</span> <span style="color: #0600FF; font-weight: bold;">operator</span> <span style="color: #008000;">!=</span><span style="color: #008000;">&#40;</span>ServerItem left, ServerItem right<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;">!</span>left<span style="color: #008000;">.</span><span style="color: #0000FF;">Equals</span><span style="color: #008000;">&#40;</span>right<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 code-generation features of ReSharper has been there for a long time&#8230; But because I just found out the power of them, I wanted to briefly showcased them in this post <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/2012/01/resharper-and-code-generation/feed/</wfw:commentRss>
		<slash:comments>2</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>Welcome 2012 and happy new year!</title>
		<link>http://www.japf.fr/2012/01/welcome-2012-and-happy-new-year/</link>
		<comments>http://www.japf.fr/2012/01/welcome-2012-and-happy-new-year/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 12:55:47 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Events]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=1021</guid>
		<description><![CDATA[The beginning of the year always seems the appropriate time to take a step back and see what happened in the last few months&#8230; So let&#8217;s take a deep breath&#8230; The last year has been a busy for me… At the beginning of February I had the chance to give a talk about Rx (Reactive [...]]]></description>
			<content:encoded><![CDATA[<p>The beginning of the year always seems the appropriate time to take a step back and see what happened in the last few months&#8230; So let&#8217;s take a deep breath&#8230;</p>
<p>The last year has been a busy for me… At the beginning of February I had the chance to give a talk about Rx (Reactive Extensions) in Paris for the Microsoft TechDays with my colleague Charlotte and ex-Microsoftee <a href="http://mitsufu.wordpress.com/">Mitsu Furuta</a>. It was my first talk in such an event and it was a very valuable and interesting experience.</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/techdays.jpg" rel="lightbox[1021]"><img class="alignnone  wp-image-1023" title="techdays" src="http://www.japf.fr/wp-content/uploads/2012/01/techdays.jpg" alt="" width="259" height="194" /></a></p>
<p>Few weeks after that, I went to the US for the very first time. I was in Redmond for a week for the annual MVP Summit. I had a dinner with the <a href="http://groups.google.com/group/wpf-disciples?pli=1">WPF Disciples</a> where I finally met in person some of the guys of the group. I also discovered the Microsoft campus in Redmond, had a dinner with members of the WPF team&#8230;</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/IMG_1205.jpg" rel="lightbox[1021]"><img class="alignnone size-medium wp-image-1022" title="IMG_1205" src="http://www.japf.fr/wp-content/uploads/2012/01/IMG_1205-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>In September I went to Anaheim (near Los Angeles) for //BUILD/. It was an amazing time. I&#8217;ve never seen so much enthusiast and it was truly amazing (maybe the Windows 8 slate distributed during the event is part of that!) It was also the occasion to meet new people.</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/WP_000356.jpg" rel="lightbox[1021]"><img class="alignnone size-medium wp-image-1024" title="WP_000356" src="http://www.japf.fr/wp-content/uploads/2012/01/WP_000356-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>In November, I went to Lyon for the MSDays as ATE (Ask The Expert) in order to discuss Windows 8 (and show the //BUILD/ slate):</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2012/01/WP_000387.jpg" rel="lightbox[1021]"><img class="alignnone size-medium wp-image-1025" title="WP_000387" src="http://www.japf.fr/wp-content/uploads/2012/01/WP_000387-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>Blog post activity has been also important and more varied (Windows Phone, Windows 8, WinRT…)</p>
<ul>
<li><a href="../2011/01/a-look-at-2010-and-perspectives-for-2011/">A look at 2010 and perspectives for 2011</a></li>
<li><a href="../2011/01/joining-the-wpf-disciples-task-force/">Joining the WPF Disciples task force !</a></li>
<li><a href="../2011/01/mvvm-framework-explorer-update-and-top-mvvm-frameworks/">MVVM Framework Explorer update and top MVVM Frameworks</a></li>
<li><a href="../2011/02/techdays-2011-rx-talk-in-paris/">TechDays 2011: Rx talk in Paris</a></li>
<li><a href="../2011/02/techdays-2011-rx-talk-slides-and-source-code/">TechDays 2011: Rx talk, slides and source code</a></li>
<li><a href="../2011/02/flying-to-seattle-for-the-mvp-summit-2011/">Flying to Seattle for the MVP Summit 2011</a></li>
<li><a href="../2011/03/visual-studio-2010-and-hw-acceleration-on-windows-xp/">Visual Studio 2010 and HW acceleration on Windows XP…</a></li>
<li><a href="../2011/03/wpf-databinding-trick-part-1/">WPF databinding trick (part 1)</a></li>
<li><a href="../2011/04/wpf-databinding-trick-part-2/">WPF databinding trick (part 2)</a></li>
<li><a href="../2011/04/mix11-windows-phone-7-news/">Mix11: Windows Phone 7 news</a></li>
<li><a href="../2011/04/mix11-silverlight-5-beta/">Mix11: Silverlight 5 beta</a></li>
<li><a href="../2011/04/when-enough-viewmodel-is-enough/">When enough ViewModel is enough</a></li>
<li><a href="../2011/07/mvp-client-app-dev-one-more-year/">MVP Client App Dev: one more year!</a></li>
<li><a href="../2011/09/build-starting-the-build-series/">BUILD: Starting the BUILD series!</a></li>
<li><a href="../2011/09/mvvm-framework-explorer-updated/">MVVM Framework explorer updated</a></li>
<li><a href="../2011/09/build-getting-ready/">BUILD: getting ready!</a></li>
<li><a href="../2011/09/build-h-12/">BUILD: H-12</a></li>
<li><a href="../2011/09/build-winrt-silverlight-wpf-xaml/">BUILD: WinRT, Silverlight, WPF, XAML</a></li>
<li><a href="../2011/09/running-windows-8-from-a-virtual-environment/">Running Windows 8 from a virtual environment</a></li>
<li><a href="../2011/10/property-change-notifications-when-using-sql-ce-on-windows-phone-7-1/">Property change notifications when using SQL CE on Windows Phone 7.1</a></li>
<li><a href="../2011/11/meet-me-during-the-microsoft-days-in-lyon-next-wednesday/">Meet me during the Microsoft Days in Lyon next Wednesday!</a></li>
<li><a href="../2011/11/track-memory-usage-of-your-windows-phone-7-1-app-in-real-time/">Track memory usage of your Windows Phone 7.1 app in real time</a></li>
</ul>
<p>In 2012, I hope to do more work with Windows Phone. As an introduction to that, I’ll be speaking at the Microsoft TechDays in February on the subject “Performance analysis and optimization of Silverlight Windows Phone app”. I’ll write a blog post about this session very soon.</p>
<p>Happy new year to all my readers, and thank you for reading this blog and sharing your feeling in the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2012/01/welcome-2012-and-happy-new-year/feed/</wfw:commentRss>
		<slash:comments>1</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('p1001code9'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10019"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p1001code9"><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('p1001code10'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p100110"><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="p1001code10"><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('p989code15'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98915"><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="p989code15"><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('p989code16'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98916"><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="p989code16"><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('p989code17'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98917"><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="p989code17"><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('p989code18'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98918"><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="p989code18"><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>Running Windows 8 from a virtual environment</title>
		<link>http://www.japf.fr/2011/09/running-windows-8-from-a-virtual-environment/</link>
		<comments>http://www.japf.fr/2011/09/running-windows-8-from-a-virtual-environment/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 05:50:57 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[windows8]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=981</guid>
		<description><![CDATA[In the last few days I had many questions about the &#8220;good&#8221; way to run Windows 8 developer preview from a Virtual Environment. It turns out the Windows engineering team wrote a blog post last friday about that. The popular options are the following: Functional: Hyper-V in Windows 8 Developer Preview Hyper-V in Windows Server [...]]]></description>
			<content:encoded><![CDATA[<p>In the last few days I had many questions about the &#8220;good&#8221; way to run Windows 8 developer preview from a Virtual Environment. It turns out the Windows engineering team wrote <a href="http://blogs.msdn.com/b/b8/archive/2011/09/16/running-windows-8-developer-preview-in-a-virtual-environment.aspx">a blog post</a> last friday about that.</p>
<p>The popular options are the following:</p>
<p><em>Functional:</em></p>
<ul>
<li>Hyper-V in Windows 8 Developer Preview</li>
<li>Hyper-V in Windows Server 2008 R2</li>
<li>VMware Workstation 8.0 for Windows</li>
<li>VirtualBox 4.1.2 for Windows</li>
</ul>
<p><em>Non-functional:</em></p>
<ul>
<li>Microsoft Virtual PC (all versions)</li>
<li>Microsoft Virtual Server (all versions)</li>
<li>Windows 7 XP Mode</li>
<li>VMWare Workstation 7.x or older</li>
</ul>
<p>If you&#8217;re running Windows 8 developer preview in a virtual environment you probably should also take a look at the <a href="http://www.winrumors.com/windows-8-tips-and-tricks-for-mousekeyboard-users/">Windows 8: Tips and Tricks for mouse/keyboard users</a> article on <a href="http://www.winrumors.com">WinRumors</a>.</p>
<p>Finally if like me you a bit disoriented by the lack of the classic Windows menu in the desktop mode, you should now that if you press the Windows key and start typing using your keyboard it will actually start filtering applications and show you those which match your search.</p>
<p>Enjoy your Windows 8 time !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2011/09/running-windows-8-from-a-virtual-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BUILD: WinRT, Silverlight, WPF, XAML</title>
		<link>http://www.japf.fr/2011/09/build-winrt-silverlight-wpf-xaml/</link>
		<comments>http://www.japf.fr/2011/09/build-winrt-silverlight-wpf-xaml/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 03:23:39 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Metro]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[metro]]></category>
		<category><![CDATA[windows8]]></category>
		<category><![CDATA[winrt]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=976</guid>
		<description><![CDATA[This blog post is part of my BUILD series. I&#8217;m having a very busy week here in Anaheim ! I&#8217;m meeting many new people and had the chance to enjoy the conference from the inside. I&#8217;m also playing with this new Windows 8 slate Microsoft gave us ! I&#8217;m not going to do a blog [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.japf.fr/wp-content/uploads/2011/09/build_logo.png" rel="lightbox[976]"><img title="build_logo" src="http://www.japf.fr/wp-content/uploads/2011/09/build_logo.png" alt="" width="132" height="47" /></a></p>
<p><em>This blog post is part of my <a href="http://build.japf.fr">BUILD series</a>.</em></p>
<p>I&#8217;m having a very busy week here in Anaheim ! I&#8217;m meeting many new people and had the chance to enjoy the conference from the inside. I&#8217;m also playing with this new Windows 8 slate Microsoft gave us ! I&#8217;m not going to do a blog post trying to summarize everything because there is just so much to say.I&#8217;m going to try to share my point of view on what I&#8217;ve seen here.</p>
<p><strong>Our new platform</strong></p>
<p><strong></strong>The original picture shown during the keynote to introduce the new platform was this one:</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/09/win8-platform-and-tools.jpg" rel="lightbox[976]"><img class="alignnone size-full wp-image-978" title="win8-platform-and-tools" src="http://www.japf.fr/wp-content/uploads/2011/09/win8-platform-and-tools.jpg" alt="" width="490" height="276" /></a></p>
<p>There has been a lot of confusion about that because of having XAML with C# in the Metro Style Apps without any reference to the CLR&#8230; <a href="http://dougseven.com/">Doug Steven</a> did a pretty great job (blog post is <a href="http://dougseven.com/2011/09/15/a-bad-picture-is-worth-a-thousand-long-discussions/">here</a>) by discussing with key people from the engineering team of Microsoft and creates this new more accurate picture:</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/09/win8-new-platform.png" rel="lightbox[976]"><img class="alignnone size-full wp-image-977" title="win8-new-platform" src="http://www.japf.fr/wp-content/uploads/2011/09/win8-new-platform.png" alt="" width="490" height="275" /></a></p>
<p>Here is a quick summary:</p>
<ul>
<li>there is only one CLR</li>
<li>.Net framework 4.5 is used in both Metro apps and Classic apps</li>
<li>it&#8217;s the same MSIL for Metro apps and Classic apps</li>
<li>in the Metro platform, we have a subset of the .Net framework (for example no OpenFileDialog&#8230;)</li>
</ul>
<p><strong>New opportunities</strong></p>
<p>Before //BUILD we had already many choices to choose our development environment. we now have even more:</p>
<ul>
<li>WPF and managed code for classic desktop apps</li>
<li>Silverlight in a web environment</li>
<li>Silverlight out of browser</li>
<li>WinRT + XAML for Metro apps</li>
<li>WinRT + HTML for Metro apps</li>
</ul>
<p>I personally think that Silverlight in a web browser has not a great future. Microsoft just announced for example that the immersive version of IE will not run any plugins (so no Silverlight in the Metro UI) and we &#8216;ll know Microsoft is pushing HTML5 very strongly.</p>
<p>For classic desktop apps we have 2 options: WPF and Silverlight. Each of them has advantages and the choice we&#8217;ll have to do will depend on our constraints (deployment, business needs, connectivity&#8230;). I think there is room for the 2 platforms there.</p>
<p>For the Metro UI, you can choose between XAML and HTML. Microsoft told us they will keep a good feature parity between the 2 options. If you choose XAML and managed code you&#8217;ll be able to leverage a subset of the .Net framework.</p>
<p>I think another important aspect is that Metro will be available on Windows 8 only. Even though this new version of the OS might have a fast deployment rate (thanks to the slates), in many companies I don&#8217;t think it will be that fast.This, plus the fact that some LOB apps will not benefit the Metro UI leaves a lot of work to do in the desktop applications world (where we have both WPF and SL)&#8230; For WPF, we now have a new version coming in .Net 4.5. You can check out the new stuff <a href="http://msdn.microsoft.com/en-us/library/bb613588(v=VS.110).aspx">here</a> in the documentation.</p>
<p>In my next blog post I&#8217;m going to try to go deeper in the new WinRT/XAML world and see how it looks like for us, WPF and Silverlight developers.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2011/09/build-winrt-silverlight-wpf-xaml/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>BUILD: H-12</title>
		<link>http://www.japf.fr/2011/09/build-h-12/</link>
		<comments>http://www.japf.fr/2011/09/build-h-12/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 04:21:24 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[build]]></category>

		<guid isPermaLink="false">http://www.japf.fr/?p=969</guid>
		<description><![CDATA[This blog post is part of my BUILD series. Just a quick update to share with you some pictures before the keynote starts (in about 12 hours now&#8230;). This morning I had the chance to be part of the UX workshop organized by www.billyhollis.com and it was very cool. Billy did a great job trying [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.japf.fr/wp-content/uploads/2011/09/build_logo.png" rel="lightbox[969]"><img class="alignnone size-full wp-image-930" title="build_logo" src="http://www.japf.fr/wp-content/uploads/2011/09/build_logo.png" alt="" width="132" height="47" /></a></p>
<p><em>This blog post is part of my <a href="http://build.japf.fr">BUILD series</a>.</em></p>
<p>Just a quick update to share with you some pictures before the keynote starts (in about 12 hours now&#8230;).</p>
<p>This morning I had the chance to be part of the UX workshop organized by <a href="www.billyhollis.com">www.billyhollis.com</a> and it was very cool. Billy did a great job trying to stimulate our right brain (developers used to be more left-brained)&#8230; He detailed various UI principles and showed a WPF application he worked on a couple of years ago (in 2008). We also had a nice tee-shirt:</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/09/WP_000322.jpg" rel="lightbox[969]"><img class="alignnone size-full wp-image-970" title="WP_000322" src="http://www.japf.fr/wp-content/uploads/2011/09/WP_000322.jpg" alt="" width="348" height="262" /></a></p>
<p>Here are some other pictures I took today:</p>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/09/WP_000329.jpg" rel="lightbox[969]"><img class="alignnone size-full wp-image-971" title="WP_000329" src="http://www.japf.fr/wp-content/uploads/2011/09/WP_000329.jpg" alt="" width="348" height="260" /></a></p>
<p><a href="http://www.japf.fr/wp-content/uploads/2011/09/WP_000304.jpg" rel="lightbox[969]"><img class="alignnone size-full wp-image-972" title="WP_000304" src="http://www.japf.fr/wp-content/uploads/2011/09/WP_000304.jpg" alt="" width="348" height="261" /></a></p>
<p>See you tomorrow ! Don&#8217;t forget that the keynote will be live-streamed at <a href="www.buildwindows.com">www.buildwindows.com</a></p>
<p>Keynote starts at 9:00 Pacific Time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japf.fr/2011/09/build-h-12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

