<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Comment Feed for Channel 9 - Tombstoning and Task Switching - Day 3 - Part 8</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching/RSS"></atom:link>
	<image>
		<url>http://ecn.channel9.msdn.com/o9/ch9/3979/615ac49e-47be-4f2b-aa4e-9e2300173979/day3part8_100_ch9.jpg</url>
		<title>Channel 9 - Tombstoning and Task Switching - Day 3 - Part 8</title>
		<link></link>
	</image>
	<description> How does your application respond when a user clicks the Start button or Back button on Windows Phone 7?&amp;nbsp; In this video, Bob explains the difference between the Launched, Activated, Closed, and Deactivated events, how your application can be notified via event handlers in the App.xaml.cs code-behind file, and how to take that opportunity to save the current state of the application. Then, once the user has re-launched the applications, the state information can be retrieved and the state of the application from the previous session can be restored. Bob also explains how a special feature of Isolated Storage called IsolatedStorageSettings can provide an easy way to save name / value pair information without having to create and access a text file. Download the source code in c# Download the source code in VB.Net </description>
	<link></link>
	<language>en</language>
	<pubDate>Mon, 20 May 2013 05:50:28 GMT</pubDate>
	<lastBuildDate>Mon, 20 May 2013 05:50:28 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<item>
		<title>Re: Tombstoning and Task Switching - Day 3 - Part 8</title>
		<description>
			<![CDATA[ <p>Does App.xaml.cs.SaveState() also need to use TryGetValue, since, the first time it is run, if we leave the page or hit start before we change the TextBox, there is nothing in the property bag and the access fails with an exception?</p><p>posted by dwrogers</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634257432540000000</link>
		<pubDate>Fri, 19 Nov 2010 06:00:54 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634257432540000000</guid>
		<dc:creator>dwrogers</dc:creator>
	</item>
	<item>
		<title>Re: Tombstoning and Task Switching - Day 3 - Part 8</title>
		<description>
			<![CDATA[ <p>The sequence of Load, Activate, Deactivate, and Close calls was not obvious at first. And the fact that the debugger keeps dropping out makes it tough to follow. A useful extension to this module would be to record each of these events (WHEN&nbsp;it occurred) in the string we are saving. </p><p>These changes would go in App.xaml.cs:</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void Application_Launching(object sender, LaunchingEventArgs e)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LoadState(&quot;L&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void Application_Activated(object sender, ActivatedEventArgs e)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LoadState(&quot;A&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void Application_Deactivated(object sender, DeactivatedEventArgs e)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SaveState(&quot;D&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void Application_Closing(object sender, ClosingEventArgs e)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SaveState(&quot;C&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;</p><p>&nbsp;And then:</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void SaveState(string when)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PhoneApplicationService phoneAppService = PhoneApplicationService.Current;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (phoneAppService.State.ContainsKey(&quot;MyValue&quot;))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; settings[&quot;MyValue&quot;] = phoneAppService.State[&quot;MyValue&quot;] &#43; &quot; &quot; &#43; when &#43; &quot; &quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; settings[&quot;MyValue&quot;] = when &#43; &quot; &quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void LoadState(string when)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PhoneApplicationService phoneAppService = PhoneApplicationService.Current;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (settings.Contains(&quot;MyValue&quot;))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; phoneAppService.State[&quot;MyValue&quot;] = settings[&quot;MyValue&quot;] &#43; &quot; &quot; &#43; when &#43; &quot; &quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; phoneAppService.State[&quot;MyValue&quot;] = when &#43; &quot; &quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p><p>David</p><p>posted by dwrogers</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634258112750000000</link>
		<pubDate>Sat, 20 Nov 2010 00:54:35 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634258112750000000</guid>
		<dc:creator>dwrogers</dc:creator>
	</item>
	<item>
		<title>Re: Tombstoning and Task Switching - Day 3 - Part 8</title>
		<description>
			<![CDATA[12:12: It is unnecessary to condition 'TryGetValue' with 'ContainsKey' ('TryGetValue' combines 'ContainsKey' and 'Item' getter, see http://msdn.microsoft.com/en-us/library/bb347013(VS.95).aspx).<p>posted by ChannelFennel</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634294327390000000</link>
		<pubDate>Fri, 31 Dec 2010 22:52:19 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634294327390000000</guid>
		<dc:creator>ChannelFennel</dc:creator>
	</item>
	<item>
		<title>Re: Tombstoning and Task Switching - Day 3 - Part 8</title>
		<description>
			<![CDATA[ <p>great video, thanks.</p><p>posted by Mintydog</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634309861200000000</link>
		<pubDate>Tue, 18 Jan 2011 22:22:00 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634309861200000000</guid>
		<dc:creator>Mintydog</dc:creator>
	</item>
	<item>
		<title>Re: Tombstoning and Task Switching - Day 3 - Part 8</title>
		<description>
			<![CDATA[ <p>A very useful video but I have a question: I got the impression from the diagram on the link</p><p><a href="<a href="http://msdn.microsoft.com/en-us/library/ff817008(v=VS.92">http&#58;&#47;&#47;msdn.microsoft.com&#47;en-us&#47;library&#47;ff817008&#40;v&#61;VS.92</a>).aspx"><a href="http://msdn.microsoft.com/en-us/library/ff817008(v=VS.92">http&#58;&#47;&#47;msdn.microsoft.com&#47;en-us&#47;library&#47;ff817008&#40;v&#61;VS.92</a>).aspx</a>&nbsp;which is part of the instructions for&nbsp;submission that we are not &quot;allowed&quot; to run any code in the lauch event handler. This is the best place to run the LoadState() code as it is only done once. Are you able to clarify?</p><p>Dani.</p><p>posted by Dani50</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634324129350000000</link>
		<pubDate>Fri, 04 Feb 2011 10:42:15 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634324129350000000</guid>
		<dc:creator>Dani50</dc:creator>
	</item>
	<item>
		<title>Re: Tombstoning and Task Switching - Day 3 - Part 8</title>
		<description>
			<![CDATA[ <p>Very good! very simple and useful. Thanks a lot!&nbsp;</p><p>posted by minompi</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634336264580000000</link>
		<pubDate>Fri, 18 Feb 2011 11:47:38 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634336264580000000</guid>
		<dc:creator>minompi</dc:creator>
	</item>
	<item>
		<title>Re: Tombstoning and Task Switching - Day 3 - Part 8</title>
		<description>
			<![CDATA[I have tried this with the Simple Note application, which is the homework of day 3.<br /><br />But whenever I press the start button, the app crashes and an error appears in the c# code.<br />I have tried the code of dwrogers, and it doesn't do anything at all.<br />So, is there any solution, as this is vital to me?.<p>posted by Charlie</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634350591380000000</link>
		<pubDate>Mon, 07 Mar 2011 01:45:38 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634350591380000000</guid>
		<dc:creator>Charlie</dc:creator>
	</item>
	<item>
		<title>Re: Tombstoning and Task Switching - Day 3 - Part 8</title>
		<description>
			<![CDATA[ <p>Got this to work on my second attempt! One of the harder lessons so far.</p><p>posted by WayneHoggett</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634387202180000000</link>
		<pubDate>Mon, 18 Apr 2011 10:43:38 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634387202180000000</guid>
		<dc:creator>WayneHoggett</dc:creator>
	</item>
	<item>
		<title>Re: Tombstoning and Task Switching - Day 3 - Part 8</title>
		<description>
			<![CDATA[I think I&#39;ve done exactly as Bob instructed, but when I type something in the text box, tap the Windows key and then return to the application, the text has gone. Same with the Back key. Can&#39;t figure out what the difference could be.<p>posted by Vesku</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634417501600000000</link>
		<pubDate>Mon, 23 May 2011 12:22:40 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634417501600000000</guid>
		<dc:creator>Vesku</dc:creator>
	</item>
	<item>
		<title>Re: Tombstoning and Task Switching - Day 3 - Part 8</title>
		<description>
			<![CDATA[ <p>Hi, here is the way how to have the testing device always set to Emulator.</p><p><a href="http://www.pchenry.com/Home/tabid/36/EntryId/412/Tired-of-ALWAYS-having-to-change-to-the-WP7-emulator-in-Visual-Studio.aspx ">http&#58;&#47;&#47;www.pchenry.com&#47;Home&#47;tabid&#47;36&#47;EntryId&#47;412&#47;Tired-of-ALWAYS-having-to-change-to-the-WP7-emulator-in-Visual-Studio.aspx&#160;</a></p><p>posted by MartinCZ</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634494578070000000</link>
		<pubDate>Sat, 20 Aug 2011 17:23:27 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634494578070000000</guid>
		<dc:creator>MartinCZ</dc:creator>
	</item>
	<item>
		<title>Re: Tombstoning and Task Switching - Day 3 - Part 8</title>
		<description>
			<![CDATA[<p><img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif?v=c9' alt='Smiley' /></p><p>posted by golnazal</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634683947229766656</link>
		<pubDate>Mon, 26 Mar 2012 21:38:42 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634683947229766656</guid>
		<dc:creator>golnazal</dc:creator>
	</item>
	<item>
		<title>Re: Tombstoning and Task Switching - Day 3 - Part 8</title>
		<description>
			<![CDATA[I came across to the same problem of Vesku &#40;May 23, 2011 at 5&#58;22 AM&#41; and I &#40;not easily&#41; solved it. Shortly, the line of code<br><br>if &#40;phoneAppService.State.ContainsKey&#40;&#34;MyValue&#34;&#41;&#41;<br><br>in the LoadState&#40;&#41; method should be commented &#40;or deleted&#41;. This solves the problem. I know the app in the video works but it can be easily a bug that has been corrected with the newest releases of Silverlight or whatsoever.<p>posted by Atcold</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634683953257789792</link>
		<pubDate>Mon, 26 Mar 2012 21:48:45 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Tombstoning-and-Task-Switching#c634683953257789792</guid>
		<dc:creator>Atcold</dc:creator>
	</item>
</channel>
</rss>