<?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>MxMxM</title>
	<atom:link href="http://www.mxmxm.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mxmxm.com</link>
	<description>Make App for Windows Phone</description>
	<lastBuildDate>Thu, 26 Apr 2012 12:54:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>使用Marketplace Test Kit 解决录制视频AG_E_UNKNOWN_ERROR错误</title>
		<link>http://www.mxmxm.com/using-marketplace-test-kit-ag_e_unknown_error.html</link>
		<comments>http://www.mxmxm.com/using-marketplace-test-kit-ag_e_unknown_error.html#comments</comments>
		<pubDate>Sat, 10 Dec 2011 13:08:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.mxmxm.com/?p=456</guid>
		<description><![CDATA[在应用中需要用摄像头拍摄视频，在WMAppManifest.xml中加入使用到的应用程序功能ID_CAP_ISV_CAMERA摄像头和”ID_CAP_MICROPHONE麦克风： &#160; &#160; &#60;Capabilities&#62; &#160; &#160; &#160; &#60;Capability Name=&#34;ID_CAP_MEDIALIB&#34; /&#62; &#160; &#160; &#160; &#60;Capability Name=&#34;ID_CAP_MICROPHONE&#34;/&#62; &#160; &#160; &#160; &#60;Capability Name=&#34;ID_CAP_ISV_CAMERA&#34;/&#62; &#160; &#160; &#160; &#60;Capability Name=&#34;ID_CAP_NETWORKING&#34;/&#62; &#160; &#160; &#160; &#60;Capability Name=&#34;ID_CAP_PHONEDIALER&#34; /&#62; &#160; &#160; &#60;/Capabilities&#62; 其他具体实现过程参考Record Video in a Camera Application &#8230; <a href="http://www.mxmxm.com/using-marketplace-test-kit-ag_e_unknown_error.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<li>在应用中需要用摄像头拍摄视频，在WMAppManifest.xml中加入使用到的应用程序功能ID_CAP_ISV_CAMERA摄像头和”ID_CAP_MICROPHONE麦克风：</li>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #008000;">&lt;</span>Capabilities<span style="color: #008000;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000;">&lt;</span>Capability Name<span style="color: #008000;">=</span><span style="color: #666666;">&quot;ID_CAP_MEDIALIB&quot;</span> <span style="color: #008000;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000;">&lt;</span>Capability Name<span style="color: #008000;">=</span><span style="color: #666666;">&quot;ID_CAP_MICROPHONE&quot;</span><span style="color: #008000;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000;">&lt;</span>Capability Name<span style="color: #008000;">=</span><span style="color: #666666;">&quot;ID_CAP_ISV_CAMERA&quot;</span><span style="color: #008000;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000;">&lt;</span>Capability Name<span style="color: #008000;">=</span><span style="color: #666666;">&quot;ID_CAP_NETWORKING&quot;</span><span style="color: #008000;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000;">&lt;</span>Capability Name<span style="color: #008000;">=</span><span style="color: #666666;">&quot;ID_CAP_PHONEDIALER&quot;</span> <span style="color: #008000;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&lt;/</span>Capabilities<span style="color: #008000;">&gt;</span></div></div>
<li>
其他具体实现过程参考<a href="http://msdn.microsoft.com/en-us/library/hh394041(v=VS.92).aspx" title="Record Video in a Camera Application for Windows Phone" target="_blank">Record Video in a Camera Application for Windows Phone</a>来完成。</li>
<li>完成后，使用模拟器和HD7调试，记录视频和声音都正常。提交程序到Marketplace, 经过了漫长的等待，程序通过验证正常发布，发布以后有用户反映无法录制视频，显示：AG_E_UNKNOWN_ERROR。<span id="more-456"></span>
<li>经过使用不同型号机器部署xap文件和从市场下载反复测试。直接部署xap文件到手机正常，从marketplace下载的程序录制视频会显示AG_E_UNKNOWN_ERROR。</li>
<p>看来问题出在了认证过程。到App Hub查看程序用到的功能显示如下：</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Required Device capabilities<span style="color: #008000;">:</span><br />
data services <br />
music and video library <br />
phone calls <br />
Silverlight framework <br />
camera <br />
trial <br />
background transfer service <br />
camera</div></div>
<p>出现了两次camera,但是没有microphone.看来这就是为什么从市场下载的程序无法录制视频的原因。</li>
<li>
随后查阅程序认证过程，原来，提交应用之后，微软会用工具检测程序的Capabilities，即使在WMAppManifest.xml中加入了相应的Capability，如果程序中没有使用到，相应的Capability会被删除。</li>
<li>使用marketplace test kit 测试:右键点项目->Open marketplace test kit->Automated Tests ->Run Test。测试结束后Capability Validation结果如下：</li>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #008000;">&#91;</span>INFORMATION<span style="color: #008000;">&#93;</span><span style="color: #008000;">:</span>Capabilities used by application<span style="color: #008000;">:</span><br />
ID_CAP_NETWORKING &nbsp; <br />
ID_CAP_ISV_CAMERA &nbsp;<br />
ID_CAP_MEDIALIB <br />
ID_CAP_PHONEDIALER<span style="color: #008000;">.</span></div></div>
<li>里面并不包含ID_CAP_MICROPHONE。既然你检测不到我录制视频的过程需要录音，那就告诉marketplace test kit,我确实要用到MICROPHONE，添加以下代码：</li>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.Xna.Framework.Audio</span><span style="color: #008000;">;</span><br />
<br />
Microphone _mic <span style="color: #008000;">=</span> Microphone<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Default</span><span style="color: #008000;">;</span></div></div>
<li>
再用marketplace test kit 测试，显示用到了ID_CAP_MICROPHONE。</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #008000;">&#91;</span>INFORMATION<span style="color: #008000;">&#93;</span><span style="color: #008000;">:</span>Capabilities used by application<span style="color: #008000;">:</span><br />
ID_CAP_NETWORKING &nbsp;<br />
ID_CAP_MICROPHONE <br />
ID_CAP_ISV_CAMERA &nbsp;<br />
ID_CAP_MEDIALIB <br />
ID_CAP_PHONEDIALER<span style="color: #008000;">.</span></div></div>
<p>重新提交程序更新到marketplace，下载使用，录制视频和声音正常。</li>
]]></content:encoded>
			<wfw:commentRss>http://www.mxmxm.com/using-marketplace-test-kit-ag_e_unknown_error.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>别让你的WP7应用启动速度超过5秒</title>
		<link>http://www.mxmxm.com/%e5%88%ab%e8%ae%a9%e4%bd%a0%e7%9a%84%e5%ba%94%e7%94%a8%e5%90%af%e5%8a%a8%e9%80%9f%e5%ba%a6%e8%b6%85%e8%bf%875%e7%a7%92.html</link>
		<comments>http://www.mxmxm.com/%e5%88%ab%e8%ae%a9%e4%bd%a0%e7%9a%84%e5%ba%94%e7%94%a8%e5%90%af%e5%8a%a8%e9%80%9f%e5%ba%a6%e8%b6%85%e8%bf%875%e7%a7%92.html#comments</comments>
		<pubDate>Mon, 29 Aug 2011 13:41:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Window Phone 7]]></category>
		<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.mxmxm.com/?p=384</guid>
		<description><![CDATA[最近在调试一个Windows Phone 7的应用，在模拟器和真机上联机调试正常。部署到真机实际使用时，偶尔会发现程序在启动时自动退出。后来在程序中加入了启动时的debug信息发现，如果启动时间超过5秒，程序会自动退出。原来，我的应用需要在每天第一次启动时整理数据，删除过期的数据。有时由于过期数据量大而导致启动时间超过5秒。 查阅windows phone 7认证要求, 在《Windows Phone 7 Application Certification Requirements》的5.2.1 Launch Time中写到 The application must render the first screen within 5 seconds after launch.应用程序在启动后5秒之内必须显示第一个页面(这个第一个页面不是Splash Image). The application may provide a splash screen image in a file called SplashScreenImage.jpg &#8230; <a href="http://www.mxmxm.com/%e5%88%ab%e8%ae%a9%e4%bd%a0%e7%9a%84%e5%ba%94%e7%94%a8%e5%90%af%e5%8a%a8%e9%80%9f%e5%ba%a6%e8%b6%85%e8%bf%875%e7%a7%92.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>最近在调试一个Windows Phone 7的应用，在模拟器和真机上联机调试正常。部署到真机实际使用时，偶尔会发现程序在启动时自动退出。后来在程序中加入了启动时的debug信息发现，如果启动时间超过5秒，程序会自动退出。原来，我的应用需要在每天第一次启动时整理数据，删除过期的数据。有时由于过期数据量大而导致启动时间超过5秒。<br />
查阅windows phone 7认证要求, 在《<a title="Windows Phone 7 Application Certification Requirements" href="http://msdn.microsoft.com/en-us/library/hh184840(v=VS.92).aspx" target="_blank">Windows Phone 7 Application Certification Requirements</a>》的5.2.1 Launch Time中写到</p>
<ul>
<li>The application must render the first screen within 5 seconds after launch.<em><strong>应用程序在启动后5秒之内必须显示第一个页面</strong></em>(这个第一个页面不是Splash Image).</li>
<li>The application may provide a splash screen image in a file called SplashScreenImage.jpg in the root of the XAP package while the application is still trying to load.</li>
<li>Within 20 seconds after launch, the application must be responsive to user input(应用在启动20秒之内能够开始响应用户操作).</li>
</ul>
<p>也就是说，我的应用有时启动时会超过5秒，系统自动阻止了程序的启动。<br />
查阅MSDN文档Windows Phone 性能<a title="Performance Considerations in Applications for Windows Phone" href="http://msdn.microsoft.com/en-us/library/ff967560(v=VS.92).aspx" target="_blank">Performance Considerations in Applications for Windows Phone</a>，在应用程序启动<a title="Application Startup " href="http://msdn.microsoft.com/en-us/library/ff967560(v=VS.92).aspx#BKMK_Startup" target="_blank">Application Startup</a>一节中找到了解决方案：<span id="more-384"></span></p>
<p><em><strong>即启动一个新线程执行耗时的操作：</strong></em></p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Threading</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> OnNavigatedTo<span style="color: #008000;">&#40;</span><span style="color: #000000;">System</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Windows</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Navigation</span><span style="color: #008000;">.</span><span style="color: #0000FF;">NavigationEventArgs</span> e<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
<span style="color: #008080; font-style: italic;">//在一个新线程中进行耗时操作，让UI界面能够响应用户操作</span><br />
<span style="color: #000000;">System.<span style="color: #0000FF;">Threading</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Thread</span> startupThread <span style="color: #008000;">=</span><br />
<span style="color: #008000;">new</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Threading</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Thread</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Threading</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">ThreadStart</span><span style="color: #008000;">&#40;</span>initializePage<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
startupThread<span style="color: #008000;">.</span><span style="color: #0000FF;">Start</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span><br />
<span style="color: #6666cc; font-weight: bold;">void</span> initializePage<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
<span style="color: #008080; font-style: italic;">// 耗时操作代码...</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p><em><strong>   还有一个方法就是在后台执行一些耗时的初始化，执行完毕后在主线程中更新UI.</strong></em></p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Threading</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.ComponentModel</span><span style="color: #008000;">;</span><br />
BackgroundWorker backgroundWorker <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> BackgroundWorker<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
backgroundWorker<span style="color: #008000;">.</span><span style="color: #0000FF;">DoWork</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">&#40;</span>s,e<span style="color: #008000;">&#41;</span> <span style="color: #008000;">=&amp;</span>gt<span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#123;</span><br />
<span style="color: #008080; font-style: italic;">// 启动一个后台线程</span><br />
<span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span><br />
backgroundWorker<span style="color: #008000;">.</span><span style="color: #0000FF;">RunWorkerCompleted</span> <span style="color: #008000;">+=</span><br />
<span style="color: #008000;">&#40;</span>s, e<span style="color: #008000;">&#41;</span> <span style="color: #008000;">=&amp;</span>gt<span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#123;</span><br />
<span style="color: #008080; font-style: italic;">// 后台线程结束后，还需要执行的操作</span><br />
Deployment<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Dispatcher</span><span style="color: #008000;">.</span><span style="color: #0000FF;">BeginInvoke</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">=&amp;</span>gt<span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#123;</span><br />
<span style="color: #008080; font-style: italic;">//这段代码用于更新UI等需要在主线程中进行的操作</span><br />
<span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span><br />
backgroundWorker<span style="color: #008000;">.</span><span style="color: #0000FF;">RunWorkerAsync</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.mxmxm.com/%e5%88%ab%e8%ae%a9%e4%bd%a0%e7%9a%84%e5%ba%94%e7%94%a8%e5%90%af%e5%8a%a8%e9%80%9f%e5%ba%a6%e8%b6%85%e8%bf%875%e7%a7%92.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>国外WP7应用牛人不调用SmsComposerTask启动器直接发短信</title>
		<link>http://www.mxmxm.com/%e5%9b%bd%e5%a4%96wp7%e5%ba%94%e7%94%a8%e7%89%9b%e4%ba%ba%e4%b8%8d%e8%b0%83%e7%94%a8smscomposertask%e5%90%af%e5%8a%a8%e5%99%a8%e7%9b%b4%e6%8e%a5%e5%8f%91%e7%9f%ad%e4%bf%a1.html</link>
		<comments>http://www.mxmxm.com/%e5%9b%bd%e5%a4%96wp7%e5%ba%94%e7%94%a8%e7%89%9b%e4%ba%ba%e4%b8%8d%e8%b0%83%e7%94%a8smscomposertask%e5%90%af%e5%8a%a8%e5%99%a8%e7%9b%b4%e6%8e%a5%e5%8f%91%e7%9f%ad%e4%bf%a1.html#comments</comments>
		<pubDate>Fri, 22 Jul 2011 14:11:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Window Phone 7]]></category>
		<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://mxmxm.com/?p=379</guid>
		<description><![CDATA[Dennis Delimarsky是一位90后的学生程序员，向著名的Coding4Fun贡献代码。在他的博客中展示了一个方法：不调用SmsComposerTask,直接在Dell Venue Pro上通过自己的应用发送短信。 在Windows phone设备上第三方应用需要发送短信时, 必须通过SmsComposerTask启动器，让用户知道应用需要发送短信，由用户来确认是否进行发送。在Android平台上，系统可以不经用户允许在后台发送短信，这也就是android平台需要杀毒软件的部分原因。 但是在WP7中，发送短信的SmsComposerTask需要调用系统组件（短信组件）。这就存在一个默认的系统请求，这允许开发者在用户不知情的情况下通过应用本身发送短信。这就给了不良应用有可乘之机。好在目前这个方法只适用于Dell Venue Pro. 具体的实现方法见《Sending text messages from a Dell Venue Pro. Directly from the app and without SmsComposerTask.》]]></description>
			<content:encoded><![CDATA[<p><a title="Den by default" href="http://dennisdel.com/" target="_blank">Dennis Delimarsky</a>是一位90后的学生程序员，向著名的<a title="Coding4fun" href="http://channel9.msdn.com/coding4fun" target="_blank">Coding4Fun</a>贡献代码。在他的博客中展示了一个方法：不调用SmsComposerTask,直接在Dell Venue Pro上通过自己的应用发送短信。<a href="http://mxmxm.com/wp-content/uploads/2011/07/dell.jpg"><img class="alignright size-full wp-image-380" title="dell" src="http://mxmxm.com/wp-content/uploads/2011/07/dell.jpg" alt="" width="233" height="217" /></a><br />
在Windows phone设备上第三方应用需要发送短信时, 必须通过SmsComposerTask启动器，让用户知道应用需要发送短信，由用户来确认是否进行发送。在Android平台上，系统可以不经用户允许在后台发送短信，这也就是android平台需要杀毒软件的部分原因。<br />
但是在WP7中，发送短信的SmsComposerTask需要调用系统组件（短信组件）。这就存在一个默认的系统请求，这允许开发者在用户不知情的情况下通过应用本身发送短信。这就给了不良应用有可乘之机。好在目前这个方法只适用于Dell Venue Pro.</p>
<p>具体的实现方法见《<a href="http://dennisdel.com/?p=863"  target="_blank">Sending text messages from a Dell Venue Pro. Directly from the app and without SmsComposerTask.</a>》</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mxmxm.com/%e5%9b%bd%e5%a4%96wp7%e5%ba%94%e7%94%a8%e7%89%9b%e4%ba%ba%e4%b8%8d%e8%b0%83%e7%94%a8smscomposertask%e5%90%af%e5%8a%a8%e5%99%a8%e7%9b%b4%e6%8e%a5%e5%8f%91%e7%9f%ad%e4%bf%a1.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WP7.0应用转换到WP7.1后独立存储区多出一个目录Transfers</title>
		<link>http://www.mxmxm.com/wp7-0%e5%ba%94%e7%94%a8%e8%bd%ac%e6%8d%a2%e5%88%b0wp7-1%e5%90%8e%e7%8b%ac%e7%ab%8b%e5%ad%98%e5%82%a8%e5%8c%ba%e5%a4%9a%e5%87%ba%e4%b8%80%e4%b8%aa%e7%9b%ae%e5%bd%95transfers.html</link>
		<comments>http://www.mxmxm.com/wp7-0%e5%ba%94%e7%94%a8%e8%bd%ac%e6%8d%a2%e5%88%b0wp7-1%e5%90%8e%e7%8b%ac%e7%ab%8b%e5%ad%98%e5%82%a8%e5%8c%ba%e5%a4%9a%e5%87%ba%e4%b8%80%e4%b8%aa%e7%9b%ae%e5%bd%95transfers.html#comments</comments>
		<pubDate>Fri, 03 Jun 2011 12:49:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Window Phone 7]]></category>
		<category><![CDATA[mango]]></category>
		<category><![CDATA[独立存储]]></category>

		<guid isPermaLink="false">http://mxmxm.com/?p=371</guid>
		<description><![CDATA[我有一个应用，需要在独立存储区建立几个目录，然后再目录中存入文件，在WP7.1开发工具发布之前，通过模拟器和真机调试都没有问题。安装了WP7.1的开发工具后，打开这个应用，在模拟器上调试时出错，通过下断点发现，在独立存储区的目录多了一个目录Transfers,见下图: 。 ====================== 如果是直接使用WP7.1的开发工具直接建立项目，独立存储区则没有这个目录，见下图: 通过查看文档，原来这个目录是后台传输文件的默认目录]]></description>
			<content:encoded><![CDATA[<p>我有一个应用，需要在独立存储区建立几个目录，然后再目录中存入文件，在WP7.1开发工具发布之前，通过模拟器和真机调试都没有问题。安装了WP7.1的开发工具后，打开这个应用，在模拟器上调试时出错，通过下断点发现，在独立存储区的目录多了一个目录Transfers,见下图:<br />
<a href="http://mxmxm.com/wp-content/uploads/2011/06/wp7.0isolate.gif"><img class="alignright size-full wp-image-372" title="wp7.0isolate" src="http://mxmxm.com/wp-content/uploads/2011/06/wp7.0isolate.gif" alt="" width="550" height="172" /></a>。<br />
======================<br />
如果是直接使用WP7.1的开发工具直接建立项目，独立存储区则没有这个目录，见下图:<br />
<a href="http://mxmxm.com/wp-content/uploads/2011/06/wp7.1isolate.gif"><img class="alignright size-full wp-image-373" title="wp7.1isolate" src="http://mxmxm.com/wp-content/uploads/2011/06/wp7.1isolate.gif" alt="" width="603" height="162" /></a><br />
通过查看文档，原来这个目录是后台传输文件的默认目录</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mxmxm.com/wp7-0%e5%ba%94%e7%94%a8%e8%bd%ac%e6%8d%a2%e5%88%b0wp7-1%e5%90%8e%e7%8b%ac%e7%ab%8b%e5%ad%98%e5%82%a8%e5%8c%ba%e5%a4%9a%e5%87%ba%e4%b8%80%e4%b8%aa%e7%9b%ae%e5%bd%95transfers.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>让WP7应用支持中文等多国语言的方法</title>
		<link>http://www.mxmxm.com/%e8%ae%a9wp7%e5%ba%94%e7%94%a8%e6%94%af%e6%8c%81%e4%b8%ad%e6%96%87%e7%ad%89%e5%a4%9a%e5%9b%bd%e8%af%ad%e8%a8%80.html</link>
		<comments>http://www.mxmxm.com/%e8%ae%a9wp7%e5%ba%94%e7%94%a8%e6%94%af%e6%8c%81%e4%b8%ad%e6%96%87%e7%ad%89%e5%a4%9a%e5%9b%bd%e8%af%ad%e8%a8%80.html#comments</comments>
		<pubDate>Thu, 12 May 2011 04:46:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Window Phone 7]]></category>
		<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://mxmxm.com/?p=359</guid>
		<description><![CDATA[在微软msdn有让windows phone 7 支持多语言的官方教程How to: Build a Localized Application for Windows Phone，只要按照这个设定好多语言资源文件(AppResources.语言.resx)后，在手机上，用户选择不同的系统语言，你的应用语言就会自动切换。但是目前由于WP7手机不支持中文,即使有AppResources.zh-CN.resx文件，应用也没有办法切换到中文。有一个办法就是在应用启动的时候，让应用强制认为现在的系统语言是中文，在App.xaml.cs中修改以下代码： private void Application_Launching&#40;object sender, LaunchingEventArgs e&#41; &#160; &#160; &#160; &#160; &#123; &#160; &#160; &#160; &#160; &#160; Thread.CurrentThread.CurrentCulture = new CultureInfo&#40;&#34;zh-CN&#34;&#41;; &#160; &#160; &#160; &#160; &#160; Thread.CurrentThread.CurrentUICulture = new &#8230; <a href="http://www.mxmxm.com/%e8%ae%a9wp7%e5%ba%94%e7%94%a8%e6%94%af%e6%8c%81%e4%b8%ad%e6%96%87%e7%ad%89%e5%a4%9a%e5%9b%bd%e8%af%ad%e8%a8%80.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>在微软msdn有让windows phone 7 支持多语言的官方教程<a href="http://msdn.microsoft.com/en-us/library/ff637520(v=vs.92).aspx" target="_blank">How to: Build a Localized Application for Windows Phone</a>，只要按照这个设定好多语言资源文件(AppResources.语言.resx)后，在手机上，用户选择不同的系统语言，你的应用语言就会自动切换。但是目前由于WP7手机不支持中文,即使有AppResources.zh-CN.resx文件，应用也没有办法切换到中文。有一个办法就是在应用启动的时候，让应用强制认为现在的系统语言是中文，在App.xaml.cs中修改以下代码：</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> Application_Launching<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, LaunchingEventArgs e<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentThread</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentCulture</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> CultureInfo<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;zh-CN&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentThread</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentUICulture</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> CultureInfo<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;zh-CN&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #008080; font-style: italic;">//让应用使用AppResources.zh-CN.resx语言包, 并且按照中文语言格式来显示时间日期等</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span></div></div>
<p>这样，应用启动后就会显示为中文，但是要显示法语怎么办？<span id="more-359"></span><br />
在你的应用设置中，加入让用户选择语言的选项，之后再修改Application_Launching(object sender, LaunchingEventArgs e)如下：</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> Application_Launching<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, LaunchingEventArgs e<span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;IsolatedStorageSettings userSettings <span style="color: #008000;">=</span> IsolatedStorageSettings<span style="color: #008000;">.</span><span style="color: #0000FF;">ApplicationSettings</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #6666cc; font-weight: bold;">string</span> lang<span style="color: #008000;">=</span><span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;lang <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#41;</span>userSettings<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;lang&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>lang <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;chs&quot;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentThread</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentCulture</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> CultureInfo<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;zh-CN&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentThread</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentUICulture</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> CultureInfo<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;zh-CN&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008080; font-style: italic;">//其他语言</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//默认使用英语来显示</span><br />
&nbsp; &nbsp;<span style="color: #008000;">&#125;</span></div></div>
<p>等到芒果熟了的时候，只需要把以上代码删除掉就行了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mxmxm.com/%e8%ae%a9wp7%e5%ba%94%e7%94%a8%e6%94%af%e6%8c%81%e4%b8%ad%e6%96%87%e7%ad%89%e5%a4%9a%e5%9b%bd%e8%af%ad%e8%a8%80.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>在Windows Phone7中取得屏幕截图</title>
		<link>http://www.mxmxm.com/%e5%9c%a8windows-phone7%e4%b8%ad%e5%8f%96%e5%be%97%e5%b1%8f%e5%b9%95%e6%88%aa%e5%9b%be.html</link>
		<comments>http://www.mxmxm.com/%e5%9c%a8windows-phone7%e4%b8%ad%e5%8f%96%e5%be%97%e5%b1%8f%e5%b9%95%e6%88%aa%e5%9b%be.html#comments</comments>
		<pubDate>Sat, 16 Apr 2011 06:23:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Window Phone 7]]></category>

		<guid isPermaLink="false">http://mxmxm.com/?p=306</guid>
		<description><![CDATA[分享一个取得屏幕截图的代码，但是由于程序不能在后台运行，所以只能通过按钮或者菜单取得截图,然后把图片保存在相册中。 public void CaptureScreen&#40;object sender, EventArgs e&#41; &#123; WriteableBitmap bmp = new WriteableBitmap&#40;480, 800&#41;; bmp.Render&#40;App.Current.RootVisual, null&#41;; bmp.Invalidate&#40;&#41;; MemoryStream stream = new MemoryStream&#40;&#41;; bmp.SaveJpeg&#40;stream, bmp.PixelWidth, bmp.PixelHeight, 0, 80&#41;; stream.Seek&#40;0, SeekOrigin.Begin&#41;; MediaLibrary library = new MediaLibrary&#40;&#41;; string filename = &#34;ScreenShot_&#34; + DateTime.Now.ToString&#40;&#34;yyyy-MM-dd_hh:mm:ss&#34;&#41;; &#8230; <a href="http://www.mxmxm.com/%e5%9c%a8windows-phone7%e4%b8%ad%e5%8f%96%e5%be%97%e5%b1%8f%e5%b9%95%e6%88%aa%e5%9b%be.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>分享一个取得屏幕截图的代码，但是由于程序不能在后台运行，所以只能通过按钮或者菜单取得截图,然后把图片保存在相册中。</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> CaptureScreen<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
WriteableBitmap bmp <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> WriteableBitmap<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">480</span>, <span style="color: #FF0000;">800</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
bmp<span style="color: #008000;">.</span><span style="color: #0000FF;">Render</span><span style="color: #008000;">&#40;</span>App<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">RootVisual</span>, <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
bmp<span style="color: #008000;">.</span><span style="color: #0000FF;">Invalidate</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
MemoryStream stream <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> MemoryStream<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
bmp<span style="color: #008000;">.</span><span style="color: #0000FF;">SaveJpeg</span><span style="color: #008000;">&#40;</span>stream, bmp<span style="color: #008000;">.</span><span style="color: #0000FF;">PixelWidth</span>, bmp<span style="color: #008000;">.</span><span style="color: #0000FF;">PixelHeight</span>, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">80</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
stream<span style="color: #008000;">.</span><span style="color: #0000FF;">Seek</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span>, SeekOrigin<span style="color: #008000;">.</span><span style="color: #0000FF;">Begin</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
MediaLibrary library <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> MediaLibrary<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #6666cc; font-weight: bold;">string</span> filename <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;ScreenShot_&quot;</span> <span style="color: #008000;">+</span> DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Now</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;yyyy-MM-dd_hh:mm:ss&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
library<span style="color: #008000;">.</span><span style="color: #0000FF;">SavePicture</span><span style="color: #008000;">&#40;</span>filename, stream<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
stream<span style="color: #008000;">.</span><span style="color: #0000FF;">Close</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.mxmxm.com/%e5%9c%a8windows-phone7%e4%b8%ad%e5%8f%96%e5%be%97%e5%b1%8f%e5%b9%95%e6%88%aa%e5%9b%be.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>提交WindowsPhone7应用失败原因分析及对策</title>
		<link>http://www.mxmxm.com/%e6%8f%90%e4%ba%a4windowsphone7%e5%ba%94%e7%94%a8%e5%a4%b1%e8%b4%a5%e5%8e%9f%e5%9b%a0%e5%88%86%e6%9e%90%e5%8f%8a%e5%af%b9%e7%ad%96.html</link>
		<comments>http://www.mxmxm.com/%e6%8f%90%e4%ba%a4windowsphone7%e5%ba%94%e7%94%a8%e5%a4%b1%e8%b4%a5%e5%8e%9f%e5%9b%a0%e5%88%86%e6%9e%90%e5%8f%8a%e5%af%b9%e7%ad%96.html#comments</comments>
		<pubDate>Thu, 31 Mar 2011 15:00:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[其他...]]></category>

		<guid isPermaLink="false">http://mxmxm.com/?p=266</guid>
		<description><![CDATA[在提交应用之前可以参考这篇文章《Windows Phone Marketplace发布攻略》 我提交了两个应用，失败了N次才成功，把失败经历分享一下： 1，back键问题，居然两个应用都碰到这个问题。有些应用在用户第一次启动时需要输入账号或者一些特定的设定页面，之后才进入主界面。可以参考Windows Phone7自动登录功能的实现方法来解决； 2，还是back键及如何退出程序的问题，我根据这篇文章如何退出你的程序加了一个退出按钮，结果微软说每次按这个按钮，程序会crash掉。最后我就又把这个退出按钮给取消了。老老实实按back退出。 下面这段代码是Matr提供的一个方法,用这段代码重写back键即可. BackKeyPress += new EventHandler&#40;Login_BackKeyPress&#41;; void Login_BackKeyPress&#40;object sender, System.ComponentModel.CancelEventArgs e&#41; &#123; //如果不是主界面跳转来的，不允许返回 if &#40;!NavigationContext.QueryString.ContainsKey&#40;“notfirst”&#41;&#41; &#123; throw new Exception&#40;“Quit”&#41;; &#125; &#125; 3,如果你的应用比较复杂，又有网络连接，你不知道你的应用什么时候会崩溃掉，根据微软要求，要在程序崩溃时友好的提醒用户，所以最好在App.xaml.cs中加入Application_UnhandledException下加入程序崩溃时的提示， if &#40;System.Diagnostics.Debugger.IsAttached&#41; &#160; &#160; &#160; &#160; &#160; &#160; &#123; &#160; &#160; &#160; &#8230; <a href="http://www.mxmxm.com/%e6%8f%90%e4%ba%a4windowsphone7%e5%ba%94%e7%94%a8%e5%a4%b1%e8%b4%a5%e5%8e%9f%e5%9b%a0%e5%88%86%e6%9e%90%e5%8f%8a%e5%af%b9%e7%ad%96.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>在提交应用之前可以参考这篇文章<a href="http://www.cnblogs.com/aawolf/archive/2010/12/17/1909266.html" target="_blank">《Windows Phone Marketplace发布攻略》</a><br />
我提交了两个应用，失败了N次才成功，把失败经历分享一下：<br />
1，back键问题，居然两个应用都碰到这个问题。有些应用在用户第一次启动时需要输入账号或者一些特定的设定页面，之后才进入主界面。可以参考<a href="http://mxmxm.com/?p=217" target="_blank">Windows Phone7自动登录功能的实现方法</a>来解决；<span id="more-266"></span><br />
2，还是back键及如何退出程序的问题，我根据这篇文章<a href="http://www.silverlightchina.net/html/zhuantixilie/winphone7/2010/1022/2830.html" target="_blank">如何退出你的程序</a>加了一个退出按钮，结果微软说每次按这个按钮，程序会crash掉。最后我就又把这个退出按钮给取消了。老老实实按back退出。<br />
下面这段代码是<a href="http://www.code84.com/" target="_blank">Matr</a>提供的一个方法,用这段代码重写back键即可.</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">BackKeyPress <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> EventHandler<span style="color: #008000;">&#40;</span>Login_BackKeyPress<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #6666cc; font-weight: bold;">void</span> Login_BackKeyPress<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, <span style="color: #000000;">System.<span style="color: #0000FF;">ComponentModel</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">CancelEventArgs</span> e<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
<span style="color: #008080; font-style: italic;">//如果不是主界面跳转来的，不允许返回</span><br />
<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span>NavigationContext<span style="color: #008000;">.</span><span style="color: #0000FF;">QueryString</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ContainsKey</span><span style="color: #008000;">&#40;</span>“notfirst”<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
<span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> Exception<span style="color: #008000;">&#40;</span>“Quit”<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>3,如果你的应用比较复杂，又有网络连接，你不知道你的应用什么时候会崩溃掉，根据微软要求，要在程序崩溃时友好的提醒用户，所以最好在App.xaml.cs中加入Application_UnhandledException下加入程序崩溃时的提示，</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000000;">System.<span style="color: #0000FF;">Diagnostics</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Debugger</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsAttached</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// An unhandled exception has occurred; break into the debugger</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">System.<span style="color: #0000FF;">Diagnostics</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Debugger</span><span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Break</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox<span style="color: #008000;">.</span><span style="color: #0000FF;">Show</span><span style="color: #008000;">&#40;</span>e<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;应用出错需要关闭&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<p>如果不用MessageBox也可以加入一个出错的页面来提醒用户反馈出错信息；<br />
如果不加入这些信息，那么你就祈祷你的应用在测试时不要崩溃掉。</p>
<p>4，在你的应用的主要页面中显示应用名称，不过我发现很多应用只有一个页面也没有名称居然也进入市场了，这个弹性太大了，就看你的运气了。</p>
<p>5，要有联系信息，网址或者email等，要让用户能够联系到你。我在应用中把网址和email写在了”关于”页面中，居然也被退回了，说是没有技术支持的联系方式。可能测试应用的人看不懂中文。</p>
<p>6, 其他补充：要考虑你的tilt173图标pin to start之后显示应用名称的和图标颜色是否协调，建议图标下方留白，最起码不要是浅色，因为在tilt图标下部显示的应用名称是白色的，国内某商城的应用pin to start之后就有这个问题，它的173图标背景是白色，根本看不到应用名称。</p>
<p>7 再补充一个：如果你的应用是全中文应用，请在提交的软件描述中加入一句”this app is only available in chinese”.不加这个有时也能通过审核，不过如果被拒就又要浪费4天时间了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mxmxm.com/%e6%8f%90%e4%ba%a4windowsphone7%e5%ba%94%e7%94%a8%e5%a4%b1%e8%b4%a5%e5%8e%9f%e5%9b%a0%e5%88%86%e6%9e%90%e5%8f%8a%e5%af%b9%e7%ad%96.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WP7中自定义错误重定向到错误页面的代码</title>
		<link>http://www.mxmxm.com/%e8%87%aa%e5%ae%9a%e4%b9%89%e9%94%99%e8%af%af%e9%87%8d%e5%ae%9a%e5%90%91%e4%bb%a3%e7%a0%81.html</link>
		<comments>http://www.mxmxm.com/%e8%87%aa%e5%ae%9a%e4%b9%89%e9%94%99%e8%af%af%e9%87%8d%e5%ae%9a%e5%90%91%e4%bb%a3%e7%a0%81.html#comments</comments>
		<pubDate>Tue, 08 Mar 2011 13:18:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Window Phone 7]]></category>

		<guid isPermaLink="false">http://mxmxm.com/?p=278</guid>
		<description><![CDATA[应用出错在所难免，如果出错后直接退出，会给用户莫名其妙的感觉。如果出错后重定向到另一个页面，询问用户是否发送出错信息给开发者。这样可以用来分析出错原因。 private void Application_UnhandledException&#40;object sender, ApplicationUnhandledExceptionEventArgs e&#41; &#160;&#123; &#160; &#160; if &#40;System.Diagnostics.Debugger.IsAttached&#41; &#160; &#160; &#123; &#160; &#160; &#160; &#160;System.Diagnostics.Debugger.Break&#40;&#41;; &#160; &#160; &#125; &#160; &#160; &#160;e.Handled = true; &#160; &#160; &#160;ErrorPage.Exception = e.ExceptionObject; &#160; &#160; &#160;&#40;RootVisual as Microsoft.Phone.Controls.PhoneApplicationFrame&#41;.Source = new Uri&#40;&#34;/XXX.xaml&#34;, &#8230; <a href="http://www.mxmxm.com/%e8%87%aa%e5%ae%9a%e4%b9%89%e9%94%99%e8%af%af%e9%87%8d%e5%ae%9a%e5%90%91%e4%bb%a3%e7%a0%81.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>应用出错在所难免，如果出错后直接退出，会给用户莫名其妙的感觉。如果出错后重定向到另一个页面，询问用户是否发送出错信息给开发者。这样可以用来分析出错原因。</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> Application_UnhandledException<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, ApplicationUnhandledExceptionEventArgs e<span style="color: #008000;">&#41;</span><br />
&nbsp;<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000000;">System.<span style="color: #0000FF;">Diagnostics</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Debugger</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsAttached</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">System.<span style="color: #0000FF;">Diagnostics</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Debugger</span><span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Break</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp;e<span style="color: #008000;">.</span><span style="color: #0000FF;">Handled</span> <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp;ErrorPage<span style="color: #008000;">.</span><span style="color: #0000FF;">Exception</span> <span style="color: #008000;">=</span> e<span style="color: #008000;">.</span><span style="color: #0000FF;">ExceptionObject</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #008000;">&#40;</span>RootVisual <span style="color: #0600FF; font-weight: bold;">as</span> Microsoft<span style="color: #008000;">.</span><span style="color: #0000FF;">Phone</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Controls</span><span style="color: #008000;">.</span><span style="color: #0000FF;">PhoneApplicationFrame</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Source</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Uri<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;/XXX.xaml&quot;</span>, UriKind<span style="color: #008000;">.</span><span style="color: #0000FF;">Relative</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//xxx.xaml就是重定向到的页面。可以是出错提示页，也可以是其他功能(比如让用户选择进入某一页面)。</span><br />
<span style="color: #008000;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.mxmxm.com/%e8%87%aa%e5%ae%9a%e4%b9%89%e9%94%99%e8%af%af%e9%87%8d%e5%ae%9a%e5%90%91%e4%bb%a3%e7%a0%81.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>在WP7程序中判断手机是否有网络连接</title>
		<link>http://www.mxmxm.com/%e5%9c%a8wp7%e7%a8%8b%e5%ba%8f%e4%b8%ad%e5%88%a4%e6%96%ad%e6%89%8b%e6%9c%ba%e6%98%af%e5%90%a6%e6%9c%89%e7%bd%91%e7%bb%9c%e8%bf%9e%e6%8e%a5.html</link>
		<comments>http://www.mxmxm.com/%e5%9c%a8wp7%e7%a8%8b%e5%ba%8f%e4%b8%ad%e5%88%a4%e6%96%ad%e6%89%8b%e6%9c%ba%e6%98%af%e5%90%a6%e6%9c%89%e7%bd%91%e7%bb%9c%e8%bf%9e%e6%8e%a5.html#comments</comments>
		<pubDate>Wed, 23 Feb 2011 13:57:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Window Phone 7]]></category>
		<category><![CDATA[Windows Phone7]]></category>
		<category><![CDATA[WP7]]></category>
		<category><![CDATA[应用]]></category>
		<category><![CDATA[开发]]></category>

		<guid isPermaLink="false">http://mxmxm.com/?p=256</guid>
		<description><![CDATA[在一些要用到网络连接的应用中，应该在应用启动时先判断是否有网络连接，如果有就更新数据，如果没有网络连接，就显示提示信息。就像twitter客户端那样。 首先加入命名空间 using System.Net.NetworkInformation; //判断网络连接的代码: if &#40;NetworkInterface.GetIsNetworkAvailable&#40;&#41;&#41; &#123; 有网络连接的代码 &#125; else &#123; 提示用户打开网络连接,或者读取之前客户端存储的数据&#125; //这段代码中使用到了NetworkInterface这个Class中的GetIsNetworkAvailable()方法; 具体可参考msdn: NetworkInterface http://msdn.microsoft.com/en-us/library/k056bfdz(v=VS.95).aspx System.Net.NetworkInformationhttp://msdn.microsoft.com/en-us/library/system.net.networkinformation(v=VS.95).aspx]]></description>
			<content:encoded><![CDATA[<p>在一些要用到网络连接的应用中，应该在应用启动时先判断是否有网络连接，如果有就更新数据，如果没有网络连接，就显示提示信息。就像twitter客户端那样。<br />
首先加入命名空间</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Net.NetworkInformation</span><span style="color: #008000;">;</span><br />
<span style="color: #008080; font-style: italic;">//判断网络连接的代码:</span><br />
<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>NetworkInterface<span style="color: #008000;">.</span><span style="color: #0000FF;">GetIsNetworkAvailable</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span> 有网络连接的代码 <span style="color: #008000;">&#125;</span><br />
<span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #008000;">&#123;</span> 提示用户打开网络连接,或者读取之前客户端存储的数据<span style="color: #008000;">&#125;</span><br />
<span style="color: #008080; font-style: italic;">//这段代码中使用到了NetworkInterface这个Class中的GetIsNetworkAvailable()方法;</span></div></div>
<p>具体可参考msdn:<br />
NetworkInterface <a href="http://msdn.microsoft.com/en-us/library/k056bfdz(v=VS.95).aspx" target="_blank">http://msdn.microsoft.com/en-us/library/k056bfdz(v=VS.95).aspx</a><br />
System.Net.NetworkInformation<a href="http://msdn.microsoft.com/en-us/library/system.net.networkinformation(v=VS.95).aspx" target="_blank">http://msdn.microsoft.com/en-us/library/system.net.networkinformation(v=VS.95).aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mxmxm.com/%e5%9c%a8wp7%e7%a8%8b%e5%ba%8f%e4%b8%ad%e5%88%a4%e6%96%ad%e6%89%8b%e6%9c%ba%e6%98%af%e5%90%a6%e6%9c%89%e7%bd%91%e7%bb%9c%e8%bf%9e%e6%8e%a5.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Windows Phone7如何开发分享图片的插件</title>
		<link>http://www.mxmxm.com/windows-phone7%e5%a6%82%e4%bd%95%e5%bc%80%e5%8f%91%e5%88%86%e4%ba%ab%e5%9b%be%e7%89%87%e7%9a%84%e6%8f%92%e4%bb%b6.html</link>
		<comments>http://www.mxmxm.com/windows-phone7%e5%a6%82%e4%bd%95%e5%bc%80%e5%8f%91%e5%88%86%e4%ba%ab%e5%9b%be%e7%89%87%e7%9a%84%e6%8f%92%e4%bb%b6.html#comments</comments>
		<pubDate>Sat, 19 Feb 2011 13:31:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Window Phone 7]]></category>
		<category><![CDATA[Picture Hub]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WP7]]></category>
		<category><![CDATA[插件]]></category>

		<guid isPermaLink="false">http://mxmxm.com/?p=225</guid>
		<description><![CDATA[在WP7的picture hub中，选中一张图片,查看图片时，点击“&#8230;”菜单，点extras&#8230;时，会出现一个菜单(这个菜单中就是可以对选中的图片进行分享或者处理的应用列表,参见http://mxmxm.com/?page_id=174),如何实现这个一键分享功能： 1 在你的应用中新建一个文件Extras.xml； &#60;Extras&#62; &#160; &#60;PhotosExtrasApplication&#62; &#160; &#160; &#60;Enabled&#62;true&#60;/Enabled&#62; &#160; &#60;/PhotosExtrasApplication&#62; &#60;/Extras&#62; 2 打开MainPage.xaml.cs，添加以下的namespace using System.Windows.Media.Imaging; using Microsoft.Phone; using System.IO; using Microsoft.Xna.Framework.Media; using System.Windows.Navigation; 3 通过以上两步，你的应用就会出现在extras&#8230;中了，但是如何处理选中的图片呢，实际上，从extras&#8230;中启动你的应用时，图片会通过导航参数“token”传递给你的应用程序.得到该图片示例如下: if &#40;queryStrings.ContainsKey&#40;&#34;token&#34;&#41;&#41; &#123; MediaLibrary library = new MediaLibrary&#40;&#41;; Picture picture = library.GetPictureFromToken&#40;queryStrings&#91;&#34;token&#34;&#93;&#41;; BitmapImage &#8230; <a href="http://www.mxmxm.com/windows-phone7%e5%a6%82%e4%bd%95%e5%bc%80%e5%8f%91%e5%88%86%e4%ba%ab%e5%9b%be%e7%89%87%e7%9a%84%e6%8f%92%e4%bb%b6.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>在WP7的picture hub中，选中一张图片,查看图片时，点击“&#8230;”菜单，点extras&#8230;时，会出现一个菜单(这个菜单中就是可以对选中的图片进行分享或者处理的应用列表,参见<a href="http://mxmxm.com/?page_id=174" target="_blank">http://mxmxm.com/?page_id=174</a>),如何实现这个一键分享功能：<br />
1 在你的应用中新建一个文件Extras.xml；</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Extras<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PhotosExtrasApplication<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Enabled<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Enabled<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/PhotosExtrasApplication<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Extras<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>2 打开MainPage.xaml.cs，添加以下的namespace</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Windows.Media.Imaging</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.Phone</span><span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.IO</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.Xna.Framework.Media</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Windows.Navigation</span><span style="color: #008000;">;</span></div></div>
<p><span id="more-225"></span><br />
3 通过以上两步，你的应用就会出现在extras&#8230;中了，但是如何处理选中的图片呢，实际上，从extras&#8230;中启动你的应用时，图片会通过导航参数“token”传递给你的应用程序.得到该图片示例如下:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>queryStrings<span style="color: #008000;">.</span><span style="color: #0000FF;">ContainsKey</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;token&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
MediaLibrary library <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> MediaLibrary<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
Picture picture <span style="color: #008000;">=</span> library<span style="color: #008000;">.</span><span style="color: #0000FF;">GetPictureFromToken</span><span style="color: #008000;">&#40;</span>queryStrings<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;token&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
BitmapImage bitmap <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> BitmapImage<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
bitmap<span style="color: #008000;">.</span><span style="color: #0000FF;">SetSource</span><span style="color: #008000;">&#40;</span>picture<span style="color: #008000;">.</span><span style="color: #0000FF;">GetImage</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
WriteableBitmap picLibraryImage <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> WriteableBitmap<span style="color: #008000;">&#40;</span>bitmap<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #008080; font-style: italic;">//选中的图片就存在picLibrayImage中了，根据你的需要来处理picLibrayImage就行了</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>4 实际上，你的应用默认可能启动的是MainPage.xmal页面，如果从extras&#8230;菜单中启动时，你可能需要启动另一个页面(假设是PicShare.xmal)来直接分享或者处理选中的图片,如何实现呢？你可以在App.xaml.cs中判断是否存在token导航参数，如果存在启动PicaShare.xmal页面,如果不存在token参数就启动MainPage.xmal页面，你可以参考这篇文章<a href="http://mxmxm.com/?p=217" target="_blank">http://mxmxm.com/?p=217</a>示例代码如下:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:436px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> RootFrame_Navigating<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, NavigatingCancelEventArgs e<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
<span style="color: #6666cc; font-weight: bold;">bool</span> hastoken<span style="color: #008000;">=</span><span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>e<span style="color: #008000;">.</span><span style="color: #0000FF;">Uri</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;/MainPage.xaml&quot;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">true</span> <span style="color: #008000;">||</span> hastoken<span style="color: #008000;">&#41;</span><br />
<span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span><br />
e<span style="color: #008000;">.</span><span style="color: #0000FF;">Cancel</span> <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span><br />
RootFrame<span style="color: #008000;">.</span><span style="color: #0000FF;">Dispatcher</span><span style="color: #008000;">.</span><span style="color: #0000FF;">BeginInvoke</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">delegate</span><br />
<span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>e<span style="color: #008000;">.</span><span style="color: #0000FF;">Uri</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;token&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span> hastoken<span style="color: #008000;">=</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>RootFrame<span style="color: #008000;">.</span><span style="color: #0000FF;">Navigate</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> Uri<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;/PicShare.xaml&quot;</span>, UriKind<span style="color: #008000;">.</span><span style="color: #0000FF;">Relative</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><span style="color: #008000;">&#125;</span><br />
<span style="color: #008080; font-style: italic;">//导航到PicShare.xaml时别忘了把token这个参数传递过去</span><br />
<span style="color: #0600FF; font-weight: bold;">else</span> RootFrame<span style="color: #008000;">.</span><span style="color: #0000FF;">Navigate</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> Uri<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;MainPage.xaml&quot;</span>, UriKind<span style="color: #008000;">.</span><span style="color: #0000FF;">Relative</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.mxmxm.com/windows-phone7%e5%a6%82%e4%bd%95%e5%bc%80%e5%8f%91%e5%88%86%e4%ba%ab%e5%9b%be%e7%89%87%e7%9a%84%e6%8f%92%e4%bb%b6.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

