<?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>Anger Oriented Programming</title>
	<atom:link href="http://blogs.microsoft.co.il/jgold/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.microsoft.co.il/jgold</link>
	<description>Software development blog about .NET, Windows Phone,  WCF and Zen.</description>
	<lastBuildDate>Tue, 16 Dec 2014 18:26:11 +0000</lastBuildDate>
	<language>he-IL</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.8.6</generator>
	<item>
		<title>Passing Windows Phone Certification – The Back Button</title>
		<link>http://blogs.microsoft.co.il/jgold/2012/05/23/passing-windows-phone-certification-the-back-button/</link>
		<comments>http://blogs.microsoft.co.il/jgold/2012/05/23/passing-windows-phone-certification-the-back-button/#comments</comments>
		<pubDate>Wed, 23 May 2012 15:27:00 +0000</pubDate>
		<dc:creator><![CDATA[JosefGoldstein]]></dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Certification]]></category>
		<category><![CDATA[DEV]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[UX]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Windows Phone Certification]]></category>

		<guid isPermaLink="false">http://blogs.microsoft.co.il/?p=1100498</guid>
		<description><![CDATA[Tip #2: How not to break Windows Phone certification rule No. 5.2.4 – Use of Back Button. So this is a rather common one, mostly because developers don’t take the hardware keys into consideration when developing an application, or on the contrast use them incorrectly.&#160; Basically what it means is: Make sure the Back Button [&#8230;]]]></description>
				<content:encoded><![CDATA[<h4><font size="3" face="Calibri"><strong>Tip #2: How not to break </strong></font><a href="http://msdn.microsoft.com/en-us/library/hh184840%28v=vs.92%29"><font size="3" face="Calibri"><strong>Windows Phone certification rule No. 5.2.4</strong></font></a><font size="3" face="Calibri"><strong> – Use of Back Button.        </p>
<p></strong></font><font size="3" face="Calibri"><strong>       <br /></strong></font></h4>
<p><font size="3" face="Calibri"><font size="3" face="Calibri">So this is a rather common one, mostly because developers don’t take the hardware keys into consideration when developing an application, or on the contrast use them incorrectly.</font></font>&#160; </p>
<p><font size="3" face="Calibri">Basically what it means is: Make sure the Back Button does what it’s supposed to do: Navigate Back. No matter what your application does, no matter how many transitions occur, the back navigation needs to be fluid, logical and uniform with all other application on the platform.</font><font size="3" face="Calibri"> </font></p>
<p><font size="3" face="Calibri"></font></p>
<p>&#160;</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Windows Phonw Hardware Buttons" border="0" alt="Windows Phonw Hardware Buttons" src="http://blogs.microsoft.co.il/blogs/jgold/windows-phone-buttons_03816A69.png" width="332" height="89" /> </p>
<p>&#160;</p>
<p><font size="3" face="Calibri"></font></p>
<p><font size="3" face="Calibri"><u></u></font></p>
<p><font size="3" face="Calibri"><u></u></font></p>
<p><font size="3" face="Calibri"><u>Getting back to scratch:</u>       <br />At any point during the lifecycle of your application the user might press one of the phone’s three Hardware Buttons: The Start Button, The Search Button and <strong>The Back Button</strong>.       <br />Every device will have them as depicted in the <a title="Hardware Specifications for Windows Phone" href="http://msdn.microsoft.com/en-us/library/ff637514%28v=vs.92%29.aspx" target="_blank">Hardware Specifications</a> Microsoft has set for manufacturers.</font></p>
<p><font size="3" face="Calibri">This means that when contemplating <a title="Use Case on Wikipidia" href="http://en.wikipedia.org/wiki/Use_case" target="_blank">use cases</a> for your application, these three possible events should be at the top of the list.&#160; <br />It’s not as complex as it might sound, The Start and Search Buttons currently act quite the same on the developer’s side, by that I mean that you can not override their behavior (Rightfully for the Start Button, not so rightfully for the Search Button). So for these two you only need to handle the phone navigating away from your app, which for you means: <a title="Execution Model and Tombstoning in Windows Phone" href="http://msdn.microsoft.com/en-us/library/ff817008%28v=vs.92%29.aspx" target="_blank">Tombstoning</a>, but more on that on another time.</font></p>
<p><font size="3" face="Calibri">The Back Button on the other hand, that fella can take a bit of abuse.      <br />As I hinted before, the Back Button is the only hardware key out of the three that can have it’s behavior overridden.       <br />And that’s where you meet <strong>The Good, The Bad and The Ugly.</strong>       </p>
<p></font></p>
<p><font size="3" face="Calibri"><u></u></font></p>
<p><font size="3" face="Calibri"><u>The Good:        <br /></u>Overriding the Back Button is easy, it only takes 2 simple steps.       <br />&#160; <br />Step #1: On your application page register to <em>BackKeyPress</em> event.       <br />You can do that from code behind, or the way I prefer to do it, in XAML.</font></p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Registering to BackKeyPress in XAML" border="0" alt="Registering to BackKeyPress in XAML" src="http://blogs.microsoft.co.il/blogs/jgold/xamlbackbuttonevent_705017EF.png" width="549" height="224" /></p>
<p><font size="3" face="Calibri">Step #2: In code behind implement the said event handler.      <br />In a fashion similar to this:</font></p>
<blockquote>
<p><font color="#0000ff">private</font> <font color="#0000ff">void</font> PhoneApplicationPage_BackKeyPress(<font color="#0000ff">object</font> sender, <font color="#4f81bd">CancelEventArgs</font> e)       <br />{       <br />&#160;&#160; <font color="#9bbb59"></font><font color="#008000">// Override the back press, actually canceling it        <br /></font>&#160;&#160;&#160; e.Cancel = <font color="#0000ff">true</font>;</p>
<p>&#160;&#160; <font color="#008000">/*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; *        <br />&#160;&#160;&#160;&#160; *&#160; Things to do instead of navigating&#160; *         <br />&#160;&#160;&#160;&#160; *&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; */         <br /></font>}       </p>
</blockquote>
<p><font size="3" face="Calibri">We cancel the back navigation command and execute our own logic.      <br />Obviously implementing this event handler is purely optional, and <strong>should be avoided if not needed</strong>.       </p>
<p>A good example for where you should use it would be to control dialogs, popups and custom messages boxes. Which leads me to…       </p>
<p></font></p>
<p><font size="3" face="Calibri"><u>The Bad:</u>       </p>
<p>Let’s say your application page presents at one point or another some sort of Popup, Dialog, Context Menu, or any other type of partial window which lays on top of the page, and will stay there until the user interacts with it.       </p>
<p>According to <em>Certification rule 5.2.4.3 – Back Button: Context Menus and Dialogs</em> -If said control is presented on the page, the Back Button should close it instead of navigating back to the previous page.       <br />How good this is considering UX is arguable, but the rules are the rules. </font></p>
<p><font size="3" face="Calibri">The way to fix this would be creating an event handler, just as we saw before, and in it checking if we have our dialog control open. If it is, cancel the back navigation and close the dialog, if it isn’t leave the back navigation to do it’s thing.      <br />Translated into code, it will look like this:       <br /></font></p>
<blockquote>
<p><font color="#0000ff">private</font> <font color="#0000ff">void</font> PhoneApplicationPage_BackKeyPress(<font color="#0000ff">object</font> sender, <font color="#4f81bd">CancelEventArgs</font> e)       <br />{&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">if</font> (dialog.Visibility == <font color="#4f81bd">Visibility</font>.Visible)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br /><font color="#008000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Override the back press</font>       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.Cancel = <font color="#0000ff">true</font>;</p>
<p><font color="#008000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Close the dialog</font>       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dialog.Visibility = <font color="#4f81bd">Visibility</font>.Collapsed;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />} </p>
</blockquote>
<p> <font size="3" face="Calibri">   </p>
<p><u>The Ugly:        <br /></u>      <br />So now you know how to override the back button.       <br />This means you can use it to do what ever you like, right?       <br /><strong>Wrong!</strong></p>
<p> </font>  </p>
<p><font size="3" face="Calibri">To explain this, imagine the next scenario:      <br />You’re a Facebook user right? Of Course you are.&#160; <br />Now let’s say that one day the good developers at Facebook find a way to override the the browser’s navigation buttons (this by the way is very feasible using some rather simple Javascript).       <br />So from now on whenever you’re on Facebook, clicking on the Back browser button will open the chat window, and clicking on the Forward browser button will “Like” the last post you’ve watched.&#160;&#160; </p>
<p>How long do you think it will take before Mark Zuckerberg’s mail account will reach it’s storage limit after being flooded by hate-mail?       <br />And for a good reason, this makes for a very confusing, non intuitive, <a title="User Experience" href="http://blogs.microsoft.co.il/blogs/jgold/archive/tags/UX/default.aspx" target="_blank">user experience</a>.       </p>
<p>The same happens when the Back Button on the phone does something that isn’t some sort of navigating back.       <br />As I said on my first post about <a title="Windows Phone Certification" href="http://blogs.microsoft.co.il/blogs/jgold/archive/2011/10/31/Passing-Windows-Phone-Certification-and-Staying-Alive.aspx" target="_blank">Windows Phone Certification</a>, most of the rules were made to maintain UX across the board, and this also means that all hardware buttons should more or less act the same on all applications.       </p>
<p>Or to sum it up in Microsoft’s words:       <br /><em>“To maintain a consistent user experience, the Back button must <strong>only</strong> be used for backwards navigation in the application. ”</em></font></p>
<p><em><font size="3" face="Calibri"></font></em></p>
<p><font size="3" face="Calibri"></font></p>
<p><font size="3" face="Calibri">That’s it for now.      <br />More <a title="More Windows Phone Certification Tips" href="http://blogs.microsoft.co.il/blogs/jgold/archive/tags/Windows+Phone+Certification/default.aspx" target="_blank">Windows Phone Certification Tips</a> coming. Please tell me in the comment section about certification rejections you’ve got so I’ll know what you want me to write about next.       </p>
<p>Josef.</font><font size="3" face="Calibri">&#160;&#160;&#160; </font></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.microsoft.co.il/jgold/2012/05/23/passing-windows-phone-certification-the-back-button/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Designing Windows Phone Applications With Photoshop</title>
		<link>http://blogs.microsoft.co.il/jgold/2012/04/17/designing-windows-phone-applications-with-photoshop/</link>
		<comments>http://blogs.microsoft.co.il/jgold/2012/04/17/designing-windows-phone-applications-with-photoshop/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 11:40:00 +0000</pubDate>
		<dc:creator><![CDATA[JosefGoldstein]]></dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[DEV]]></category>
		<category><![CDATA[Expression]]></category>
		<category><![CDATA[Expression Blend]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[TECH]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[UX]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[Windows Phone 7]]></category>

		<guid isPermaLink="false">http://blogs.microsoft.co.il/?p=1067214</guid>
		<description><![CDATA[AKA: How to design your own Windows Phone Application UI, using Photoshop, Expression Blend and a little touch of Magic. When it comes to being an indie-app-developer, you usually find yourself being the Jack of All Trades. You are the developer, designer, tester and marketer. This really isn’t easy, besides being good in each of [&#8230;]]]></description>
				<content:encoded><![CDATA[<h4 align="left"><font face="Arial">AKA: How to design your own Windows Phone Application UI, using Photoshop, Expression Blend and a little touch of Magic.</font></h4>
<p align="left"><font face="Arial"></font></p>
<p><font size="3"><font face="Calibri"></font></font></p>
<p><font size="3"><font face="Calibri"><a href="http://blogs.microsoft.co.il/blogs/jgold/photoshop-loves-windows-phone_40EAE905.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Photoshop Loves Windows Phone" border="0" alt="Photoshop Loves Windows Phone" src="http://blogs.microsoft.co.il/blogs/jgold/photoshop-loves-windows-phone_thumb_2AC431D9.png" width="363" height="290" /></a></font> </font></p>
<p align="left"><font size="3" face="Calibri">When it comes to being an indie-app-developer, you usually find yourself being the Jack of All Trades. You are the developer, designer, tester and marketer.      <br />This really isn’t easy, besides being good in each of these fields, </font><a title="What happens when you let developers create UI" href="http://www.codinghorror.com/blog/2006/11/this-is-what-happens-when-you-let-developers-create-ui.html" target="_blank"><font size="3" face="Calibri">and usually you are not</font></a><font size="3" face="Calibri">, you need to familiarize yourself with various tools, each for it’s own role in creating the application. </font></p>
<p><font size="3"></font></p>
<p align="left"><font size="3"><font face="Calibri">The most confusing of all to the common developer is usually designing the application UI.        <br />“<em>If it works well, why the heck does it also need to look good!?”</em> Is a common thing to be heard from frustrated software developers, when given a UI design assignment.         </p>
<p>But here is the thing, when it comes to Applications built for a mobile platform, <strong>Great UI is key for the success of an application</strong>.         <br />It doesn’t matter how amazingly fast your app algorithms run, if they don’t come in a pretty package, <strong>No one will download it!</strong></font></font><font size="3" face="Calibri"></font></p>
<p> <font size="3" face="Calibri">The good news are that together with <a title="Visual Studio 2010 Express for Windows Phone" href="http://www.microsoft.com/visualstudio/en-us/products/2010-editions/windows-phone-developer-tools" target="_blank">Visual Studio</a> and <a title="Expression Blend 4 for Windows Phone" href="www.microsoft.com/expression/windowsphone/" target="_blank">Expression Blend</a>, Microsoft provides you with a fairly good suite for easily creating your very own beautiful Windows Phone Applications. And best of all, these tools play beautifully well with Adobe <a title="Photoshop CS5 Trial" href="http://www.adobe.com/cfusion/tdrc/index.cfm?product=photoshop" target="_blank">Photoshop</a> and <a title="Illustrator CS5 Trial" href="http://www.adobe.com/cfusion/tdrc/index.cfm?product=illustrator" target="_blank">Illustrator</a>.     <br />No, they will not magically turn you into an amazing UI Designer, I’ll give you that, but they will make your life much easier.</font> <font size="3" face="Calibri">   </p>
<p align="left">&#160;</p>
<p>   <font size="3" face="Calibri">So lately I have been working on a small project I call “Vintage Booth”.      <br />Basically it’s a very simple Windows Phone Application that will enable you to take vintage looking pictures and share them with your friends.       <br />Yes I know, it’s an amazingly original idea, patent pending.</font></font>   </p>
<p align="left"><font size="3" face="Calibri">The thing is, I’ve started this project mostly as an experiment in application UI design. I wanted to see if I could create exceptionally great application design, while not necessarily sticking to the <a title="UX guidelines for Metro style app development" href="http://blendinsider.com/technical/ux-guidelines-for-metro-style-app-development-2011-10-21/" target="_blank">Metro UX Concepts</a>, and most importantly, do it all by myself.</font>     <br /><font size="3" face="Calibri">This is the story of how I did it.      <br /></font><font size="3" face="Calibri">&#160; <br /></font></p>
<h2><font size="3" face="Calibri"></font></h2>
<p> <font size="3" face="Calibri">   </p>
<h3><u>Creating the page design using Adobe Photoshop</u>       <br /></h3>
<h2 align="left"></h2>
<p align="left">The first step was creating the Application Pages (4 of them ) using Adobe Photoshop.      </p>
<p>The native resolution of a Silverlight Windows Phone Application Page is 480&#215;800, so I started by creating a new canvas of that size and worked my way from there on my Main Menu Page.       <br />Ending up with this design:</p>
<p> </font>  </p>
<p align="left"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Designing the Main Menu Page in Photoshop" border="0" alt="Designing the Main Menu Page in Photoshop" src="http://blogs.microsoft.co.il/blogs/jgold/276482746_65E7E7D7.png" width="452" height="304" /></p>
<p>&#160;</p>
<p>Several things you should consider when designing the page:    </p>
<p>1) Use folders to group layers that relate to the same control or part of the screen.     <br />&#160;&#160;&#160; As you will later see, these folders will turn into <a title="Canvas Class on MSDN" href="http://msdn.microsoft.com/en-us/library/system.windows.controls.canvas%28v=vs.95%29.aspx" target="_blank">Canvas Controls</a> in XAML.     </p>
<p>2) Prefer using Vector Graphics and Text Layers as oppose to just using plain images.     <br />&#160;&#160;&#160; They will turn into Paths and Labels later, and will enable you resizing and manipulation     <br />&#160;&#160;&#160; without losing quality. </p>
<p>3) Some layer blending modes and layer styles are not supported in Expression Blend.    <br />&#160;&#160;&#160; You will be notified upon importing as you will later see, but you might need to merge     <br />&#160;&#160;&#160; and flatten some of these layers to maintain the same look.</p>
<p>4) If you are using 3rd party fonts, make sure you have the rights to use them.    <br />&#160;&#160;&#160; The same goes for all source images you are using.</p>
<p>&#160;</p>
<p>&#160;</p>
<h3><font face="Calibri"></font></h3>
<h3><u><font face="Calibri">Importing The Design To Expression Blend</font></u></h3>
<p><font size="3" face="Calibri">Next I opened my already existing project that I’ve created in Visual Studio. If you don’t have one you can simply create a new project from within Expression Blend.</font></p>
<p><font size="3" face="Calibri">Next I went ahead and opened my MainPage.xaml, removed all existing controls in it, and proceeded to import my PSD file.      <br />In the menu simply select File –&gt; Import Adobe Photoshop File…</font></p>
<p><a href="http://blogs.microsoft.co.il/blogs/jgold/import-photoshop-file-menu_3A637B43.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Expression Blend Menu For Importing Photoshop File" border="0" alt="Expression Blend Menu For Importing Photoshop File" src="http://blogs.microsoft.co.il/blogs/jgold/import-photoshop-file-menu_thumb_38B2AF6F.png" width="213" height="240" /></a></p>
<p><font size="3" face="Calibri">Next the importing window will open up displaying all the layers in the PSD file.</font></p>
<p><a href="http://blogs.microsoft.co.il/blogs/jgold/psd-importing-window_616E14B8.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Photoshop Importing Window" border="0" alt="Photoshop Importing Window" src="http://blogs.microsoft.co.il/blogs/jgold/psd-importing-window_thumb_5DFC5743.png" width="518" height="296" /></a>&#160; <font size="1">click the image to enlarge.</font></p>
<p><font size="3" face="Calibri">Here there are several things you need to notice.      <br />Each layer has a check box enabling you to add or remove it from the list of layers that will be imported.       </p>
<p>In case you wish to merge several layers you can select them and use the “Merge layers” button. It is preferred to merge layers that have no reason being separated, for example in this design, the layer of the album and the layer of the images over the album.       <br />The reason for this is that each layer will turn into an element in the Visual Tree, and this can dramatically affect performance. So basically the less layers and effects you eventually import the better.</font></p>
<p><font size="3" face="Calibri">As I said before, not all the features in Photoshop are supported in Blend.      <br />You will be notified for this by an exclamation mark icon near the layer or folder. When hovered over, a tooltip will present the unsupported feature.</font></p>
<p><a href="http://blogs.microsoft.co.il/blogs/jgold/unsupported-message_732A5CEB.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Unsupported Supported Feature Message" border="0" alt="Unsupported Supported Feature Message" src="http://blogs.microsoft.co.il/blogs/jgold/unsupported-message_thumb_4634FA10.png" width="375" height="149" /></a><font size="3" face="Calibri"></font></p>
<p><font size="3" face="Calibri">For now you can handle this and still maintain the looks by choosing to import the layer as a flattened bitmap.</font></p>
<p><font size="3" face="Calibri">Eventually I ended up like this:</font></p>
<p><a href="http://blogs.microsoft.co.il/blogs/jgold/vintage-booth-imported-in-blend_3CF8BECF.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="vintage-booth-imported-in-blend" border="0" alt="vintage-booth-imported-in-blend" src="http://blogs.microsoft.co.il/blogs/jgold/vintage-booth-imported-in-blend_thumb_5935DB22.png" width="522" height="361" /></a><font size="1">&#160; click the image to enlarge.</font></p>
<p><font size="3" face="Calibri">As you can see, all my layers have translated into images and all the folders into canvases.      <br />Should I have imported the text layers as text and not as a flattened bitmap, I would have been able to see the text as an editable label, basically enabling me to change it in runtime.</font></p>
<p><font size="3" face="Calibri">&#160;</font></p>
<p><font size="3" face="Calibri"></font></p>
<h3><u><font face="Calibri"></font></u></h3>
<h3><u><font face="Calibri">Making The Design Interactive</font></u></h3>
<p><font size="3" face="Calibri">So now you have your design and you can display it as a pretty image on the phone. <strong>Time to make it Interactive</strong>.</font></p>
<p><font size="3" face="Calibri">This can mean various things, depending on your application.      <br />In my case I needed to make the Menu Items reactive, and this meant two things: Converting them into buttons and adding animations.</font></p>
<p><font size="3" face="Calibri">You can convert images into buttons in several ways. You can create an <a title="How To Create an Image Button Control" href="http://www.silvergeek.net/windows-phone-7/imagebutton-control-for-win-phone-7/" target="_blank">Image Button Control</a> and replace the image that was created with it, while maintaining all properties. You can catch the touch events from the image control itself, or do the lazy, yet affective, thing that I did and simply place an invisible button on top of the image. </font></p>
<p><font size="3" face="Calibri">Next I added the click animations. I won’t go into details on <a title="Animation Using Expression Blend: How to create an animation on Channle 9" href="http://channel9.msdn.com/Blogs/jennmar/Animation-Using-Expression-Blend-Part-1-How-to-create-an-animation" target="_blank">How to create animations using Expression Blend</a>, you can check out the link for that. But all I did was simply creating a scale change animation so that the images will create the feeling of being pressed, and attached that to the button press event.       <br />Obviously you can do much more complex stuff, do cool animations for when the page loads, animations that run continuously in the background making it dynamic, whatever you wish.</font></p>
<p><font size="3" face="Calibri">Eventually what you will end up with is a fully functioning interactive design, that mostly does nothing. You can “Test” your design by pressing F5 to run the project.</font></p>
<p><font size="3" face="Calibri"></font></p>
<p><font size="3"></font></p>
<h3><u><font face="Calibri"></font></u></h3>
<h3><u><font face="Calibri">Building the Application Using Visual Studio</font></u></h3>
<p><font size="3" face="Calibri">Now came the inevitable part of actually creating the application.      <br />After saving what I created in Blend I opened the Solution in Visual Studio.       <br />At any time you can go back to Expression Blend and change the design while developing, just make sure you save your changes.</font>&#160; </p>
<p>&#160;</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Vintage Booth in Visual Studio" border="0" alt="Vintage Booth in Visual Studio" src="http://blogs.microsoft.co.il/blogs/jgold/vintage-booth-in-visual-studio_317F392B.png" width="510" height="327" /></p>
<p><font size="3" face="Calibri"></font></p>
<p><font size="3" face="Calibri"></font></p>
<p><font size="3" face="Calibri">I really can not stress enough the <strong>Save</strong> part.       <br />Visual Studio and Expression Blend play beautifully together, even with source control in the middle. But if you don’t save your changes in one of them, they will not update in the other.       <br />Not paying attention to this can cause you to override unsaved changes, and in the process lose an hour worth of work, leading to <strong><font color="#800000">RAGE AND DESTRUCTION</font></strong>!       <br /></font><font size="3" face="Calibri">So learn from my mistakes and save often.</font></p>
<p><font size="3" face="Calibri">Besides that, this is the point where you add your code or link the pages to existing code you already have.      <br />As you can see, if you work with other people you can actually have the code written simultaneously to creating the design, integrating the two in the end.       <br />For doing it properly you can look at more advanced Design Patterns such as <a title="MVVM Deep Dive from MIX11" href="http://channel9.msdn.com/Events/MIX/MIX11/OPN03" target="_blank">MVVM</a>.</font></p>
<p><font size="3" face="Calibri"></font></p>
<p><font size="3" face="Calibri"></font></p>
<p><font size="3" face="Calibri">That’s it for now.      <br />For questions, pointers and incoherent jibber-jabber,       <br />please leave a message in the comment section bellow.       </p>
<p>And until next time, don’t forget:       <br /><em><strong>Beauty is only skin deep, but ugly goes clear to the bone .</strong></em></font></p>
<p><font size="3" face="Calibri">Josef.&#160;&#160; </font></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.microsoft.co.il/jgold/2012/04/17/designing-windows-phone-applications-with-photoshop/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Code Tips That Will Save Your Life #2 – Part I</title>
		<link>http://blogs.microsoft.co.il/jgold/2012/04/05/code-tips-that-will-save-your-life-2-part-i/</link>
		<comments>http://blogs.microsoft.co.il/jgold/2012/04/05/code-tips-that-will-save-your-life-2-part-i/#respond</comments>
		<pubDate>Thu, 05 Apr 2012 21:06:00 +0000</pubDate>
		<dc:creator><![CDATA[JosefGoldstein]]></dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Best Practice]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Tips]]></category>
		<category><![CDATA[DEV]]></category>

		<guid isPermaLink="false">http://blogs.microsoft.co.il/?p=1051569</guid>
		<description><![CDATA[Tip #2: Proper Exception Handling in .Net and in General. ”Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.” You can never know when this phrase will turn into horrible reality, so you’d better be prepared! Tip #2: Proper Exception Handling – Part [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3 align="left">Tip #2: Proper Exception Handling in .Net and in General.</h3>
<p>  </p>
<h5 align="center"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="I like to dissect programmers. Did you know I&#39;m utterly insane?" border="0" alt="I like to dissect programmers. Did you know I&#39;m utterly insane?" src="http://blogs.microsoft.co.il/blogs/jgold/Psycho_51888AAA.png" width="478" height="290" />     </p>
<p>”<b><i>Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.</i></b>”     <br /></h5>
<p align="left"><font size="3" face="Calibri">You can never know when this phrase will turn into horrible reality, so you’d better be prepared! </font></p>
<h2 align="left"><u><font style="font-weight: normal">       <br />Tip #2: Proper Exception Handling – Part 1</font></u></h2>
<p align="left"><font size="3" face="Calibri">This time on “Code Tips That Will Save Your Life” – <strong>Exceptions</strong>.       <br />We all know them and sadly we all have to deal with them, but are you doing it right? </font></p>
<p align="left"><font size="3"><font face="Calibri">To most it seems like a very straightforward thing – <font color="#0000ff">Try</font>, <font color="#0000ff">Catch</font> maybe<font color="#0000ff"> Finally</font>, that’s it.&#160; But code with incorrectly written Exception handling can be frustrating to maintain and hard to debug on a good day, but downright dangerous on a bad one.&#160; <br />&#160;&#160; <br />On this two part post I will share 8 Tips that will make your code amazingly easier to maintain, not to mention log and debug, and might even make it more stable.         </p>
<p></font>      <br /></font></p>
<h3 align="left"><u><font face="Calibri">1. Getting Up to Scratch</font> </u><u>     <br /></u><font style="font-weight: normal"><font style="font-weight: bold"></font></font></h3>
<p align="left"><font size="3" face="Calibri">As I already said on a previous post about </font><a title="5 Ways Improve Your Windows Phone 7 Application Stability" href="http://blogs.microsoft.co.il/blogs/jgold/archive/2011/09/18/5-Ways-Improve-Your-Windows-Phone-7-Application-Stability.aspx" target="_blank"><font size="3" face="Calibri">Application Stability</font></a><font size="3"><font face="Calibri">:        <br /><font style="font-weight: bold">“<em>Most Software Developers Are Lazy</em>”</font></font></font></p>
<p align="left"><font size="3" face="Calibri">I still stand behind this phrase, which is the only reason I’m not skipping this tip. So lets just make sure we are all on the same page here.      </p>
<p>Think about a piece of code you wrote lately, an algorithm, a method or a class.       <br />Now look at this snippet:       <br /></font></p>
<blockquote>
<p align="left"><font color="#0000ff">try</font>       <br />{&#160; <br />&#160;&#160; <font color="#00ff00">&#160;</font><font color="#008000">&#160;&#160; // Do amazing things        <br /></font>}       <br /><font color="#0000ff">catch</font>       <br />{&#160; <br /><font color="#008000">&#160;&#160;&#160;&#160;&#160;&#160; // Things didn't go as planned, time for plan B</font>       <br />}       <br /><font color="#0000ff">finally</font>       <br />{       <br /><font color="#00ff00"></font><font color="#008000"></font><font color="#008000">&#160;&#160;&#160;&#160;&#160;&#160; // Release resources and other awesome stuff</font>       <br />}</p>
</blockquote>
<p align="left"><font size="3" face="Calibri">Does your code follow this pattern?&#160; <br /></font><font style="font-weight: normal"><font style="font-weight: normal"><font size="3"><font face="Calibri">If your answer was yes, than kudos, +2 Points.            <br />If your answer was no.. well you better have a good reason for it.             </p>
<p>There are very few cases in which you would <strong>not</strong> want to catch rising exceptions.             <br />Even if you don’t really have anything to do with the exception at that place in the application flow, it’s usually good practice to catch it for logging purposes, resource management and for enriching it with information about the cause of the exception.             </p>
<p>Obviously as with any rule, there are exceptions (pun not intended).             <br />If there really is nothing to log, and no information to add, there is no reason to catch an exception for the sole purpose of throwing it again. But make sure that is the case.             </p>
<p>What ever you do, the most important rule for you to remember is:             <br /></font><font face="Calibri"><strong>Never, <font size="5">ever</font> swallow Exceptions without doing anything!               </p>
<p></strong>Bubble them, write to log, do anything.             <br />But make sure your <font color="#0000ff">catch</font> clause is not empty, or someday, some poor sap that will need to maintain your code will have a very, <strong>very</strong> bad day.</font></font></font></font></p>
<p align="left"><font size="3" face="Calibri"></font></p>
<p align="left"><font face="Calibri"></font></p>
<p align="left"><font face="Calibri"><font size="3"></font><font style="font-weight: normal"><font style="font-weight: normal"></font></font></font></p>
<h3 align="left"><u><font face="Calibri">2. Being Specific With Exceptions</font></u></h3>
<p align="left"><font size="3" face="Calibri">Let’s put exceptions aside for a second.      </p>
<p>Imagine yourself at the office. You are working on that very very important project your boss expected you to finish yesterday.       </p>
<p>When suddenly your IDE crashes, leaving you with the following message:</font></p>
<p align="left"><u><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="" border="0" alt="" src="http://blogs.microsoft.co.il/blogs/jgold/Catastrophic_failure_small_65C431CD.png" width="240" height="115" /></u></p>
<p align="left"><font size="3" face="Calibri">More or less, you have nothing to grab on to. You have no idea what went wrong. More important, you have no idea how to recover all your lost work.      <br />You are left with nothing to do but contemplate your unplanned sudden career change.       </p>
<p>Now with that in mind, imagine yourself using or maintaining someone else's code, or maybe even code you wrote a long time ago.       <br />Then while Debugging it you get this:       <br /></font></p>
<p align="left"><font size="3"><a href="http://blogs.microsoft.co.il/blogs/jgold/non-specific-excpetion_2ED34AE1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="" border="0" alt="" src="http://blogs.microsoft.co.il/blogs/jgold/non-specific-excpetion_thumb_4A482717.png" width="403" height="214" /></a></font></p>
<p align="left"><font size="3"><font face="Calibri">The exception’s type is </font><a title="System.Exception on MSDN" href="http://msdn.microsoft.com/en-us/library/system.exception.aspx" target="_blank"><font color="#4bacc6" face="Calibri">System.Exception</font></a><font face="Calibri">, the exception message is “An error occurred”. No inner-exception, no relevant stack-trace.        </p>
<p>What now?         <br />If you are lucky you have the source code or PDB files, so you can spend anything between 15 minutes to several days debugging for an answer.         <br />If you are unlucky, and you don’t have a way to debug that code.. well good luck guessing the reason.</font></font></p>
<p align="left"><font size="3" face="Calibri">When writing exception handling you should always have this example in mind. You need to make sure the exceptions your code throws can be easily understood, and this is done by <strong>being specific</strong>.       </p>
<p>Being specific means two things:       </p>
<p>1. Always make sure the exception message is clear.&#160; <br />If you can predict the reason for an exception in the code, make sure the exception you throw includes that information, and even a suggestion on how to fix it.       <br />For example: If a specific parameter you received for a method is null, make sure you specify the exact parameter that was sent as null, don’t just throw a “Null reference exception”.</font></p>
<p align="left"><font size="3"><font face="Calibri">2. Use the correct type of exceptions, and use custom exceptions if needed.        <br />Exceptions come in many flavors: </font><a title="NullRefrenceException on MSDN" href="http://msdn.microsoft.com/en-us/library/system.nullreferenceexception.aspx" target="_blank"><font color="#4bacc6" face="Calibri">NullRefrenceException</font></a><font face="Calibri">, </font><a title="InvalidOperationException on MSDN" href="http://msdn.microsoft.com/en-us/library/system.invalidoperationexception.aspx" target="_blank"><font color="#4bacc6" face="Calibri">InvalidOperationException</font></a><font face="Calibri">, </font><a title="IOException on MSDN" href="http://msdn.microsoft.com/en-us/library/system.io.ioexception.aspx" target="_blank"><font color="#4bacc6" face="Calibri">IOException</font></a><font face="Calibri">.. and the list goes on.        <br />Usually you will find one that is relevant for you, or at least one you can derive from. But please use the basic </font><a title="System.Exception on MSDN" href="http://msdn.microsoft.com/en-us/library/system.exception.aspx" target="_blank"><font color="#4bacc6" face="Calibri">System.Exception</font></a><font face="Calibri"> only as a last resort.        <br /></font></font></p>
<p align="left"><font size="3">     <br /><font face="Calibri">On the flip side, you should also separate different exception types when catching exceptions, using several <font color="#0000ff">catch</font> clauses. Separating exceptions by type will enable you handle different exceptions differently and log them appropriately.</font></font></p>
<p align="left"><font size="3" face="Calibri">For example:</font></p>
<blockquote>
<p align="left"><font color="#0000ff">try</font>       <br />{       <br />&#160;&#160;&#160; RunLogicOfGreatImportance(argument);       <br />}       <br /><font color="#0000ff">catch</font> (<font color="#4bacc6">TimeoutException</font> timeoutExcpetion)       <br />{       <br /><font color="#008000">&#160;&#160;&#160; // Action timed out, perform retry policy</font>       <br />}       <br /><font color="#0000ff">catch</font> (<font color="#4bacc6">ArgumentException</font> argException)       <br />{       <br />&#160;&#160; <font color="#008000">// Argument sent was invalid, prompt the argument creator</font>       <br />}       <br /><font color="#008000">/* etc. */</font>       <br /><font color="#0000ff">catch</font> (<font color="#4bacc6">Exception</font> ex)       <br />{       <br />&#160;&#160;&#160; <font color="#008000">// Something else that I didn't expect went wrong, log and handle</font>       <br />}       </p>
<p align="left">&#160;</p>
</blockquote>
<p align="left"><font size="3"><font face="Calibri">As you can see it’s always important to finally catch </font><a title="System.Exception on MSDN" href="http://msdn.microsoft.com/en-us/library/system.exception.aspx" target="_blank"><font color="#4bacc6" face="Calibri">System.Exception</font></a><font face="Calibri">. This is in case an exception of a type you didn’t expect was thrown.        </p>
<p><u>P.S:</u> I heard some people talk about performance implications of using multiple catch blocks. That’s simply wrong and in no way an excuse to skip this good practice. For more information check out this </font><a title="Speed Test: Try / Catch Block" href="http://www.blackwasp.co.uk/SpeedTestTryCatch.aspx" target="_blank"><font face="Calibri">Benchmark on try/catch Performance</font></a><font face="Calibri">.&#160;&#160; </font></font></p>
<p align="left"><font size="3">     <br /><font face="Calibri"></font></font></p>
<p> <font size="3"></font><font size="3"></font>  </p>
<h3 align="left"><u><font face="Calibri">3. Custom Exceptions</font></u></h3>
<p align="left"><font face="Calibri"><font size="3">O.K so here is the deal.        <br />Sometimes the exceptions that are part of the .Net framework are not specific enough, or not relevant to the type of exceptions you need to throw from your code.         </p>
<p>This is where the concept of <strong>Custom Exceptions</strong> comes into play.         <br />Basically what it means is that you create your own Exception types by deriving from the exception types that are already in the framework.         </p>
<p>The simplest way of doing this is using the exception snippet.         <br />Simply click CTRL + Space and start writing the word “Exception”</font>&#160;</font></p>
<p align="left"><font face="Calibri"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Costume Exception Snippet for C# on Visual Studio" border="0" alt="Costume Exception Snippet for C# on Visual Studio" src="http://blogs.microsoft.co.il/blogs/jgold/costume-exception-snippet_0B81B317.png" width="359" height="162" /></font></p>
<p align="left"><font size="3"><font face="Calibri">Select Exception from the list and press TAB twice.        <br />What you will get is this lovely snippet of code:</font>       <br /></font></p>
<blockquote>
<p align="left">[<font color="#4bacc6">Serializable</font>]       <br /><font color="#0000ff">public class</font> <font color="#4bacc6"><font style="background-color: #cccccc">My</font>Exception</font> : <font style="background-color: #cccccc" color="#4bacc6">Exception</font>       <br />{       <br />&#160;&#160;&#160; <font color="#0000ff">public</font> MyException() { }       <br />&#160;&#160;&#160; <font color="#0000ff">public</font> MyException(<font color="#0000ff">string</font> message) : <font color="#0000ff">base</font>(message) { }       <br />&#160;&#160;&#160; <font color="#0000ff">public</font> MyException(<font color="#0000ff">string</font> message, <font color="#4bacc6">Exception</font> inner) : <font color="#0000ff">base</font>(message, inner) { }       <br />&#160;&#160;&#160; <font color="#0000ff">protected</font> MyException(       <br />&#160;&#160;&#160;&#160;&#160; System.Runtime.Serialization.<font color="#4bacc6">SerializationInfo</font> info,       <br />&#160;&#160;&#160;&#160;&#160; System.Runtime.Serialization.<font color="#4bacc6">StreamingContext</font> context)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; : base(info, context) { }       <br />}       </p>
</blockquote>
<p align="left"><font size="3"></font></p>
<p align="left"><font size="3"><font face="Calibri">The snippet basicaly lets you select the type name prefix (leaving the word “Exception” at the end as a standard) and the Exception type it derives from (</font><a title="System.Exception on MSDN" href="http://msdn.microsoft.com/en-us/library/system.exception.aspx" target="_blank"><font color="#4bacc6" face="Calibri">System.Exception</font></a><font face="Calibri"> the being default).        </p>
<p>Now you can add whatever you want to this class.         <br />Usually it’s good practice to add properties with more information about the exception reason, and maybe a GUID or some other type of ID for a log record regarding the exception.</font></font></p>
<p align="left"><font size="3"><font face="Calibri">To the question of “What exception type should I derive from?” there are two possible approaches:        </p>
<p><u>Approach #1</u>: Derive from the exception type that most closely matches the one you wish to create. Basically what this means is taking existing framework exceptions and making them more specific.         </p>
<p>For example, you are writing a piece of code which needs to read a given configuration file and load it. In case the given file does not exist you want to raise an exception more specific than </font><a title="System.IO.FileNotFoundException on MSDN" href="http://msdn.microsoft.com/en-us/library/system.io.filenotfoundexception.aspx" target="_blank"><font color="#4bacc6" face="Calibri">FileNotFoundException</font></a><font face="Calibri">, so you derive from it and create your own exception type :&#160; <font color="#4bacc6">ConfigFileNotFoundException</font>.         </p>
<p>The advantage here is that even if the person using your code doesn’t know that it throws your custom exception, he will still catch it if handling the derived types.</font></font></p>
<p align="left"><font size="3">     <br /></font><font size="3"><font face="Calibri"><u>Approach #2</u>: Make one main exception type for your system/application or for the current application module (for larger projects) and have it derive from<font color="#000000"> System.Exception</font> (</font><a title="ApplicationException Considered Deprecated" href="http://blogs.msdn.com/b/kcwalina/archive/2006/06/23/644822.aspx" target="_blank"><font face="Calibri">Not from ApplicationException!</font></a><font face="Calibri">).        <br />Now have every new Custom Exception you create derive from that type.</font></font></p>
<p align="left"><font size="3" face="Calibri">The advantage here, is that unlike the previous approach you have all your custom exceptions deriving from one application wide custom exception type, and you can even manage them all under the same namespace.</font></p>
<p align="left"><font size="3" face="Calibri">It’s a matter of preference, I personally prefer the second approach. When working on large projects especially ones involving several developers it’s a good standard to maintain among each other. It’s also generally a good method to separate internally, exceptions that were risen by the CLR from ones that where risen by the application code. This is good both for maintenance and logging.      <br /></font></p>
<blockquote>
<p align="left"><font face="Calibri"></font></p>
</blockquote>
<h3 align="left"><u><font face="Calibri">4. Correctly Bubbling Exceptions</font></u></h3>
<p align="left"><font size="3" face="Calibri">Here is a little test.      <br />Read the following 4 lines of code performing exception bubbling, that&#160; you would usually find inside a <font color="#0000ff">catch</font> block, and see if you can spot the differences <font size="2">(for the sake of this test “ex” is the exception instance caught)</font>:</font></p>
<ol>
<li>
<div align="left"><font color="#0000ff">throw</font>;         </div>
</li>
<li>
<div align="left"><font color="#0000ff">throw</font> ex;         </div>
</li>
<li>
<div align="left"><font color="#0000ff">throw</font> <font color="#0000ff">new</font> <font color="#4bacc6">MyCustomException</font>(<font color="#c0504d">&quot;Exception Message&quot;</font>);         </div>
</li>
<li>
<div align="left"><font size="3"></font><font color="#0000ff">throw new</font> <font color="#4bacc6">MyCustomException</font>(<font color="#c0504d">&quot;Exception Message&quot;</font>, ex);         </div>
</li>
</ol>
<p> <font size="3">   </p>
<p align="left"><font face="Calibri">So obviously syntax-vise they are all different from each other, but what actually is the difference in what happens when they excute?        </p>
<p>If your explanation included “<strong>Inner Exception</strong>” that’s +1 Point.         <br />If your explanation included “<strong>Call Stack</strong>” or “<strong>Stack-Trace</strong>” that’s +3 Points.         <br />And if you have no idea, well there is nothing to be ashamed of, but stay tuned. </font></p>
<p align="left"><font face="Calibri">These fine differences are the kind of things that even seasoned .Net developers are just not familiar with. There is little to no documentation about this, especially on MSDN, where you’d think it should be under </font><a title="Exception Handling Fundamentals on MSDN" href="http://msdn.microsoft.com/en-us/library/2w8f0bss.aspx" target="_blank"><font face="Calibri">Exception Handling Fundamentals</font></a><font face="Calibri">.&#160; </p>
<p>So let’s go over each one and understand what it does and when we would like to use it.         <br /></font></p>
<blockquote>
<p align="left"><font face="Calibri">1.</font> <font color="#0000ff">throw</font>;         </p>
<p><font face="Calibri"><u>What it does:</u> Re-Throwing the just caught exception, <strong>Preserving the Call Stack</strong> leading to the exception being caught.           </p>
<p><u>When will I use it:</u> When you wish to catch the exception only to log it or do some kind or rollback logic, but bubble the original exception with the full Stack-Trace.</font></p>
<p align="left"><font face="Calibri"></font></p>
<p align="left"><font face="Calibri"></font></p>
<p align="left"><font face="Calibri">2.</font> <font color="#0000ff">throw</font> ex;         </p>
<p><font face="Calibri"><u>What it does:</u> Same as the last one, only this time <strong>Not Preserving the Call Stack</strong>, actually cleaning it and starting it from the current place in the code.</font></p>
<p align="left"><font face="Calibri"><u>When will I use it:</u> Possibly never. The only good reason I see to do this is if you want to actually hide the Call Trace leading to the exception from the person using your code.           <br />This could be because you already logged the full trace and don’t want to have it written again to the log. Another reason is that you provide a third party DLL and don’t want the exception to reveal all your calling trace. On both cases I find the next example a better option.           <br /></font></p>
<p align="left">&#160;</p>
</blockquote>
<blockquote>
<p align="left"><font face="Calibri">3.</font> <font color="#0000ff">throw</font> <font color="#0000ff">new</font> <font color="#4bacc6">MyCustomException</font>(<font color="#c0504d">&quot;Exception Message&quot;</font>);&#160; </p>
<p align="left"><font face="Calibri"><u>What it does:</u> Creates a new exception instance, with your own exception message. In the process tossing away the call stack gathered up to this point and creating a new one. Therefore <strong>Not Preserving the Call Stack</strong>.           </p>
<p><u>When will I use it:</u> On same instances described on the previous example. Only this time you have the added benefit of having the newly thrown exception be the one you created with your own exception message. </font></p>
<p align="left"><font face="Calibri">         <br /></font></p>
<p align="left"><font face="Calibri"></font></p>
<p align="left"><font face="Calibri">4. </font><font color="#0000ff">throw new</font> <font color="#4bacc6">MyCustomException</font>(<font color="#c0504d">&quot;Exception Message&quot;</font>, ex);</p>
<p align="left"><font face="Calibri"><u>What it does:</u> Creates a new exception instance same as the last time, but this time using the caught exception as the <strong>Inner Exception</strong>.           <br />What it means is that all the information gathered in the exception that was caught is maintained inside the newly created exception, and in the process <strong>Preserving the Call Stack</strong>.</font></p>
<p align="left"><font face="Calibri"><u>When will I use it:</u> Probably this is the most useful one of the lot. It gives you both the ability to maintain the gathered trace, but also add to it your own information, and if you wish, have the new exception take the form of your own custom exception type.           <br /></font></p>
</blockquote>
<p align="left"><font face="Calibri">In any case, you should not catch an exception just so you can re-throw it, unless you have a good reason.        <br />Among these good reasons are: Enriching or Editing the exception details, Logging, Performing rollback and resource cleanup logic and so on.</font></p>
<p>   <font face="Calibri">     </p>
<hr /></font>    </p>
<p align="left">
<p> </font>  </p>
<p align="left"><font size="3" face="Calibri">That’s it for Part I.      <br />Part II of this post will cover:<strong> Resource Management</strong>, <strong>Multithreading</strong>, <strong>Documentation</strong> and <strong>Design Decisions</strong> regarding Exceptions.       <br />So stay tuned.</font></p>
<p align="left"><font size="3" face="Calibri">I Hope this post helped you.      <br />If you have any comments, questions and other relevant or irrelevant things to say, please leave a message on the comment section bellow.</font></p>
<p align="left"><font size="3" face="Calibri">Josef.</font></p>
<p align="left">&#160;</p>
<p align="left"><font size="2"><font face="Calibri">Previously on “Code Tips That Will Save Your Life” :        <br /></font><a href="http://blogs.microsoft.co.il/blogs/jgold/archive/2011/09/23/code-tips-that-will-save-your-life-1.aspx" target="_blank"><font face="Calibri">Tip #1- Code Documentation</font></a></font></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.microsoft.co.il/jgold/2012/04/05/code-tips-that-will-save-your-life-2-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing Windows Phone Certification &#8211; Correctly Working with Media</title>
		<link>http://blogs.microsoft.co.il/jgold/2012/03/28/passing-windows-phone-certification-correctly-working-with-media/</link>
		<comments>http://blogs.microsoft.co.il/jgold/2012/03/28/passing-windows-phone-certification-correctly-working-with-media/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 20:50:49 +0000</pubDate>
		<dc:creator><![CDATA[JosefGoldstein]]></dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Certification]]></category>
		<category><![CDATA[DEV]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Windows Phone Certification]]></category>

		<guid isPermaLink="false">http://blogs.microsoft.co.il/?p=1046959</guid>
		<description><![CDATA[Tip #1: How not to break Windows Phone certification rule No. 6.5 – Correctly working with the Media Player. Oh this is a fun one… The first certification rejection I ever got was because of this one. It's a very simple rule, but not knowing of it's existence or how to abide it in code [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="line-height: 13pt; margin: 0cm 0cm 10pt" dir="rtl" class="MsoNormal" align="center"><span style="line-height: 14pt" dir="ltr"><font face="Calibri"><font style="font-size: 12pt">Tip #1: How not to break <a href="http://msdn.microsoft.com/en-us/library/hh184838%28v=vs.92%29.aspx" target="_blank">Windows Phone certification rule No. 6.5</a> – Correctly working with the Media Player.</font></font></span><span style="line-height: 14pt; font-family: ; mso-ascii-font-family: calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: calibri; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: arial; mso-bidi-theme-font: minor-bidi" lang="HE"></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: ; mso-ascii-font-family: calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: calibri; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: arial; mso-bidi-theme-font: minor-bidi" dir="rtl" lang="HE">     </p>
<p></span><span><font face="Calibri"><font style="font-size: 12pt">Oh this is a fun one…         <br />The first certification rejection I ever got was because of this one. It's a very simple rule, but not knowing of it's existence or how to abide it in code can make things tricky when you try to fix it later.          </p>
<p>The idea is fairly basic, if the user has music playing while entering your application (via Zune or whatnot), you can't hijack the Media Player and play what you want without asking for permission first.          <br />This is fairly logical for several reasons. For one, if you build a game, the user might want to play it while having his own music in the background.          <br />Another scenario is this one: The user, whilst having music playing, enters your application, suddenly the music stops and the user doesn't know why, enraged with confusion the user throws his phone to the ground and breaks it.          <br />All in all this rule is pretty effective in maintaining UX in all that regards playing music in the background, a very common use case.          </p>
<p>What does it mean for you as a developer?          <br />Before using any class that plays music using the media player (</font></font></span><font style="font-size: 12pt"><span style="font-family: ; color: "><font color="#2b91af" face="Consolas">Song</font></span><span><font face="Calibri">, </font></span><span style="font-family: ; color: "><font color="#2b91af" face="Consolas">SongCollection</font></span><span><font face="Calibri">, </font></span><span style="font-family: ; color: "><font color="#2b91af" face="Consolas">MediaElement</font></span></font><span><font face="Calibri"><font style="font-size: 12pt">, etc.), you must check if music is already playing, and if so you must ask the user for permission before playing anything.</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span><font face="Calibri"><font style="font-size: 12pt">&#160;</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span><font face="Calibri"><font style="font-size: 12pt">But how do I know if the user is playing music?         <br />Well this is where it gets a bit ugly; The only way you can know for sure is using the </font></font></span><font style="font-size: 12pt"><span style="font-family: "><font face="Consolas">Microsoft.Xna.Framework.Media.<span style="color: "><font color="#2b91af">MediaPlayer </font></span></font></span></font><span><font face="Calibri"><font style="font-size: 12pt">class.</font></font></span><span style="font-family: ; color: "></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span><font face="Calibri"><font style="font-size: 12pt">Yes, XNA. Sorry all you Silverlight purists, but like in a lot of things on the WP developer’s platform, you have to use XNA libraries for certain things.</font></font>      <br style="mso-special-character: line-break" />      <br style="mso-special-character: line-break" /></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span><font face="Calibri"><font style="font-size: 12pt">The </font></font></span><font style="font-size: 12pt"><span style="font-family: ; color: "><font color="#2b91af" face="Consolas">MediaPlayer </font></span><span><font face="Calibri">class contains a property called </font></span><span style="font-family: "><font face="Consolas">GameHasControl</font></span><span><font face="Calibri">, this kinda confusingly named property actually indicates whether someone else is already using the media player, like the Zune player for example. If no one is using the media player, this means your application has &quot;control&quot; over it and consequently the property will be True, otherwise it will be False.         </p>
<p>What this means is that before doing anything related to the media player you must first check this property, and if it is False (meaning you don't have control) ask the user for permission.          <br />Translated into simple code, it will look like this:</font>        </p>
<p></span></font><font face="Consolas"><span style="font-family: "><span style="mso-spacerun: yes"><font style="font-size: 12pt">&#160;</font></span></span><span style="font-family: "><span style="mso-spacerun: yes"><font style="font-size: 10pt">&#160;&#160; </font></span><font style="font-size: 10pt">HasPermission = <span style="color: "><font color="#0000ff">true</font></span>;</font></span></font></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><font style="font-size: 10pt">&#160;</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><span style="mso-spacerun: yes"><font style="font-size: 10pt">&#160;&#160;&#160; </font></span><font style="font-size: 10pt"><span style="color: "><font color="#0000ff">if</font></span> (!<span style="color: "><font color="#2b91af">MediaPlayer</font></span>.GameHasControl)</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><span style="mso-spacerun: yes"><font style="font-size: 10pt">&#160;&#160;&#160; </font></span><font style="font-size: 10pt">{</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><span style="mso-spacerun: yes"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span><font style="font-size: 10pt"><span style="color: "><font color="#0000ff">if</font></span> (<span style="color: "><font color="#2b91af">MessageBox</font></span>.Show(<span style="color: "><font color="#a31515">&quot;Can I please stop the music?&quot;</font></span>, <span style="color: "><font color="#a31515">&quot;Music Already<span style="mso-spacerun: yes">&#160; </span>Playing&quot;</font></span>, <span style="color: "><font color="#2b91af">MessageBoxButton</font></span>.OKCancel) == <span style="color: "><font color="#2b91af">MessageBoxResult</font></span>.Cancel)</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><span style="mso-spacerun: yes"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span><font style="font-size: 10pt">{</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><span style="mso-spacerun: yes"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span><font style="font-size: 10pt">HasPermission = <span style="color: "><font color="#0000ff">false</font></span>;</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><span style="mso-spacerun: yes"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span><font style="font-size: 10pt">}</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><span style="mso-spacerun: yes"><font style="font-size: 10pt">&#160;&#160;&#160;&#160; </font></span><font style="font-size: 10pt">}</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><font style="font-size: 10pt">&#160;</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><span style="mso-spacerun: yes"><font style="font-size: 10pt">&#160;&#160;&#160;&#160; </font></span><font style="font-size: 10pt"><span style="color: "><font color="#0000ff">if</font></span> (HasPermission)</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><span style="mso-spacerun: yes"><font style="font-size: 10pt">&#160;&#160;&#160;&#160; </font></span><font style="font-size: 10pt">{</font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><span style="mso-spacerun: yes"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span><span style="color: "><font style="font-size: 10pt" color="#008000">// Load and play music or navigate to a page that will</font></span></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span style="font-family: "><font face="Consolas"><span style="mso-spacerun: yes"><font style="font-size: 10pt">&#160;&#160;&#160;&#160; </font></span><font style="font-size: 10pt">}</font></font>      <br /></span><span style="font-family: ">     <br /></span><span><font face="Calibri"><font style="font-size: 12pt">When do you ask for permission and what you do if you don't get it is obviously up to you. This decision should be made considering the design and flow of your application.         </p>
<p><u>Just keep in mind these few things:</u>          </p>
<p>1) Never prompt the user before the first page has loaded. It's just not user friendly.          <br /><font size="1">           <br /></font>2) Consider what happens if the user doesn't want to stop his music at the moment, but later he does.          </p>
<p>3) If you are building a game or even an application, if the music is not essential don't make the user give his permission to stop the playing music in order to continue. He might want to play while having his own music playing, so give him the option.          </p>
<p>4) If you are creating a </font></font></span><font style="font-size: 12pt"><span style="font-family: ; color: "><font color="#2b91af" face="Consolas">MediaElement</font></span><span><font face="Calibri"> from XAML, note that assigning it a source, will cause loading the page to stop the currently playing music (because you load a new song to the media player, your </font></span><span style="font-family: ; color: "><font color="#2b91af" face="Consolas">MediaElement</font></span></font><span><font face="Calibri"><font style="font-size: 12pt">'s song).         <br /></font></font></span></p>
<p style="line-height: normal; margin: 0cm 0cm 0pt; unicode-bidi: embed; direction: ltr; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal" align="left"><span><font face="Calibri"><font style="font-size: 12pt">5) If your application or game plays background music throughout it's usage, you must include an option to mute and/or change the volume of the playing music (requirement 6.5.2).         </p>
<p>More posts about passing certification coming soon.          <br />If you have specific trouble with certification you wish me to write about, please leave a comment bellow.          </p>
<p>Josef.</font></font></span></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.microsoft.co.il/jgold/2012/03/28/passing-windows-phone-certification-correctly-working-with-media/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Passing Windows Phone Certification and Staying Alive</title>
		<link>http://blogs.microsoft.co.il/jgold/2011/10/31/passing-windows-phone-certification-and-staying-alive/</link>
		<comments>http://blogs.microsoft.co.il/jgold/2011/10/31/passing-windows-phone-certification-and-staying-alive/#respond</comments>
		<pubDate>Mon, 31 Oct 2011 23:56:00 +0000</pubDate>
		<dc:creator><![CDATA[JosefGoldstein]]></dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Certification]]></category>
		<category><![CDATA[DEV]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Windows Phone Certification]]></category>

		<guid isPermaLink="false">http://blogs.microsoft.co.il/?p=923641</guid>
		<description><![CDATA[AKA: What are Windows Phone 7 certification rules and how not to break them &#160; It's just so heart breaking. You've worked tirelessly on your new app, to you it's perfect, more than perfect, it’s the consummation of all your goals in life! But alas a few days after you've uploaded it to the App [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta content="text/html; charset=windows-1255" http-equiv="Content-Type" /><meta name="ProgId" content="Word.Document" /><meta name="Generator" content="Microsoft Word 14" /><meta name="Originator" content="Microsoft Word 14" /><link rel="File-List" href="http://blogs.microsoft.co.il/controlpanel/blogs/Passing%20certification%20and%20staying%20alive%201_files/filelist.xml" mce_href="Passing%20certification%20and%20staying%20alive%201_files/filelist.xml" /><link rel="themeData" href="http://blogs.microsoft.co.il/controlpanel/blogs/Passing%20certification%20and%20staying%20alive%201_files/themedata.thmx" mce_href="Passing%20certification%20and%20staying%20alive%201_files/themedata.thmx" />
<style>
<p><!--
 /* Font Definitions */
 @font-face
	{font-family:calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-520092929 1073786111 9 0 415 0;}
@font-face
	{font-family:consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:modern;
	mso-font-pitch:fixed;
	mso-font-signature:-520092929 1073806591 9 0 415 0;}
 /* Style Definitions */
 p.msonormal, li.msonormal, div.msonormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:10.0pt;
	margin-left:0cm;
	text-align:right;
	line-height:115%;
	mso-pagination:widow-orphan;
	direction:rtl;
	unicode-bidi:embed;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:arial;
	mso-bidi-theme-font:minor-bidi;}
span.grame
	{mso-style-name:"";
	mso-gram-e:yes;}
.msochpdefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:arial;
	mso-bidi-theme-font:minor-bidi;}
.msopapdefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page wordsection1
	{size:595.3pt 841.9pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	mso-header-margin:35.4pt;
	mso-footer-margin:35.4pt;
	mso-paper-source:0;
	mso-gutter-direction:rtl;}
div.wordsection1
	{page:wordsection1;}
--></style>
<p><span style="line-height: 115%; font-size: 12pt" dir="ltr"></span>  </p>
<h3 align="left"><font face="Arial"><span style="line-height: 115%; font-size: 10pt" dir="ltr">AKA: What are Windows Phone 7 certification rules and how not to break <span class="GramE">them</span></span> </font></h3>
<p>  </p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="left"><span style="line-height: 115%; font-size: 10pt" dir="ltr"></span>    </p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="left"><img title="The rules. Usually they look like this." border="0" alt="The rules. Usually they look like this." src="http://blogs.microsoft.co.il/blogs/jgold/Therules.gif" width="300" height="300" mce_src="http://blogs.microsoft.co.il/blogs/jgold/Therules.gif" />     </p>
<p style="text-align: left" dir="rtl" class="MsoNormal">&#160;<span style="line-height: 115%; font-size: 12pt" dir="ltr">      <br /><font face="Calibri">It's just so heart breaking. You've worked tirelessly on your new app, to you <span class="GramE">it's</span> perfect, more than perfect, it’s the consummation of all your goals in life!         <br />But alas a few days after you've uploaded it to the </font><a href="http://create.msdn.com" target="_blank" mce_href="http://create.msdn.com"><font face="Calibri">App Hub</font></a><font face="Calibri">, you find an update in your notifications panel<span class="GramE">..</span> You didn't pass certification.         </p>
<p>More or less, it's Microsoft's polite way of saying &quot;It's not me it's you&quot;. And the best way to avoid this heartache is to know what &quot;It&quot; means.         </p>
<p>Basically &quot;It&quot; is a not-so-long set of </font><a href="http://go.microsoft.com/?linkid=9730558" target="_blank"><font face="Calibri">application guidelines</font></a><font face="Calibri"> (rules) set by Microsoft that your Windows Phone 7 applications must answer to in order to be incorporated in the Marketplace.        </p>
<p>The reasons for these rules are the following<span class="GramE">:</span>         <br />1) User Experience.         <br />2) User Experience.         <br />3) User Experience.         <br />4) … you get the point …         </p>
<p>The whole idea behind the making of the new Windows Phone 7 platform was to create a mobile platform <b>for people</b>, this means one thing: give the user the best experience possible, and maintain it throughout the platform.         <br />What this means is that the only way to maintain the same great experience on every little thing you do on the device, is to make sure third party apps like the ones you and I develop, abide to the same user experience (UX) guidelines, hence the certification rules.</font></span><span style="line-height: 115%; font-family: &#39;Arial&#39;,&#39;sans-serif&#39;; font-size: 12pt" lang="HE"><o:p></o:p></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt" dir="ltr"><font face="Calibri">But like a lot of things, what makes a great experience for the user, can sometimes end up making a great pain in the #@&amp;! <span class="GramE">for</span> the developer. And not knowing the rules or how to abide them beforehand can cause you disappointment on a good day, or make you re-write big chunks of your code on a bad one.<span>&#160; </span>        </p>
<p>In my next few posts I will go over some of the key rules developers usually stumble over, and what are good practices for writing code that follows them. </font></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt" dir="ltr"><font face="Calibri"></font></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt" dir="ltr"><font face="Calibri">And until next time don’t forget:       <br /></font></span><span style="line-height: 115%; font-size: 12pt" dir="ltr"><font face="Calibri"><strong><em>Rules might have been made to be broken, but the same can also be said about bones.</em></strong></font></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt" dir="ltr"><font face="Calibri">Josef.</font></span></p>
<p align="left"><font size="3" face="Calibri"></font>    <br /><a href="http://blogs.microsoft.co.il/blogs/jgold/archive/2012/03/28/Passing-Windows-Phone-Certification-Correctly-Working-with-Media.aspx" target="_blank">Tip #1: Correctly Working With Media</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.microsoft.co.il/jgold/2011/10/31/passing-windows-phone-certification-and-staying-alive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft Announcing: Idea of the Week for Students</title>
		<link>http://blogs.microsoft.co.il/jgold/2011/10/26/microsoft-announcing-idea-of-the-week-for-students/</link>
		<comments>http://blogs.microsoft.co.il/jgold/2011/10/26/microsoft-announcing-idea-of-the-week-for-students/#respond</comments>
		<pubDate>Wed, 26 Oct 2011 21:28:00 +0000</pubDate>
		<dc:creator><![CDATA[JosefGoldstein]]></dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSP]]></category>
		<category><![CDATA[Students]]></category>
		<category><![CDATA[Windows Phone 7]]></category>

		<guid isPermaLink="false">http://blogs.microsoft.co.il/?p=920889</guid>
		<description><![CDATA[Student? Feeling creative? Microsoft is looking For You! This week we are launching a new promotion for students called “Idea of the Week”.&#160; The purpose is to encourage students to start experimenting with our developer tools and to begin taking action on their app ideas.&#160; We will select one winner per week and will award [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><meta http-equiv="Content-Type" content="text/html; charset=windows-1255"><br />
<meta name="ProgId" content="Word.Document"><br />
<meta name="Generator" content="Microsoft Word 14"><br />
<meta name="Originator" content="Microsoft Word 14">
<link href="http://blogs.microsoft.co.il/controlpanel/blogs/StudentMicrosoftContest_files/filelist.xml" rel="File-List" mce_href="StudentMicrosoftContest_files/filelist.xml">
<link href="http://blogs.microsoft.co.il/controlpanel/blogs/StudentMicrosoftContest_files/themedata.thmx" rel="themeData" mce_href="StudentMicrosoftContest_files/themedata.thmx">
<link href="http://blogs.microsoft.co.il/controlpanel/blogs/StudentMicrosoftContest_files/colorschememapping.xml" rel="colorSchemeMapping" mce_href="StudentMicrosoftContest_files/colorschememapping.xml">
<!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267">
  <w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
  <w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 1"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 2"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 3"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 4"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 5"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 6"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 7"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 8"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 9"/>
  <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
  <w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/>
  <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
  <w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
  <w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
  <w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
  <w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/>
  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
  <w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
  <w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
  <w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
  <w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
  <w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
  <w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
  <w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
  <w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
  <w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
  <w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
  <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
 </w:LatentStyles>
</xml><![endif]--></p>
<style>
</style>
<p><!--[if gte mso 10]>


<style>

</style>


<![endif]--><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1"/>
 </o:shapelayout></xml><![endif]--></p>
<div class="WordSection1" dir="RTL">
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span class="GramE"><span style="mso-fareast-font-family:
'Times New Roman';mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin">Student?</span></span><span style="mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Calibri;
mso-bidi-theme-font:minor-latin"> Feeling creative?<br />
Microsoft is looking <b>For You</b>!</p>
<p>This week we are launching a new promotion for students called “Idea of the<br />
Week”.<span style="mso-spacerun:yes">&nbsp; </span><br />
The purpose is to encourage students to start experimenting with our developer<br />
tools and to begin taking action on their app ideas.<span style="mso-spacerun:yes">&nbsp; </span><br />
We will select one winner per week and will award a $50 gift card to<br />
Amazon.com.<o:p></o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><b><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin">How Students<br />
Enter<o:p></o:p></span></b></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-bidi-font-family:Calibri;
mso-bidi-theme-font:minor-latin">Students must be registered for<b> <a href="http://www.dreamspark.com/" mce_href="http://www.dreamspark.com/"><span class="SpellE">Dreamspark</span></a></b>.&nbsp;<br />
Then they create a <span class="SpellE"><b><i>Sketchflow</i></b></span><b><i>*</i></b><br />
prototype of their app idea, post it online, and tweet the URL using the <span class="SpellE">hashtag</span> “#<span class="SpellE">WPAppItUp</span>“</span><span style="mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Calibri;
mso-bidi-theme-font:minor-latin"><o:p></o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin">Each week, we<br />
will select one winner of the $50 gift card and will judge all entries based<br />
on:<o:p></o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin">•Innovation<br />
(40%): How innovative is the idea? It does something new or does it accomplish<br />
something in a new way?<br style="mso-special-character:line-break"><br />
<!--[if !supportLineBreakNewLine]--><br style="mso-special-character:line-break"><br />
<!--[endif]--><o:p></o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin">•Experience<br />
(40%): Since this is a prototype, we don’t expect the UX to be polished.<br />
However, we are looking for a quality experience in the flow of the app. Does<br />
it feel seamless and like a native experience on Windows Phone?<o:p></o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin">•Potential (20%):<br />
Does the app idea have potential in the market (lots of users, making money,<br />
both) or not?<o:p></o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><b><u><span style="mso-fareast-font-family:
'Times New Roman';mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin">Started:</span></u></b><span style="mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Calibri;
mso-bidi-theme-font:minor-latin"><span style="mso-spacerun:yes">&nbsp;&nbsp; </span>10/17/2011<o:p></o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><b><u><span style="mso-fareast-font-family:
'Times New Roman';mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin">Ends:</span></u></b><span style="mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Calibri;
mso-bidi-theme-font:minor-latin"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun:yes">&nbsp;&nbsp;</span><span style="mso-spacerun:yes">&nbsp;</span>12/25/2011<o:p></o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin">Official Rules<span class="GramE">:</span><a href="http://www.microsoft.com/student/en/us/ideaoftheweek/officialrules.aspx" target="_blank" mce_href="http://www.microsoft.com/student/en/us/ideaoftheweek/officialrules.aspx">http://www.microsoft.com/student/en/us/ideaoftheweek/officialrules.aspx<o:p></o:p></a></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="font-size:10.0pt;mso-fareast-font-family:
'Times New Roman';mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" dir="LTR" style="margin-bottom:0cm;margin-bottom:.0001pt;
text-align:left;line-height:normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
direction:ltr;unicode-bidi:embed"><span style="font-size:10.0pt;mso-fareast-font-family:
'Times New Roman';mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><br />
</span><span style="font-size:7.0pt;mso-fareast-font-family:'Times New Roman';
mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin">*No Purchase<br />
Necessary.<span style="mso-spacerun:yes">&nbsp; </span>Open only to students<br />
18+.<span style="mso-spacerun:yes">&nbsp; </span>Game ends 12/25/2011.<o:p></o:p></span></p>
<p class="MsoNormal" dir="LTR" style="text-align:left;direction:ltr;unicode-bidi:
embed"><span style="mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><br />
Cheers<span class="GramE">,</span><br />
<a href="http://www.facebook.com/pages/Microsoft-Israel-Students/198910936798883" mce_href="http://www.facebook.com/pages/Microsoft-Israel-Students/198910936798883">Microsoft<br />
Student Partners Israel</a>.<o:p></o:p></span></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blogs.microsoft.co.il/jgold/2011/10/26/microsoft-announcing-idea-of-the-week-for-students/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code Tips That Will Save Your Life #1</title>
		<link>http://blogs.microsoft.co.il/jgold/2011/09/23/code-tips-that-will-save-your-life-1/</link>
		<comments>http://blogs.microsoft.co.il/jgold/2011/09/23/code-tips-that-will-save-your-life-1/#respond</comments>
		<pubDate>Fri, 23 Sep 2011 20:33:00 +0000</pubDate>
		<dc:creator><![CDATA[JosefGoldstein]]></dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Best Practice]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Tips]]></category>
		<category><![CDATA[DEV]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://blogs.microsoft.co.il/?p=904724</guid>
		<description><![CDATA[Tip #1 : Document &#38; Comment Your Code. &#160;&#160;&#160; &#34;Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.&#34; &#160; You can never know when this phrase will turn into reality, so you'd better be prepared. This is the beginning of what I expect [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3 align="left">Tip #<span class="GramE">1 :</span> Document &amp; Comment Your Code.</h3>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><span style="line-height: 115%; font-size: 10pt" dir="ltr"><o:p></span><o:p></o:p></p>
<div dir="rtl" class="WordSection1"><span style="line-height: 115%; font-family: &#39;Arial&#39;,&#39;sans-serif&#39;; font-size: 10pt" lang="HE"><o:p>&#160;&#160;&#160; </span></div>
<div dir="rtl" class="WordSection1"><span style="line-height: 115%; font-family: &#39;Arial&#39;,&#39;sans-serif&#39;; font-size: 10pt" lang="HE"></span><span style="line-height: 115%; font-size: 7pt" dir="ltr"><img style="display: block; float: none; margin-left: auto; margin-right: auto" title="mmmm… liver, fava beans and bad code, my favorite." border="0" alt="mmmm… liver, fava beans and bad code, my favorite." src="http://blogs.microsoft.co.il/blogs/jgold/Hannibal_LecterS.jpg" width="491" height="262" mce_src="http://blogs.microsoft.co.il/blogs/jgold/Hannibal_LecterS.jpg" /></span></div>
<p> <span style="line-height: 115%; font-size: 7pt" dir="ltr"></span>  </p>
<h6 align="center"><b><i><span style="line-height: 115%; font-size: 12pt" dir="ltr"><font size="2">&quot;Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.&quot;</font></span></i></b></h6>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><span style="line-height: 115%; font-size: 7pt" dir="ltr"><font size="2">&#160; </font></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><span style="line-height: 115%; font-size: 12pt" dir="ltr">You can n</span><span style="line-height: 115%; font-size: 12pt" dir="ltr">ever know when this phrase will turn into reality, so you'd better be prepared.</span><span style="line-height: 115%; font-family: &#39;Arial&#39;,&#39;sans-serif&#39;; font-size: 12pt" lang="HE">      <br /></span><span style="line-height: 115%; font-size: 12pt" dir="ltr">This is the beginning of what I expect to be a long series of coding tips and best practices that will help you write better code and might even save your life one day!<o:p></o:p></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial" dir="ltr"><o:p>&#160;</o:p></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><u><span style="line-height: 115%; font-size: 16pt; mso-bidi-font-family: arial" dir="ltr">Tip #<span class="GramE">1 :</span> Document &amp; Comment Your Code</span></u><u><span style="line-height: 115%; font-family: &#39;Arial&#39;,&#39;sans-serif&#39;; font-size: 16pt; mso-ascii-font-family: calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: calibri; mso-hansi-theme-font: minor-latin" lang="HE"><o:p></o:p></span></u></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial" dir="ltr">     <br />I really wanted to call this &quot;Document &amp; Comment Your Code <b>Properly</b>&quot; but then I realized that you can't do properly something that you don't do at all.<o:p></o:p></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial" dir="ltr">I have seen code written by so many developers, and about 4 out of 5 had the same thing in common: They did not document their code.      <br />Some didn't even write a single comment throughout several thousand lines of code, and some would write maybe a comment futilely explaining in 5 words the monstrosity of a recursive method they just wrote some 200 lines of code later.       </p>
<p>This has to stop!       <br />You may think your code is so clear that it does not need comments, but that’s because <b>you</b> just wrote it and it's fresh in <b>your</b> mind. Even the <span class="GramE">most well</span>-written code can't be instantly clear to someone who isn't you, that is because it is written in code and will never match an actual language.<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-size: 12pt; mso-bidi-font-family: arial">And if you think to yourself &quot;</span><i><span class="st"><span style="font-size: 12pt">If it was </span></span><span style="font-family: &#39;Calibri&#39;,&#39;sans-serif&#39;; font-size: 12pt; mso-bidi-font-family: arial; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">hard</span><span class="st"><span style="font-size: 12pt"> to </span></span><span style="font-family: &#39;Calibri&#39;,&#39;sans-serif&#39;; font-size: 12pt; mso-bidi-font-family: arial; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">write, it should be hard</span><span class="st"><span style="font-size: 12pt"> to understand</span></span></i><span style="font-size: 12pt; mso-bidi-font-family: arial">&quot;, you might want to <a href="http://thc.org/root/phun/unmaintain.html" mce_href="http://thc.org/root/phun/unmaintain.html">look for advise elsewhere</a>. <span style="mso-spacerun: yes">&#160;</span>       </p>
<p>The good news for all you other .NET developers are that it's not that hard and part of the heavy lifting is done for you, saving you about half of the work.       <br />Don't believe me? Go <span class="GramE">ahead,</span> open a new project on Visual Studio, yes I will wait…       <br /></span><span style="font-size: 12pt; mso-bidi-font-family: arial">     </p>
<p>It's open? Good.       <br />Create a new class; name it to your liking like so:       </p>
<p></span><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span><span style="color: blue">public</span> <span style="color: blue">class</span> <span class="SpellE"><span style="color: #2b91af">CookieMonster</span></span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span>{<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span><span style="mso-spacerun: yes">&#160;&#160;&#160; </span><span style="color: green">// A whole <span class="SpellE">lotta</span> nothing.</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span>}<o:p></o:p></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><span style="line-height: 115%; font-family: &#39;Arial&#39;,&#39;sans-serif&#39;; font-size: 12pt; mso-ascii-font-family: calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: calibri; mso-hansi-theme-font: minor-latin" lang="HE">     <br /></span><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial" dir="ltr">Now for the cool part, put your text marker one line above the class declaration and type the character '/<span class="GramE">' <span style="mso-spacerun: yes">&#160;</span>three</span> times (yes <b>Three</b>).</span><span style="line-height: 115%; font-family: &#39;Arial&#39;,&#39;sans-serif&#39;; font-size: 12pt; mso-ascii-font-family: calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: calibri; mso-hansi-theme-font: minor-latin" lang="HE"><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span dir="ltr"></span><span style="font-family: consolas; font-size: 9.5pt"><span dir="ltr"></span><span style="mso-spacerun: yes">&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;summary&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/summary&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span><span class="GramE"><span style="color: blue">public</span></span> <span style="color: blue">class</span> <span class="SpellE"><span style="color: #2b91af">CookieMonster</span></span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span>{<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// A whole <span class="SpellE">lotta</span> nothing.</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span>}<o:p></o:p></span></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-size: 12pt; mso-bidi-font-family: arial">It’s a miracle you say? No, this is not some kind of witchcraft, this is <b>XML Documentation</b>, and it will be the only way you are going to document your code from here on.       <br />Go ahead write some class description, don't be shy. You will see that you can add some more tags, like remarks, code usage examples and so on.       </p>
<p></span><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;summary&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span><span style="color: gray">///</span><span style="color: green"> <span class="GramE">The</span> </span><span style="color: gray">&lt;c&gt;</span><span class="SpellE"><span style="color: green">CookieMonster</span></span><span style="color: gray">&lt;/c&gt;</span><span style="color: green"> class is responsible for all <o:p></o:p></span></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; color: green; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span></span><span style="font-family: consolas; color: gray; font-size: 9.5pt">///</span><span style="font-family: consolas; color: green; font-size: 9.5pt"> cookie disposing (<span class="SpellE">a.k.a</span>: eating) in the system.</span><span style="font-family: consolas; font-size: 9.5pt"><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/summary&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;remarks&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span><span style="color: gray">///</span><span style="color: green"> Beware: <o:p></o:p></span></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; color: green; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span></span><span style="font-family: consolas; color: gray; font-size: 9.5pt">/// </span><span class="GramE"><span style="font-family: consolas; color: green; font-size: 9.5pt">The</span></span><span style="font-family: consolas; color: green; font-size: 9.5pt"> </span><span style="font-family: consolas; color: gray; font-size: 9.5pt">&lt;c&gt;</span><span class="SpellE"><span style="font-family: consolas; color: green; font-size: 9.5pt">CookieMonster</span></span><span style="font-family: consolas; color: gray; font-size: 9.5pt">&lt;/c&gt;</span><span style="font-family: consolas; color: green; font-size: 9.5pt"> may dispose of your cookies without a warning.</span><span style="font-family: consolas; font-size: 9.5pt"><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span><span style="color: gray">///</span><span style="color: green"> <span class="GramE">Disabling</span> cookies may result in exceptions and rage.</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/remarks&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span><span class="GramE"><span style="color: blue">public</span></span> <span style="color: blue">class</span> <span class="SpellE"><span style="color: #2b91af">CookieMonster</span></span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span>{<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: green">// A whole <span class="SpellE">lotta</span> nothing.</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span>}<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-size: 12pt; mso-bidi-font-family: arial"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-size: 12pt; mso-bidi-font-family: arial">Let's try something new, add a method, maybe a property, you can do <span class="GramE">it,</span> you do it all the time.       </p>
<p></span><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span><span class="GramE"><span style="color: blue">public</span></span> <span style="color: blue">class</span> <span class="SpellE"><span style="color: #2b91af">CookieMonster</span></span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span>{<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">public</span></span> <span class="SpellE"><span style="color: blue">bool</span></span> <span class="SpellE">IsFull</span> { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">public</span></span> <span class="SpellE"><span style="color: blue">bool</span></span> Eat(<span class="SpellE">System.Net.<span style="color: #2b91af">Cookie</span></span> cookie)<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span>{<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">if</span></span> (!<span class="SpellE">IsFull</span>)<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">cookie.BeEaten</span></span><span class="GramE">(</span>);<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">return</span></span> <span style="color: blue">false</span>;<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span>}<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span>}<o:p></o:p></span></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-size: 12pt; mso-bidi-font-family: arial">Now, do the same trick with the triple '/' above the property and the method.      </p>
<p></span><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span><span class="GramE"><span style="color: blue">public</span></span> <span style="color: blue">class</span> <span class="SpellE"><span style="color: #2b91af">CookieMonster</span></span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span>{<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;summary&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/summary&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">public</span></span> <span class="SpellE"><span style="color: blue">bool</span></span> <span class="SpellE">IsFull</span> { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;summary&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/summary&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;<span class="SpellE">param</span> name=&quot;cookie&quot;&gt;&lt;/<span class="SpellE">param</span>&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;returns&gt;&lt;/returns&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">public</span></span> <span class="SpellE"><span style="color: blue">bool</span></span> Eat(<span class="SpellE">System.Net.<span style="color: #2b91af">Cookie</span></span> cookie)<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span>{<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">if</span></span> (!<span class="SpellE">IsFull</span>)<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">cookie.BeEaten</span></span><span class="GramE">(</span>);<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">return</span></span> <span style="color: blue">true</span>;<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span>}<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span>}<o:p></o:p></span></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-size: 12pt; mso-bidi-font-family: arial">Yes it also works for methods, properties and members!      <br />And if you fill it up it will look like this:       </p>
<p></span><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span><span style="color: blue">public</span> <span style="color: blue">class</span> <span class="SpellE"><span style="color: #2b91af">CookieMonster</span></span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;</span>{<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;summary&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> Indication whether the </span><span style="color: gray">&lt;see <span class="SpellE">cref</span>=&quot;<span class="SpellE">CookieMonster</span>&quot;/&gt;</span><span style="color: green"> is full</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/summary&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;remarks&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> <span class="GramE">The</span> </span><span style="color: gray">&lt;see <span class="SpellE">cref</span>=&quot;<span class="SpellE">CookieMonster</span>&quot;/&gt;</span><span style="color: green"> is NEVER full</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/remarks&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">public</span></span> <span class="SpellE"><span style="color: blue">bool</span></span> <span class="SpellE">IsFull</span> { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;summary&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> <span class="GramE">Eats</span> a single cookie, disposing it.</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/summary&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;<span class="SpellE">param</span> name=&quot;cookie&quot;&gt;</span><span style="color: green"><o:p></o:p></span></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; color: gray; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span>///</span><span style="font-family: consolas; color: green; font-size: 9.5pt"> <span class="GramE">The</span> </span><span style="font-family: consolas; color: gray; font-size: 9.5pt">&lt;see <span class="SpellE">cref</span>=&quot;<span class="SpellE">System.Net.Cookie</span>&quot;/&gt;</span><span style="font-family: consolas; color: green; font-size: 9.5pt"> to be eaten</span><span style="font-family: consolas; color: gray; font-size: 9.5pt"><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; color: gray; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span>/// &lt;/<span class="SpellE">param</span>&gt;</span><span style="font-family: consolas; font-size: 9.5pt"><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;returns&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> Indication whether the cookie was eaten or not.</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;remarks&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> Note: the cookie is always eaten!</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/remarks&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/returns&gt;</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">public</span></span> <span class="SpellE"><span style="color: blue">bool</span></span> Eat(<span class="SpellE">System.Net.<span style="color: #2b91af">Cookie</span></span> cookie)<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span>{<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// Checks whether the <span class="SpellE">CookieMonster</span> is full</span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">if</span></span> (!<span class="SpellE">IsFull</span>)<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">cookie.BeEaten</span></span><span class="GramE">(</span>);<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">return</span></span> <span style="color: blue">true</span>;<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span>}<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt; text-autospace: ; mso-layout-grid-align: none" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span style="mso-spacerun: yes">&#160; </span>}<o:p></o:p></span></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt">So this is nice and all, but why bother you ask?      <br />Well try to write some code that uses this class, see anything different?      </p>
<p></span><img border="0" alt="" src="http://blogs.microsoft.co.il/blogs/jgold/intellisense1.png" width="455" height="69" mce_src="http://blogs.microsoft.co.il/blogs/jgold/intellisense1.png" />     <br style="mso-special-character: line-break" /></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt"><o:p>&#160;</o:p></span><img border="0" alt="" src="http://blogs.microsoft.co.il/blogs/jgold/intellisense2.png" width="284" height="57" mce_src="http://blogs.microsoft.co.il/blogs/jgold/intellisense2.png" /></p>
<p style="text-align: center; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal" align="center"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial">Indeed your eyes do not lie to you, <span class="GramE">that's</span> full <span class="SpellE">Intellisense</span> right there.       <br />But that’s not all, now comes the really cool part.<o:p></o:p></span></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial">     <br />One of the nastiest jobs a developer can get is making a program documentation document. These are usually very long, very boring, very incoherent Word files that supposedly have all the information needed to maintain the said program. Usually they end up unread for months until someone new needs to update them, but never the less at one point or another your boss will ask you to write one.       </p>
<p>Now let's say that the day came, the boss knocks on your door and says: &quot;Hey there Johnny boy. We are a bit ahead of schedule so we have some spare time, how about writing a Word file documenting that module you have been working on for the past 6 months?<span style="mso-spacerun: yes">&#160; </span>Great, send it to me on Monday, cheers.&quot;       </p>
<p>And now let's say that you read this post 6 months ago<span class="GramE">, <span style="mso-spacerun: yes">&#160;</span>thought</span> XML Documentation is indeed a good idea, and commented all your code with it.       </p>
<p>You just go to your project Properties -&gt; Build -&gt; <span class="GramE">And</span> set the XML Documentation File field. <span style="mso-spacerun: yes">&#160;</span><o:p></o:p></span></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt"><o:p>&#160; </o:p></span><img border="0" alt="" src="http://blogs.microsoft.co.il/blogs/jgold/xmldocprop.png" width="449" height="96" mce_src="http://blogs.microsoft.co.il/blogs/jgold/xmldocprop.png" /></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial"><o:p>&#160;</o:p>      <br />Now build. You will find that in your bin folder appeared a new XML file containing all the documentation that was in your code.       <br />Now you can do whatever you like with it, use your own XSL transformer to convert it into an html page, index and search on it, or use a third party application to convert it into the document type you desire, and these come in many flavors. <o:p></o:p></span></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial">A very commonly used open source tool is <a href="http://sandcastle.codeplex.com/" mce_href="http://sandcastle.codeplex.com/">Sandcastle</a>, together with </span><a href="http://www.codeplex.com/wikipage?ProjectName=SHFB" mce_href="http://www.codeplex.com/wikipage?ProjectName=SHFB">Sandcastle Help File Builder</a><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial"> they create a very powerful tool that enables you to create MSDN like documentation or chm files from your XML Documentation.      <br />So now you can go back to slacking off in peace while your boss thinks you are working hard on that document.<o:p></o:p></span></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial"><o:p>&#160;</o:p></span></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial">That’s it for now, this post has turned out to be much longer than I expected.      <br />I hope you've found this helpful, and if not, well… you have the comment section for that.       </p>
<p>For more info on XML Documentation <a href="http://msdn.microsoft.com/en-us/library/b2s063f7%28v=VS.71%29.aspx" mce_href="http://msdn.microsoft.com/en-us/library/b2s063f7%28v=VS.71%29.aspx">check out the MSDN page</a>.       <br style="mso-special-character: line-break" /><o:p></o:p></span></p>
<p style="text-align: left; unicode-bidi: embed; direction: ltr" dir="ltr" class="MsoNormal"><span style="line-height: 115%; font-size: 12pt; mso-bidi-font-family: arial">And don't forget:      <br />Code is usually easy to write, but rarely easy to read.       </p>
<p><span class="GramE">Josef.</span><o:p></o:p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.microsoft.co.il/jgold/2011/09/23/code-tips-that-will-save-your-life-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>5 Ways Improve Your Windows Phone 7 Application Stability</title>
		<link>http://blogs.microsoft.co.il/jgold/2011/09/18/5-ways-improve-your-windows-phone-7-application-stability/</link>
		<comments>http://blogs.microsoft.co.il/jgold/2011/09/18/5-ways-improve-your-windows-phone-7-application-stability/#respond</comments>
		<pubDate>Sun, 18 Sep 2011 21:45:00 +0000</pubDate>
		<dc:creator><![CDATA[JosefGoldstein]]></dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DEV]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[Windows Phone 7]]></category>

		<guid isPermaLink="false">http://blogs.microsoft.co.il/?p=902570</guid>
		<description><![CDATA[A.K.A: Critical But Stable Condition Probably the least user friendly experience one can have in a Windows Phone App, not including the &#34;screen freeze&#34; horror, is having the application crash back to start screen. No one tells you what happened, no one warned you that it is coming, and you are left with the horrifying [&#8230;]]]></description>
				<content:encoded><![CDATA[<h4 dir="rtl" class="WordSection1" align="left"><font face="Arial">A.K.A: Critical But Stable Condition</font></h4>
<p><font size="3" face="Calibri"></font></p>
<p><font size="3" face="Calibri">Probably the least user friendly experience one can have in a Windows Phone App, not including the &quot;screen freeze&quot; horror, is having the application crash back to start screen.      <br />No one tells you what happened, no one warned you that it is coming, and you are left with the horrifying feeling of assuming the worst. </font></p>
<p><font size="3" face="Calibri">Now I know that you know, that when an application crashes it's just an&#160; unhandled exception, nothing big, no scary monsters there.      <br />But the common user doesn't, for all he knows a pack of wild tumbeasts have just been unleashed inside his phone, nibbling on his contacts.</font></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><a title="Thumbeast Ravaing a Windows Phone" href="http://blogs.microsoft.co.il/blogs/jgold/thumbeastswp7.jpg" target="_blank"><img style="width: 507px; height: 464px" title="Tumbeasts ravaging a Windows Phone. Cuter than you&#39;d think.." border="0" alt="Tumbeasts ravaging a Windows Phone. Cuter than you&#39;d think.." src="http://blogs.microsoft.co.il/blogs/jgold/thumbeastswp7.jpg" mce_src="http://blogs.microsoft.co.il/blogs/jgold/thumbeastswp7.jpg" /></a>     </p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><span class="GramE"><span style="line-height: 115%; font-size: 7pt" dir="ltr">Credit for <a href="http://theoatmeal.com/" mce_href="http://theoatmeal.com/">The oatmeal</a> for these awesome <span class="SpellE">tumbeasts</span> illustrations.</span></span><span style="line-height: 115%; font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 7pt" lang="HE"><o:p></o:p></span></p>
<p><font size="3" face="Calibri">It’s a situation you need to avoid as much as possible, both for the user's sake and for yours if you want your application to be successful.</font></p>
<p><font size="3" face="Calibri">So here are 5 tips for making your application more stable:</font><u></u></p>
<p> <span style="font-size: 14pt"><u></u></span>  </p>
<h3><font face="Calibri"></font></h3>
<h3><font face="Calibri">1) <u>Duh.</u></font><span style="font-family: &#39;Times New Roman&#39;,&#39;serif&#39;" dir="rtl" lang="HE">      <br /></span></h3>
<p><font size="3" face="Calibri"><strong>Fact:</strong> Most people are lazy.       <br /><strong>Ergo:</strong> Most program developers are lazy. </font></p>
<p><font size="3" face="Calibri">The following lines will look very basic to some of you, so basic you might just stare at the screen and go &quot;Duh&quot;. But for a good part of you this will be an eye opener, or at least a wake-up call. </font>    </p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span><span class="GramE"><span style="color: blue">try          <br /></span></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// Do stuff        <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span><span class="GramE"><span style="color: blue">catch          <br /></span></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// <span class="GramE">Oh</span> noes things failed         <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span><span class="GramE"><span style="color: blue">finally          <br /></span></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span><span>&#160;&#160;&#160; </span><span style="color: green">// <span class="GramE">This</span> part has to be done any way         <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span>}       <br /></span><span style="line-height: 115%; font-size: 12pt" dir="ltr">&#160;</span></p>
<p><font size="3" face="Calibri">If a good part of your code does not match this pattern, than sorry to tell you, you are part of <strong>Most program developers</strong>, and by that I mean that <strong>You are lazy</strong>! </font></p>
<p><font size="3" face="Calibri">It's both good practice and common sense to extensively use Try&amp;Catch in your code, for about a gazillion reasons (O.K. that’s not a real number, but you get my point). The most important one being: Not letting exceptions bubble up all the way to the top and crash your application. </font></p>
<p><font size="3" face="Calibri">So wrapping your code with Try&amp;Catch is the first step, what's the next?      <br />Well that is up to your application design. You might want to notify the user that something failed, maybe send an error report to your server, or maybe just try again.</font></p>
<p>&#160;</p>
<p><font size="3" face="Calibri"></font></p>
<p><font size="3" face="Calibri"></font></p>
<h3><span style="line-height: 115%; font-size: 14pt" dir="ltr"><span dir="ltr"></span></span></h3>
<h3><span style="line-height: 115%; font-size: 14pt" dir="ltr"><font face="Calibri">2)</font><u><font face="Calibri"> Control your workers</font> </u></span>&#160; </h3>
<p align="left"><font size="3" face="Calibri">If you have ever created a complex Windows Phone 7 application, or any application with UI for that matter, you probably found yourself using Worker Threads, Background Workers, and other asynchronous goodies. These cool tools allow your application to do all its dirty work away from the precious UI thread, keeping it powerful and complex yet still responsive. </font></p>
<p align="left"><font size="3" face="Calibri">But as a great comic book hero once said:      <br />&quot;With great power there must also come great responsibility&quot;       <br /></font></p>
<p align="left"><img title="Slightly over dramatic for a software development blog. But what the heck..." border="0" alt="Slightly over dramatic for a software development blog. But what the heck..." src="http://blogs.microsoft.co.il/blogs/jgold/greatpower.jpg" width="400" height="251" mce_src="http://blogs.microsoft.co.il/blogs/jgold/greatpower.jpg" />     </p>
<p><font size="3" face="Calibri">A common misconception about threads is that they magically do their things and then just as magically disappear. Well the thing is they don't, they don't stop or disappear unless you close the application, or you tell them to. </font></p>
<p><font size="3" face="Calibri">Always make sure your main thread (the UI thread) knows which threads are alive and what is their status so in case of navigation it will be able to stop them gracefully, or make sure they are alive if that is what needed.</font></p>
<p><font size="3" face="Calibri">Threads that are killed abruptly can throw nasty exceptions that you can’t always catch.      <br />Also in general, exception that is thrown and not caught within a background thread will make your application crash! </font></p>
<p><font size="3" face="Calibri">For example, run this code on a new Windows Phone 7 project: </font></p>
<p><font size="3" face="Calibri">     <br /></font><span style="font-family: consolas; font-size: 9.5pt"><span style="color: rgb(43,145,175)">Thread</span> <span class="SpellE">thread;</span></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span></span><span style="font-family: consolas; font-size: 9.5pt"><span></span></span><span style="font-family: consolas; font-size: 9.5pt"><span></span></span><span class="GramE"><span style="color: blue">public</span></span> <span class="SpellE">MainPage</span>()       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">InitializeComponent</span></span><span class="GramE">(</span>);</span><span style="font-family: consolas; font-size: 9.5pt">&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="GramE">thread</span> = <span style="color: blue">new</span> <span style="color: rgb(43,145,175)">Thread</span>(<span style="color: blue">new</span> <span class="SpellE"><span style="color: rgb(43,145,175)">ThreadStart</span></span>(() =&gt;&#160; <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE"><span style="color: rgb(43,145,175)">Thread</span>.Sleep</span></span><span class="GramE">(</span>1000);<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">throw</span></span> <span style="color: blue">new</span> <span class="SpellE"><span style="color: rgb(43,145,175)">NotImplementedException</span></span>();       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span>}));</span><span style="font-family: consolas; font-size: 9.5pt">&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">thread.Start</span></span><span class="GramE">(</span>);       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>}       <br /></span></p>
<p> <span style="font-family: consolas; font-size: 9.5pt">   </p>
<p><font size="3" face="Calibri">The application will start, the background thread will start too, and after a second an exception will be thrown, not being caught by anything it will reach to the top and.. bye bye application, hello start window. </font></p>
<p><font size="3" face="Calibri">Now let's try that again, this time with a BackgroundWorker: </font></p>
<p> </span><font face="Calibri"></font><span style="font-family: consolas; font-size: 9.5pt"><span>     </p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal">&#160;</p>
<p>     <span class="SpellE"><span style="color: rgb(43,145,175)">BackgroundWorker</span></span> <span class="SpellE"><span class="GramE">bw</span></span>;<o:p></o:p></span></span>   </p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span><span class="GramE"><span style="color: blue">public</span></span> <span class="SpellE">MainPage</span>()       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">InitializeComponent</span></span><span class="GramE">(</span>);</span><span style="font-family: consolas; font-size: 9.5pt">&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">bw</span></span> = <span style="color: blue">new</span> <span class="SpellE"><span style="color: rgb(43,145,175)">BackgroundWorker</span></span>();       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE">bw.DoWork</span> += <span style="color: blue">new</span> <span class="SpellE"><span class="GramE"><span style="color: rgb(43,145,175)">DoWorkEventHandler</span></span></span><span class="GramE">(</span><span class="SpellE">bw_DoWork</span>);<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><o:p><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">bw.RunWorkerAsync</span></span><span class="GramE">(</span>);       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt">&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span><span class="GramE"><span style="color: blue">void</span></span> <span class="SpellE">bw_DoWork</span>(<span style="color: blue">object</span> sender, <span class="SpellE"><span style="color: rgb(43,145,175)">DoWorkEventArgs</span></span> e)       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE"><span style="color: rgb(43,145,175)">Thread</span>.Sleep</span></span><span class="GramE">(</span>1000);       </p>
<p></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">throw</span></span> <span style="color: blue">new</span> <span class="SpellE"><span style="color: rgb(43,145,175)">NotImplementedException</span></span>();       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>}</span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt">     <br /></span><span style="font-size: 12pt"><font face="Calibri">The application will start, the background worker will start too, and<span class="GramE">..</span> <span class="GramE">well</span> nothing happens.         <br />Why? Well nothing happens because <span class="SpellE">BackgroundWorker</span> is a bit more complex than a Thread. What actually happens is that the <span class="SpellE">BackgroundWorker</span> catches the exception for you, and sends it to you in the <span class="SpellE">RunWorkerCompleted</span> callback method.         <br />If you wanted to get it, you would do so like this: </font></span></p>
<p> <span style="font-family: consolas; font-size: 9.5pt">   </p>
<div dir="rtl" class="WordSection1" align="left"><span style="font-family: consolas; font-size: 9.5pt"></span></div>
<p>&#160;<font color="#0000ff">void</font> bw_RunWorkerCompleted(<font color="#0000ff">object</font> sender, <font color="#4f81bd">RunWorkerCompletedEventArgs</font> e)       <br />{       <br />&#160;&#160;&#160;&#160; <font color="#0000ff">if</font> (e.Error != null)       <br />&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#4bacc6">MessageBox</font>.Show(e.Error.ToString());       <br />&#160;&#160;&#160;&#160; }       <br />}       </p>
<p> </span><span style="font-family: consolas; font-size: 9.5pt">   </p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal">&#160;</p>
<p>   <font size="3" face="Calibri">So watch your background workers and threads, make sure they handle exceptions correctly and don't throw them all over the place. And in general if you can, prefer to use BackgroundWorkers instead of Threads.</font><span dir="ltr"><span>&#160;&#160;&#160; </span></span></span>  </p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><span dir="ltr"><span>&#160; </span></span><span style="line-height: 115%; font-size: 14pt" dir="ltr"><o:p></o:p></span></p>
<h3><span style="font-size: 14pt"><font face="Calibri">3) </font><u><font face="Calibri">Watch your senses</font> </u></span></h3>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span class="GramE"><span style="font-size: 12pt"><font face="Calibri">This</font></span></span><font face="Calibri"><span style="font-size: 12pt"> is a short one.        <br />Not all phones were made equal, and even though Microsoft works hard on keeping a high standard in all that is related to the phone's hardware, not all phones have the same feature. So before using any of the phone's sensors and relying on them, make sure they are even there. Even the ones that look obvious and all the phones should have them, future phones might not, so take that into consideration.         </p>
<p>For example:</span>       </p>
<p></font>    <br /><span style="font-family: consolas; color: blue; font-size: 9.5pt"><span>&#160;</span>if</span><span style="font-family: consolas; font-size: 9.5pt"> (<span class="SpellE"><span class="GramE">Accelerometer.State</span></span><span class="GramE"> !</span>= <span class="SpellE"><span style="color: rgb(43,145,175)">SensorState</span>.NotSupported</span> &amp;&amp;       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">Accelerometer.State</span></span><span class="GramE"> !</span>= <span class="SpellE"><span style="color: rgb(43,145,175)">SensorState</span>.NoPermissions</span> &amp;&amp;       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">Accelerometer.State</span></span><span class="GramE"> !</span>= <span class="SpellE"><span style="color: rgb(43,145,175)">SensorState</span>.Disabled</span>)       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE"><span style="color: blue">this</span>.Accelerometer</span> = <span style="color: blue">new</span> <span class="GramE"><span style="color: rgb(43,145,175)">Accelerometer</span>(</span>);       </p>
<p></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE"><span style="color: blue">this</span>.Accelerometer.ReadingChanged</span> += </span><span style="font-family: consolas; font-size: 9.5pt"><span class="GramE"><span style="color: blue">new </span></span><span style="color: rgb(43,145,175)">EventHandler</span>&lt;<span style="color: rgb(43,145,175)">AccelerometerReadingEventArgs</span>&gt;(Accelerometer_ReadingChanged);</span><span style="font-family: consolas; font-size: 9.5pt">&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE"><span style="color: blue">this</span>.Accelerometer.Start</span></span><span class="GramE">(</span>);       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>}</span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><o:p></o:p></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><span dir="ltr"><o:p></span></p>
<h3 align="left"><span dir="ltr"><u><font face="Calibri">4) Learn To Work Solo</font></u>&#160;</span></h3>
<p><span dir="ltr"></span></p>
<p><font size="3" face="Calibri">I love applications that use the web. They almost always have more content in them, they are dynamic, they allow you to share, they are fun.      <br />But what happens when I'm sitting on the train and suddenly I go into an area with no coverage?&#160; I leave the café and now I'm out on the street, suddenly there is no Wi-Fi only Cellular internet connection, what happens now? </font></p>
<p><font size="3" face="Calibri">These are very important questions that sadly not all developers ask themselves.      <br />You cannot assume that your user is connected at all times. Even if you say in advanced that the application is useless offline, it needs to handle itself gracefully on all occasions.       <br />Gracefully means to at least not crash, notify the user about what happens, and if you want to be really user friendly, how about some cashed offline content? </font></p>
<p><font size="3" face="Calibri">I can say for myself that this is one of the bigger issues a WP7 developer can stumble upon.      <br />Connection flakiness can vary, and even if you have a live connection it doesn't always mean that things will work. You have remote servers to worry about, proxies, local Wi-Fi login pages that always show up at the worst time, and all of that change from one country to the other.</font></p>
<p><font size="3" face="Calibri">So what are good practices?      <br />That very much depends on what you are trying to achieve.&#160; For most cases I found &quot;The best defense is a strong offense&quot; a good tactic. And by that I mean, that it is better to monitor the connectivity and &quot;attack&quot; accordingly, than just to wait for exceptions to fly willy-nilly and handle them.&#160; </font></p>
<p><font face="Calibri"><font size="3"><strong>Attack #1:</strong> Before doing anything, show the user some pretty colors and while he is distracted check for connectivity.         <br /></font></font></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><img title="Ooooh pretty colors!" hspace="12" alt="Ooooh pretty colors!" align="left" src="http://blogs.microsoft.co.il/blogs/jgold/prettycolors.jpg" width="157" height="295" mce_src="http://blogs.microsoft.co.il/blogs/jgold/prettycolors.jpg" /><o:p></o:p></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><o:p><span style="font-family: consolas; font-size: 9.5pt"><span class="SpellE">       </p>
<p>IsConnected</span> = <span class="SpellE"><span class="GramE"><span style="color: rgb(43,145,175)">NetworkInterface</span>.GetIsNetworkAvailable</span></span><span class="GramE">(</span>);<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; color: blue; font-size: 9.5pt"><span class="GramE">       <br />if</span></span><span style="font-family: consolas; font-size: 9.5pt"> (<span class="SpellE">IsConnected</span>)       <br /></span><span style="font-family: consolas; font-size: 9.5pt">{      <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160; </span><span style="color: green">// Do awesome stuff        <br /></span></span><span style="font-family: consolas; font-size: 9.5pt">}<o:p></o:p></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><span dir="ltr"><span>       <br />&#160;</span></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-size: 12pt">     </p>
<p><font face="Calibri">You could also identify the connection type while at it:</font></span><font face="Calibri"> </font>    </p>
<p><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160; </span><span style="color: blue">switch</span> (<span class="SpellE"><span style="color: rgb(43,145,175)">NetworkInterface</span>.NetworkInterfaceType</span>)       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">case</span></span> <span style="color: rgb(43,145,175)">NetworkInterfaceType</span>.Wireless80211:       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// This Wi-Fi        <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">break</span></span>;       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span><span>&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">case</span></span> <span class="SpellE"><span style="color: rgb(43,145,175)">NetworkInterfaceType</span>.Ethernet</span>:       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// This Ethernet        <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">break</span></span>;       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">case</span></span> <span class="SpellE"><span style="color: rgb(43,145,175)">NetworkInterfaceType</span>.MobileBroadbandGsm</span>:       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// This <span class="SpellE">Gsm          <br /></span></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">break</span></span>;       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">case</span></span> <span class="SpellE"><span style="color: rgb(43,145,175)">NetworkInterfaceType</span>.MobileBroadbandCdma</span>:       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// This <span class="SpellE">Cdma          <br /></span></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">break</span></span>;       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160; </span><span class="GramE">}</span>       </p>
<p></span><font face="Calibri"><b><span style="font-size: 12pt"><font size="4">Watch yourself</font></span></b><span style="font-size: 12pt">, both these pieces of code can take a while to compute (yes even getting the <span class="SpellE">NetworkInterfaceType</span> property actually operates </span></font><span style="font-size: 12pt"><font face="Calibri">some logic behind the scenes).        <br />I never witnessed that for myself, but some people say this can take up to 20 seconds. So if you don't want your user watching a static (yet colorful) screen for too long consider doing this with a <span class="SpellE">BackgroundWorker</span>.         <br /></font></span><span style="font-family: consolas; font-size: 9.5pt">     </p>
<p><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-size: 9pt"><font face="Calibri">Note: when working with the network interface you will find yourself confused by 2 similar namespaces<span class="GramE">:</span>         <br /></font></span><span style="font-family: consolas; font-size: 8pt"><font face="Calibri">&#8211; <span class="SpellE">Microsoft.Phone.Net.NetworkInformation</span>         <br />&#8211; <span class="SpellE">System.Net.NetworkInformation          <br /></span></font></span><span style="line-height: 115%; font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 9pt" lang="HE">     <br /></span><font face="Calibri"><span style="line-height: 115%; font-size: 9pt" dir="ltr">These namespaces are different and have different capabilities, and you will probably need to use both.        <br />The above example <span class="GramE">uses<span>&#160; </span><span class="SpellE"><span style="line-height: 115%; font-family: consolas; font-size: 8pt">Microsoft.Phone.Net.NetworkInformation</span></span></span></span><span style="line-height: 115%; font-family: consolas; font-size: 8pt" dir="ltr"> </span></font><span style="line-height: 115%; font-size: 9pt" dir="ltr"><font face="Calibri">the next one uses the other.        <br /></font>      </p>
<p></span><span style="line-height: 115%; font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 10pt" lang="HE"><o:p></o:p></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><font face="Calibri"><b><span style="line-height: 115%; font-size: 12pt" dir="ltr">Attacks #2 and #3: </span></b><span style="line-height: 115%; font-size: 12pt" dir="ltr">While the user is having fun, monitor the connectivity. If the connection is lost, inform the user and stop web requests. If the connection is found get back to work.        <br /><o:p></o:p></span></font></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span><span class="GramE"><span style="color: blue">private</span></span> <span style="color: blue">void</span> <span class="SpellE">PhoneApplicationPage_Loaded</span>(<span style="color: blue">object</span> sender, <span class="SpellE"><span style="color: rgb(43,145,175)">RoutedEventArgs</span></span> e)       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE"><span style="color: rgb(43,145,175)">NetworkChange</span>.NetworkAddressChanged</span> += <span style="color: blue">new</span> <span class="GramE"><span style="color: rgb(43,145,175)">NetworkAddressChangedEventHandler</span>(</span>NetworkChange_NetworkAddressChanged);       </p>
<p></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>}<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt">     <br /><span>&#160;</span><span class="GramE"><span style="color: blue">void</span></span> <span class="SpellE">NetworkChange_NetworkAddressChanged</span>(<span style="color: blue">object</span> sender, <span class="SpellE"><span style="color: rgb(43,145,175)">EventArgs</span></span> e)       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="SpellE">IsConnected</span> = <span class="SpellE"><span class="GramE"><span style="color: rgb(43,145,175)">NetworkInterface</span>.GetIsNetworkAvailable</span></span><span class="GramE">(</span>);       </p>
<p></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">if</span></span> (<span class="SpellE">IsConnected</span>)       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// Do stuff        <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">else          <br /></span></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span><span>&#160;&#160;&#160; </span><span style="color: green">// Stop doing stuff        <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160; </span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>}       <br /></span><span style="line-height: 115%; font-size: 12pt" dir="ltr"><font face="Calibri">&#160;</o:p></font></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right"><span style="line-height: 115%; font-size: 12pt" dir="ltr"><font face="Calibri">Basically all we did is to register to the event of the IP address changing, which will fire every time some sort of change will happen, including losing connection. That way we will know about the changes and act accordingly.        </p>
<p><b>Attacks #4: </b>Same as attack #1 only after <span class="SpellE">Tombstoning</span>. (Because I know some of you didn’t think about it).         </p>
<p>There is still a lot more that can be done, most of it is more application specific.         <br />For some more interesting input on this subject you can check out </font><a href="http://channel9.msdn.com/Events/TechEd/NorthAmerica/2010/WPH306" mce_href="http://channel9.msdn.com/Events/TechEd/NorthAmerica/2010/WPH306"><font face="Calibri">this presentation from Tech-Ed 2010</font></a><font face="Calibri">.</font></span><span style="line-height: 115%; font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt" lang="HE"><o:p></o:p></span></p>
<p style="text-align: left" dir="rtl" class="MsoNormal" align="right">&#160;</p>
<h3></h3>
<h3 align="left"><u><font face="Calibri">5) When All Fails</font>       <br /></u><span style="font-size: 7pt"><font style="font-weight: normal">Disclaimer: O.K. so this tip will not make your application not crash.        <br />But it will help you understand when, where and why your applications do.</font></span><span><font style="font-weight: normal"> </font></span></h3>
<p> <span>   </p>
<p><span><font face="Calibri"><font size="3"><strong>&quot;<i>In god we trust, the rest we monitor</i>&quot;</strong> </font></font></span></p>
<p><font size="3" face="Calibri">Yes sometimes you did almost everything right and still it crashed for a few users. It happens. Some bugs are just so hard to reproduce that there is no way you could have found them. </font></p>
<p><font size="3" face="Calibri">The best thing you can do is to document, research, and try to figure out what caused the crash. For that, you need a black box. </font></p>
<p><font size="3" face="Calibri">A black box can be anything, it can be a file on isolated storage, it can be a spool of text sent to a logging service, <span class="GramE">it</span> can even be a mail sent to you, the developer. </font></p>
<p><font size="3" face="Calibri">My personal preference is saving a file on isolated storage and checking it whenever opening the application. That way the next time the user opens the application, if the last time it crashed, I will find the file and prompt him to send the crash details to me. </font></p>
<p><font face="Calibri"><font size="3">Here is how you do it:<span>&#160; </span></font></font></p>
<p><font size="3" face="Calibri">First you must register to the <span class="SpellE">UnhandledException</span> event in the App class.         <br /></font><font face="Calibri"><span style="font-size: 12pt">You will find that the event handler is already there and it will look like this:</span><font size="3">          <br /></font></font></p>
<p> </span>  </p>
<p><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span><span style="color: blue">private</span> <span style="color: blue">void</span> <span class="SpellE">Application_<span class="GramE">UnhandledException</span></span><span class="GramE">(</span><span style="color: blue">object</span> sender, <span style="color: rgb(43,145,175)"><span>&#160;</span><span class="SpellE">ApplicationUnhandledExceptionEventArgs</span></span> e)       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">if</span></span> (<span class="SpellE">System.Diagnostics.<span style="color: rgb(43,145,175)">Debugger</span>.IsAttached</span>)       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// <span class="GramE">An</span> unhandled exception has occurred; break into the debugger         <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">System.Diagnostics.<span style="color: rgb(43,145,175)">Debugger</span>.Break</span></span><span class="GramE">(</span>);       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160; </span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;</span>}<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: &#39;Times New Roman&#39;,&#39;serif&#39;" dir="rtl" lang="HE">     <br /></span><font face="Calibri"><span style="font-size: 12pt">I wouldn't recommend removing the code that is already there, it's for debug purposes.        <br />Now all we need is to add the part that will save a crash report, something like this:</span>       </p>
<p></font>    <br /><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160; </span><span style="color: blue">private</span> <span style="color: blue">void</span> <span class="SpellE">Application_<span class="GramE">UnhandledException</span></span><span class="GramE">(</span><span style="color: blue">object</span> sender, <span class="SpellE"><span style="color: rgb(43,145,175)">ApplicationUnhandledExceptionEventArgs</span></span> e)       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">SaveCrashReport</span></span><span class="GramE">(</span>e);       </p>
<p></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">if</span></span> (<span class="SpellE">System.Diagnostics.<span style="color: rgb(43,145,175)">Debugger</span>.IsAttached</span>)       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// <span class="GramE">An</span> unhandled exception has occurred; break into the debugger         <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">System.Diagnostics.<span style="color: rgb(43,145,175)">Debugger</span>.Break</span></span><span class="GramE">(</span>);       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160; </span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160; </span>}<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>       <br />&#160; </span><span>&#160;</span><span class="GramE"><span style="color: blue">private</span></span> <span style="color: blue">static</span> <span style="color: blue">void</span> <span class="SpellE">SaveCrashReport</span>(<span class="SpellE"><span style="color: rgb(43,145,175)">ApplicationUnhandledExceptionEventArgs</span></span> e)       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">try          <br /></span></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">string</span></span> <span class="SpellE">crashReportFileName</span> = <span style="color: rgb(163,21,21)">&quot;CrashReport.txt&quot;</span>;</span><span style="font-family: consolas; font-size: 9.5pt">&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// Get the isolated storage        <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span style="color: rgb(43,145,175)">IsolatedStorageFile</span></span> <span class="SpellE">isoStore</span> =<span class="SpellE"><span class="GramE"><span style="color: rgb(43,145,175)">&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IsolatedStorageFile</span>.GetUserStoreForApplication</span></span><span class="GramE">(</span>);<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span></span><o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// Check if file exists and if so delete it        <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">if</span></span> (<span class="SpellE">isoStore.FileExists</span>(<span class="SpellE">crashReportFileName</span>))       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">isoStore.DeleteFile</span></span><span class="GramE">(</span><span class="SpellE">crashReportFileName</span>);       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}</span><span style="font-family: consolas; font-size: 9.5pt">&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// <span class="GramE">Create</span> the file and write the exception content to it         <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">using</span></span> (<span class="SpellE"><span style="color: rgb(43,145,175)">IsolatedStorageFileStream</span></span> <span class="SpellE">fileStream</span> =       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="SpellE">isoStore.CreateFile</span>(<span class="SpellE">crashReportFileName</span>))       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">using</span></span> (<span class="SpellE"><span style="color: rgb(43,145,175)">StreamWriter</span></span> <span class="SpellE">sw</span> = <span style="color: blue">new</span> <span class="SpellE"><span style="color: rgb(43,145,175)">StreamWriter</span></span>(<span class="SpellE">fileStream</span>))       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160; </span><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">sw.WriteLine</span></span><span class="GramE">(</span><span class="SpellE">e.ExceptionObject.Message</span>);       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">sw.WriteLine</span></span><span class="GramE">(</span><span class="SpellE">e.ExceptionObject.StackTrace</span>);       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160; </span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">catch</span></span></span><span style="font-family: consolas; font-size: 9.5pt">{</span><span style="font-family: consolas; font-size: 9.5pt">}      <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160; </span>}       <br /></span><span dir="ltr">&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-size: 12pt"><font face="Calibri">All we did is create a text file and write to it the crash report.        <br />If we wanted we could make it fancy: Serialize the report object using <span class="SpellE">XmlSerializer</span> or <span class="SpellE">DataContractSerializer</span>, add a time stamp, etc.         </p>
<p><span class="GramE">Now</span> all we need is that when the application loads we will look for this file to indicate a crash.         <br />We put this code in the <span class="SpellE">MainWindow</span> loaded event handler         </p>
<p></font></span>    <br /><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span><span style="color: blue">private</span> <span style="color: blue">void</span> <span class="SpellE">PhoneApplicationPage_<span class="GramE">Loaded</span></span><span class="GramE">(</span><span style="color: blue">object</span> sender, <span class="SpellE"><span style="color: rgb(43,145,175)">RoutedEventArgs</span></span> e)       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">try          <br /></span></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">string</span></span> <span class="SpellE">crashReportFileName</span> = <span style="color: rgb(163,21,21)">&quot;CrashReport.txt&quot;</span>;</span><span style="font-family: consolas; font-size: 9.5pt">&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// Get the isolated storage        <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span style="color: rgb(43,145,175)">IsolatedStorageFile</span></span> <span class="SpellE">isoStore</span> =       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="SpellE"><span class="GramE"><span style="color: rgb(43,145,175)">IsolatedStorageFile</span>.GetUserStoreForApplication</span></span><span class="GramE">(</span>);<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// Check if file exists this means we crashed last time        <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">if</span></span> (<span class="SpellE">isoStore.FileExists</span>(<span class="SpellE">crashReportFileName</span>))       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">string</span></span> report = <span class="SpellE"><span style="color: blue">string</span>.Empty</span>;</span><span style="font-family: consolas; font-size: 9.5pt">&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// Open the file and read the crash report        <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">using</span></span> (<span class="SpellE"><span style="color: rgb(43,145,175)">IsolatedStorageFileStream</span></span> <span class="SpellE">fileStream</span> = <span class="SpellE">       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; isoStore.OpenFile</span>(<span class="SpellE">crashReportFileName</span>, <span class="SpellE"><span style="color: rgb(43,145,175)">FileMode</span>.Open</span>))       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">using</span></span> (<span class="SpellE"><span style="color: rgb(43,145,175)">StreamReader</span></span> <span class="SpellE">sr</span> = <span style="color: blue">new</span> <span class="SpellE"><span style="color: rgb(43,145,175)">StreamReader</span></span>(<span class="SpellE">fileStream</span>))       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="GramE">report</span> = <span class="SpellE">sr.ReadToEnd</span>();       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}</span><span style="font-family: consolas; font-size: 9.5pt">&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// <span class="GramE">We</span> are done with the file, we can delete it         <br />&#160;</span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">isoStore.DeleteFile</span></span><span class="GramE">(</span><span class="SpellE">crashReportFileName</span>);</span><span style="font-family: consolas; font-size: 9.5pt">&#160;</o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// <span class="GramE">Ask</span> the user to send a crash report         <br />&#160;</span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span class="SpellE"><span class="GramE">PromptCrashReport</span></span><span class="GramE">(</span>report);       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160; </span>}       <br /></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160; </span><span class="GramE"><span style="color: blue">catch</span></span></span><span style="font-family: consolas; font-size: 9.5pt"><span> </span>{</span><span style="font-family: consolas; font-size: 9.5pt">}<o:p></o:p></span></p>
<p style="text-align: left; line-height: normal; unicode-bidi: embed; direction: ltr; margin-bottom: 0pt" dir="ltr" class="MsoNormal"><span style="font-family: consolas; font-size: 9.5pt"><span>&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// Do other stuff        <br /></span></span><span style="font-family: consolas; font-size: 9.5pt"><span>&#160; </span>}       <br /><o:p></o:p></span></p>
<p><font size="3" face="Calibri">Also here all we do is to look for the file, if it exists, this means that last time we crashed.      <br />We read the report, and ask the user to send it for analysis.       <br />Obviously this could also have been done asynchronously with a BackgroundWorker, to not slow down the loading time. </font></p>
<p><font size="3" face="Calibri">That’s about it.      <br />I hope this helped you or will help you in your future endeavors, and if not… Well you have the comments bellow to complain about that.       <br /></font>    <br /><span style="line-height: 115%; font-size: 12pt" dir="ltr">     <br /><font face="Calibri">And until next time, don't forget<span class="GramE">:</span>         <br /><span class="quoteoftheday"><em><strong>“If you don't have a good application, make sure you get good users.”</strong></em></span>         </p>
<p><span class="GramE">Josef.</span>         <br /></font></span></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.microsoft.co.il/jgold/2011/09/18/5-ways-improve-your-windows-phone-7-application-stability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The birth of a narcissist</title>
		<link>http://blogs.microsoft.co.il/jgold/2011/09/16/the-birth-of-a-narcissist/</link>
		<comments>http://blogs.microsoft.co.il/jgold/2011/09/16/the-birth-of-a-narcissist/#respond</comments>
		<pubDate>Fri, 16 Sep 2011 19:44:00 +0000</pubDate>
		<dc:creator><![CDATA[JosefGoldstein]]></dc:creator>
				<category><![CDATA[Off-Topic]]></category>

		<guid isPermaLink="false">http://blogs.microsoft.co.il/?p=901612</guid>
		<description><![CDATA[A.K.A: Why on earth would you start a blog? I hate first impressions, never was good at them. I find it easier to grow on people rather than dazzle them with a witty opening line. So also this time I will not make an exception: Hello my name is Josef Goldstein. I'm a .NET software [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="text-align: left"><!--[if gte mso 9]&gt;--></p>
<p><!--[if gte mso 9]&gt;--></p>
<p style="text-align: left">A.K.A: Why on earth would you start a blog?</p>
<p>I hate first impressions, never was good at them.<br />
I find it easier to grow on people rather than dazzle them with a witty opening line.<br />
So also this time I will not make an exception:</p>
<p><strong>Hello my name is Josef Goldstein.</strong></p>
<p>I'm a .NET software developer and architect; Born and raised in the good ol' holy land (Israel for all you other 50% of the earth).<br />
When I'm not at the office I'm working on my B.Sc. degree in CS, while filling the role of a <a title="Microsoft Student Partners" href="https://www.microsoftstudentpartners.com/" target="_blank">Microsoft Student Partner</a> in my faculty.<br />
I like long walks on the beach, IntelliSense, and corny humor.</p>
<p>So why am I here?<br />
That’s a damn good question.<br />
Mainly because I was asked to, but also because of curiosity.<br />
I like software development related blogs. I'm the kind of guy that not only goes to them when in need for a code snippet to fix a problem, but also follows <a title="Joel on software" href="http://www.joelonsoftware.com/" target="_blank">the good ones</a> on a regular basis.  My hope is that with time I will be able to fill this blog with the kind of posts that make people keep reading, even if they don't have to. And who knows maybe even learn for myself a thing or two while doing it.</p>
<p>What should you expect to see here?<br />
Hopefully text, maybe some code. I believe that teaching people how to fish is much better than giving them a fish, and usually giving code snippets is the equivalent of  giving fish away.<br />
Currently I'm most passionate about Windows phone, WCF, WPF and Windows Azure, so expect to see a lot about them in the near future (especially the first).<br />
Beside these awesome buzzwords, I also believe in writing good code, a thing which sadly is rarer than I would wish. So expect to see a lot of posts about good practices, and writing code that will not make your co-workers hate you.</p>
<p>That’s it for now.<br />
And until next time, don't forget:<br />
<em>Trying is the first step towards failure. But failure is the first step towards success.</em></p>
<p>Josef.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.microsoft.co.il/jgold/2011/09/16/the-birth-of-a-narcissist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tradition</title>
		<link>http://blogs.microsoft.co.il/jgold/2011/09/15/tradition/</link>
		<comments>http://blogs.microsoft.co.il/jgold/2011/09/15/tradition/#respond</comments>
		<pubDate>Thu, 15 Sep 2011 11:25:00 +0000</pubDate>
		<dc:creator><![CDATA[JosefGoldstein]]></dc:creator>
		
		<guid isPermaLink="false">http://blogs.microsoft.co.il/?p=901066</guid>
		<description><![CDATA[&#160;Hello World]]></description>
				<content:encoded><![CDATA[<p style="font-size: x-large">&nbsp;Hello World</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.microsoft.co.il/jgold/2011/09/15/tradition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
