<?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>Designer Silverlight</title>
	<atom:link href="http://www.designersilverlight.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.designersilverlight.com</link>
	<description>Matthias Shapiro's Silverlight &#38; WPF Blog - Because Developers Get All The Good Blogs</description>
	<lastBuildDate>Thu, 26 Jan 2012 06:45:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Tutorial: Logging Into Facebook with Windows Phone 7 (Silverlight)</title>
		<link>http://www.designersilverlight.com/2012/01/25/tutorial-logging-into-facebook-with-windows-phone-7-silverlight/</link>
		<comments>http://www.designersilverlight.com/2012/01/25/tutorial-logging-into-facebook-with-windows-phone-7-silverlight/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 06:43:12 +0000</pubDate>
		<dc:creator>matthias</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[Windows Phone 7.1]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=1361</guid>
		<description><![CDATA[So, you want to use Facebook to sign into something or in some way integrate Facebook with your Windows Phone 7 app. You are in luck because it is almost hilariously easy. I’ve uploaded this tutorial as a zip file. I tried to github it, but I’m inching up on 1 hour of trying to [...]]]></description>
			<content:encoded><![CDATA[<p>So, you want to use Facebook to sign into something or in some way integrate Facebook with your Windows Phone 7 app. You are in luck because it is almost hilariously easy.</p>
<p>I’ve uploaded this tutorial as a zip file. I tried to github it, but I’m inching up on 1 hour of trying to figure out what the hell I’m doing wrong.</p>
<p><a href='http://www.designersilverlight.com/wp-content/uploads/2012/01/Facebook_Tutorial_App.zip'>Download this Tutorial Project</a></p>
<p>I’ve tried to make this a full featured tutorial, so if you just want to get to the code, head down to the “Let the User Login To Facebook” section.</p>
<h2>Get Your Facebook Key</h2>
<p>Go to <a href="http://developers.facebook.com">http://developers.facebook.com</a> and log in with your Facebook account. Give them the permissions they need and go to the “Apps” tab. Click on “Create new App”</p>
<p>Fill in the App Display Name and the App Namespace and do the verification. Then you’ll get to a page that gives you your App ID and App Secret. </p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2012/01/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2012/01/image_thumb.png" width="758" height="229"></a></p>
<p>Don’t worry about anything else here… you don’t need to select anything in the “how your app integrates with Facebook” section to do this tutorial. If you’re using Facebook integration to do some basic login and simple posting, you could probably just use the Website option.</p>
<p>Also, click the “Graph API Explorer” on the left and keep that open. We’ll come back to that in a moment.</p>
<h2>Add Facebook C# SDK</h2>
<p><a href="http://facebooksdk.codeplex.com/">Download the Facebook C# SDK</a> and extract it. Go to the “sl3-wp” folder and unblock the Facebook.dll file (right-click =&gt; Properties=&gt;click “Unblock”)</p>
<p>Open up your project (for the example, I used the Visual Studio 10 “Windows Phone Databound Application” template) and right-click on “References =&gt; Add References…”. Click “Browse” and navigate to the Facebook.dll and add it to your project.</p>
<h2>Build Facebook Login UI</h2>
<p>We’ll do this quick here (no MVVM, no bindings) but in later versions I’ll integrate this into a more formal project.</p>
<p>Open your project in Blend. For this quick-and-dirty tutorial, we’ll just add another page title and another panel for the UI we want to show when the user is logged in and set the Visibility to Collapsed on those. Our visual tree should look like this.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2012/01/image1.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2012/01/image_thumb1.png" width="154" height="168"></a></p>
<p>In our loginPanel, we’re going to add a button and a WebBrowser to our panel. Set the button (containing “sign in using facebook” in the content) to the top and the WebBrowser to fill the panel. For a little flare, I’m going to add “ShowFacebookLogin” and “HideFacebookLogin” animations. My login screen now looks like this (the WebBrowser will animate in when we press the button).</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2012/01/image2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2012/01/image_thumb2.png" width="244" height="128"></a></p>
<p>When we get our data back, we’re going to tell the user it worked by showing their name and their Facebook avatar. So we’ll add a Grid with an Image and a TextBlock to display the user, along with a friendly “Hello”. (Make sure to name all these things so that we can update them from the code.)</p>
<p>OK… out UI is simple, but ready to roll. Now let’s do something when the user clicks the sign-in button. Go to the “Click” event and add a method like “StartFacebookLogin”.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2012/01/image3.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2012/01/image_thumb3.png" width="345" height="161"></a></p>
<h2>Let the User Login to Facebook</h2>
<p>Add “using Facebook;” to your references at the top of your MainPage.xaml.cs file. Now, add the following properties:</p>
<pre class="csharpcode"><span class="kwrd">private</span> FacebookClient _asyncFbClient;
<span class="kwrd">private</span> <span class="kwrd">string</span> _appID = <span class="str">"get from your facebook app page"</span>;
<span class="kwrd">private</span> <span class="kwrd">string</span> _appSecret = <span class="str">"get from your facebook app page"</span>;</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>Now go to your StartFacebookLogin method and add the following (explained at the end).</p>
<pre class="csharpcode"><span class="kwrd">private</span> <span class="kwrd">void</span> StartFacebookLogin(<span class="kwrd">object</span> sender, RoutedEventArgs e)
{
    <span class="kwrd">string</span>[] extendedPermissions = <span class="kwrd">new</span>[] { <span class="str">"user_about_me"</span>, <span class="str">"publish_stream"</span> };

    var oauth = <span class="kwrd">new</span> FacebookOAuthClient { AppId = _appID, AppSecret = _appSecret };
    var parameters = <span class="kwrd">new</span> Dictionary&lt;<span class="kwrd">string</span>, <span class="kwrd">object</span>&gt;
                    {
                        {<span class="str">"response_type"</span>, <span class="str">"token"</span>},
                        {<span class="str">"display"</span>, <span class="str">"touch"</span>}
                    };
    <span class="kwrd">if</span> (extendedPermissions != <span class="kwrd">null</span> &amp;&amp; extendedPermissions.Length &gt; 0)
    {
        var scope = <span class="kwrd">new</span> StringBuilder();
        scope.Append(<span class="kwrd">string</span>.Join(<span class="str">","</span>, extendedPermissions));
        parameters[<span class="str">"scope"</span>] = scope.ToString();
    }

    var loginUrl = oauth.GetLoginUrl(parameters);</pre>
<pre class="csharpcode">    webBrowser.Navigated += <span class="kwrd">new</span> EventHandler&lt;NavigationEventArgs&gt;(CheckForAuth);
    webBrowser.Navigate(loginUrl);
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>Remember how I told you to keep the Graph API open? Here is why. It has a big list of all the extendedPermissions that you can tell Facebook you want from the user. Here, we’ve asked for basic user information and the ability to publish to the user’s stream. Ask for only the permissions you need. The user can see the details of your permission request and may reject it if you ask too much.</p>
<p>Next, we create our OAuth client using out AppID and AppSecret and create a Dictionary of parameters communicating to Facebook the details of our request (for example, setting “display”, “touch” tells Facebook that we want the mobile interface. </p>
<p>We write out permission request into our parameters and then get a login url, which we will direct to our webBrowser. Here is what we will should get.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2012/01/image4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2012/01/image_thumb4.png" width="204" height="337"></a></p>
<p>At the point Facebook walks the user through their login and, when they are done, it hands us back the access token we’ll need to get the user info and let the user make posts through our app. </p>
<p>This is why we attached the CheckForAuth event handler to our webBrowser. When we navigate to a new page, we’ll check to see if we got an access token using this code:</p>
<pre class="csharpcode"><span class="kwrd">private</span> <span class="kwrd">void</span> CheckForAuth(<span class="kwrd">object</span> sender, System.Windows.Navigation.NavigationEventArgs e)
{
    FacebookOAuthResult result;
    <span class="kwrd">if</span> (FacebookOAuthResult.TryParse(e.Uri, <span class="kwrd">out</span> result))
    {
        <span class="kwrd">if</span> (result.IsSuccess)
        {
            IsolatedStorageSettings Settings = IsolatedStorageSettings.ApplicationSettings;
            <span class="kwrd">if</span>(Settings.Contains(<span class="str">"MyFacebookAccessToken"</span>))
                Settings[<span class="str">"MyFacebookAccessToken"</span>] = result.AccessToken;
            <span class="kwrd">else</span>
                Settings.Add(<span class="str">"MyFacebookAccessToken"</span>, result.AccessToken);
            Settings.Save();
            _asyncFbClient = <span class="kwrd">new</span> FacebookClient(result.AccessToken);
            _asyncFbClient.GetCompleted += <span class="kwrd">new</span> EventHandler&lt;FacebookApiEventArgs&gt;(_asyncFbClient_GetCompleted);
            _asyncFbClient.GetAsync(<span class="str">"/me"</span>);
        }
    }
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>If the Uri does contain a Facebook OAuth result and it is a success, we save the access token to our settings and then immediately use it to get the most basic user information. </p>
<p>The problem we have right now is that we have no class to structure the data that comes back. So get that all squared away.</p>
<p>First, right-click on “References” and select “Add Reference…”. Select “System.Runtime.Serialization”.</p>
<p>Next, add a class to your project (I added mine in a folder called “Models”) and name it FacebookUser.cs.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2012/01/image5.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2012/01/image_thumb5.png" width="224" height="125"></a></p>
<p>In that class, add the following code</p>
<pre class="csharpcode">[DataContractAttribute]
<span class="kwrd">public</span> <span class="kwrd">class</span> FacebookUser
{
    <span class="kwrd">public</span> FacebookUser() { }

    <span class="kwrd">private</span> <span class="kwrd">string</span> _id;
    [DataMember(Name = <span class="str">"id"</span>)]
    <span class="kwrd">public</span> <span class="kwrd">string</span> ID
    {
        get { <span class="kwrd">return</span> _id; }
        set { _id = <span class="kwrd">value</span>; }
    }

    <span class="kwrd">private</span> <span class="kwrd">string</span> _name;
    [DataMember(Name = <span class="str">"name"</span>)]
    <span class="kwrd">public</span> <span class="kwrd">string</span> Name
    {
        get { <span class="kwrd">return</span> _name; }
        set { _name = <span class="kwrd">value</span>; }
    }
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>The sample project has a much larger (although still incomplete) version of this model. But this one will do for our purposes.</p>
<p>We’ll make our “GetCompleted” event handler (remember that?) look like this:</p>
<pre class="csharpcode"><span class="kwrd">void</span> _asyncFbClient_GetCompleted(<span class="kwrd">object</span> sender, FacebookApiEventArgs e)
{
    FacebookUser _fbUser = e.GetResultData&lt;FacebookUser&gt;();

    Deployment.Current.Dispatcher.BeginInvoke(() =&gt;
    {
        fbName.Text = _fbUser.Name;
        BitmapImage bi = <span class="kwrd">new</span> BitmapImage(<span class="kwrd">new</span> Uri(<span class="str">"https://graph.facebook.com/"</span> + _fbUser.ID + <span class="str">"/picture"</span>));
        fbAvatar.Source = bi;
        HideFacebookLogin.Begin();
    });
    _asyncFbClient.GetCompleted -= _asyncFbClient_GetCompleted;
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>What we’ve done here is shove our data into a FacebookUser model. Then we use BeginInvoke to bring ourselves back to the UI thread and set all the properties we want. </p>
<p>Finally, we start the animation that hides the login data and shows that our Facebook login was a success. </p>
<p>Boom!</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2012/01/image6.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2012/01/image_thumb6.png" width="244" height="168"></a></p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2012/01/25/tutorial-logging-into-facebook-with-windows-phone-7-silverlight/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Tutorial%3A+Logging+Into+Facebook+with+Windows+Phone+7+%28Silverlight%29+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1361" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Tutorial%3A+Logging+Into+Facebook+with+Windows+Phone+7+%28Silverlight%29+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1361" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2012/01/25/tutorial-logging-into-facebook-with-windows-phone-7-silverlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Operation Not Permitted&#8221; On IsolatedStorageSettings in Windows Phone</title>
		<link>http://www.designersilverlight.com/2012/01/12/operation-not-permitted-on-isolatedstoragesettings-in-windows-phone/</link>
		<comments>http://www.designersilverlight.com/2012/01/12/operation-not-permitted-on-isolatedstoragesettings-in-windows-phone/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 04:10:21 +0000</pubDate>
		<dc:creator>matthias</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[IsolateStorageSettings]]></category>
		<category><![CDATA[Mango]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=1345</guid>
		<description><![CDATA[This is really fast but it took me a while to figure out. I was getting the following on my recent project when I tried to save something using IsolatedStorageSettings: &#8220;Operation not permitted on IsolatedStorageFileStream.&#8221; And I couldn’t find anything about it other than a very generic “Looks like a threading problem” answers. Long story [...]]]></description>
			<content:encoded><![CDATA[<p>This is really fast but it took me a while to figure out. I was getting the following on my recent project when I tried to save something using IsolatedStorageSettings:</p>
<blockquote><p>&#8220;Operation not permitted on IsolatedStorageFileStream.&#8221;</p>
</blockquote>
<p>And I couldn’t find anything about it other than a very generic “Looks like a threading problem” answers. </p>
<p>Long story short:</p>
<p>I was, in rapid succession, running the same save code twice. What I <em>think</em> happened was that the IsolatedStorageFileStream was still open and trying to save when I tried to get it to save again on another thread.</p>
<p>That’s my guess. I figured I’d toss up this short post on it before I forgot what the problem was. </p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2012/01/12/operation-not-permitted-on-isolatedstoragesettings-in-windows-phone/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=%E2%80%9COperation+Not+Permitted%E2%80%9D+On+IsolatedStorageSettings+in+Windows+Phone+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1345" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=%E2%80%9COperation+Not+Permitted%E2%80%9D+On+IsolatedStorageSettings+in+Windows+Phone+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1345" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2012/01/12/operation-not-permitted-on-isolatedstoragesettings-in-windows-phone/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HttpWebRequest (WebClient) And Tombstoning in Windows Phone 7</title>
		<link>http://www.designersilverlight.com/2012/01/11/httpwebrequest-webclient-and-tombstoning-in-windows-phone-7/</link>
		<comments>http://www.designersilverlight.com/2012/01/11/httpwebrequest-webclient-and-tombstoning-in-windows-phone-7/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 02:43:06 +0000</pubDate>
		<dc:creator>matthias</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[FAS]]></category>
		<category><![CDATA[Fast Application Switching]]></category>
		<category><![CDATA[HttpWebRequest]]></category>
		<category><![CDATA[HttpWebResponse]]></category>
		<category><![CDATA[tombstoning]]></category>
		<category><![CDATA[WebClient]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=1341</guid>
		<description><![CDATA[My initial concern here was to deal with tombstoning when it comes to HTTP requests, because that issue has kicked my butt on more than one account. But the second thing you’ll find here is a simple pattern for HTTP requests and responses in Windows Phone 7. Most of the .NET code I look at [...]]]></description>
			<content:encoded><![CDATA[<p>My initial concern here was to deal with tombstoning when it comes to HTTP requests, because that issue has kicked my butt on more than one account. But the second thing you’ll find here is a simple pattern for HTTP requests and responses in Windows Phone 7.</p>
<p>Most of the .NET code I look at uses WebClient to do HTTP requests. But <a href="http://social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/594e1422-3b69-4cd2-a09b-fb500d5eb1d8/">using WebClient can negatively affect the UI thread in Windows Phone 7</a>, so we have to do something a little more like this:</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span><span class="kwrd">public</span> <span class="kwrd">void</span> MakeSomeHTTPCall()</pre>
<pre><span class="lnum">   2:  </span>{</pre>
<pre><span class="lnum">   3:  </span>    var request = (HttpWebRequest)WebRequest.Create(<span class="str">"http://my.awesomewebsite.com"</span>);</pre>
<pre><span class="lnum">   4:  </span>    request.Method = <span class="str">"GET"</span>;</pre>
<pre><span class="lnum">   5:  </span>    request.BeginGetResponse(<span class="kwrd">new</span> AsyncCallback(GetSomeResponse), request);</pre>
<pre><span class="lnum">   6:  </span>}</pre>
</div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>Easy enough, right? </p>
<p>Not so fast! </p>
<p>If the user starts a request and then hits the “power” button on their phone, this will cancel that request. How can we tell when this has happened?</p>
<p>Well, we handle the response to this request in the “GetSomeResponse” method, so let’s take a look at that.</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span><span class="kwrd">private</span> <span class="kwrd">void</span> GetSomeResponse(IAsyncResult MyResultAsync)</pre>
<pre><span class="lnum">   2:  </span>{</pre>
<pre><span class="lnum">   3:  </span>    HttpWebRequest request = (HttpWebRequest)MyResultAsync.AsyncState;</pre>
<pre><span class="lnum">   4:  </span>    <span class="kwrd">try</span></pre>
<pre><span class="lnum">   5:  </span>    {</pre>
<pre><span class="lnum">   6:  </span>        HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(MyResultAsync);</pre>
<pre><span class="lnum">   7:  </span>        <span class="kwrd">if</span> (response.StatusCode == HttpStatusCode.OK &amp;&amp; response.ContentLength &gt; 0)</pre>
<pre><span class="lnum">   8:  </span>        {</pre>
<pre><span class="lnum">   9:  </span>            <span class="kwrd">using</span> (StreamReader sr = <span class="kwrd">new</span> StreamReader(response.GetResponseStream()))</pre>
<pre><span class="lnum">  10:  </span>            {</pre>
<pre><span class="lnum">  11:  </span>                <span class="rem">// This result string below is going to be whatever I get back,</span></pre>
<pre><span class="lnum">  12:  </span>                <span class="rem">//   be it JSON or XML or whatever</span></pre>
<pre><span class="lnum">  13:  </span>                <span class="kwrd">string</span> result = sr.ReadToEnd();                        </pre>
<pre><span class="lnum">  14:  </span>            }</pre>
<pre><span class="lnum">  15:  </span>        }</pre>
<pre><span class="lnum">  16:  </span>    }</pre>
<pre><span class="lnum">  17:  </span>    <span class="kwrd">catch</span> (WebException e)</pre>
<pre><span class="lnum">  18:  </span>    {</pre>
<pre><span class="lnum">  19:  </span>        <span class="kwrd">if</span> (e.Status == WebExceptionStatus.RequestCanceled)</pre>
<pre><span class="lnum">  20:  </span>            MessageBox.Show(<span class="str">"Looks like your request was interrupted by tombstoning"</span>);</pre>
<pre><span class="lnum">  21:  </span>        <span class="kwrd">else</span></pre>
<pre><span class="lnum">  22:  </span>        {</pre>
<pre><span class="lnum">  23:  </span>            <span class="kwrd">using</span> (HttpWebResponse response = (HttpWebResponse)e.Response)</pre>
<pre><span class="lnum">  24:  </span>            {</pre>
<pre><span class="lnum">  25:  </span>                MessageBox.Show(<span class="str">"I got an http error of: "</span> + response.StatusCode.ToString());</pre>
<pre><span class="lnum">  26:  </span>            }</pre>
<pre><span class="lnum">  27:  </span>        }</pre>
<pre><span class="lnum">  28:  </span>    }</pre>
<pre><span class="lnum">  29:  </span>}</pre>
</div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>OK… let’s walk through this.</p>
<p>First, we get our request from the MyResultAsync.AsyncState (line 3), which we&#8217; use to get our response (line 6). Now we can get a HTTP status code (like “200 – OK” or “404 – Not Found”) from this response, right? </p>
<p>No, we cannot. If the response is something other than OK, it will trigger an error and we will jump to the “catch” with a WebException error (line 17).</p>
<p>If we’re coming back from a tombstone (or <a href="http://msdn.microsoft.com/en-us/library/ff769557(v=vs.92).aspx">Fast Application Switching</a>, which will also cancel the request), the WebException status will be “RequestCanceled”. We test for that case and do something special for it (depending on the app, we may want to automatically re-do the request to ensure that we don’t put the user out of sorts by an errant power button press). Otherwise, we know it’s a normal HTTP status code and we can deal with it that way.</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2012/01/11/httpwebrequest-webclient-and-tombstoning-in-windows-phone-7/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=HttpWebRequest+%28WebClient%29+And+Tombstoning+in+Windows+Phone+7+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1341" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=HttpWebRequest+%28WebClient%29+And+Tombstoning+in+Windows+Phone+7+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1341" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2012/01/11/httpwebrequest-webclient-and-tombstoning-in-windows-phone-7/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Adding Cookies to a Windows Phone 7 HttpWebRequest</title>
		<link>http://www.designersilverlight.com/2012/01/02/adding-cookies-to-a-windows-phone-7-httpwebrequest/</link>
		<comments>http://www.designersilverlight.com/2012/01/02/adding-cookies-to-a-windows-phone-7-httpwebrequest/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 02:45:44 +0000</pubDate>
		<dc:creator>matthias</dc:creator>
				<category><![CDATA[Silverlight 4]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[CookieContainer]]></category>
		<category><![CDATA[Cookies]]></category>
		<category><![CDATA[HttpWebRequest]]></category>
		<category><![CDATA[HttpWebResponse]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=1339</guid>
		<description><![CDATA[I just spent a couple days on this and, in the end, I didn’t really figure it out. Someone else at my work (the brilliant Rylan Barnes) showed me the workaround for it. So… you want to add a cookie to your Windows Phone 7 Silverlight HttpWebRequest. Guess what? It sucks to be you! Or, [...]]]></description>
			<content:encoded><![CDATA[<p>I just spent a couple days on this and, in the end, I didn’t really figure it out. Someone else at my work (the brilliant Rylan Barnes) showed me the workaround for it.</p>
<p>So… you want to add a cookie to your Windows Phone 7 Silverlight HttpWebRequest. Guess what? It sucks to be you! Or, at least, it sucked to be me because I couldn’t find anything on how to do this that worked.</p>
<p>I was working on a project that requires the user to authenticate and, on authentication, sends back a token (unique to that user) to be attached as a cookie for further authentication. However, when I attached the cookie and made my next request, it made that request without the authorization header. Our server said “Hey, looks like you’re not authenticated, I will now forget about that last cookie because you obviously didn’t get it. Have a new one!”</p>
<p>First I’m going to show you things that don’t work.</p>
<h2>Didn’t Work: Adding An Empty Cookie Container to the Request</h2>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">void</span> DoSomeCRUD(<span class="kwrd">string</span> userName, <span class="kwrd">string</span> pass)
{
    HttpWebRequest request = System.Net.HttpWebRequest.Create(<span class="str">"https://myurl.com"</span>) <span class="kwrd">as</span> HttpWebRequest;
    <span class="kwrd">if</span> (HasSavedCookieContainer)
        request.CookieContainer = SavedCookieContainer();
    <span class="kwrd">else</span>
        request.CookieContainer = <span class="kwrd">new</span> CookieContainer();
    request.Credentials = <span class="kwrd">new</span> NetworkCredential(userName, pass);
    request.BeginGetResponse(<span class="kwrd">new</span> AsyncCallback(GetMyResponse), request);
}

<span class="kwrd">private</span> <span class="kwrd">void</span> GetMyResponse(IAsyncResult MyResponseAsync)
{
    HttpWebRequest request = (HttpWebRequest)MyResponseAsync.AsyncState;
    HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(MyResponseAsync);
    <span class="rem">// this method save the cookie container to IsolatedStorage </span>
    <span class="rem">// so I can attach it to the request the next time I open the app.</span>
    SaveCookieContainer(request.CookieContainer);
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>The saving worked, the cookie container came back just as I saved it. And then… it didn’t work. It was as if the cookie didn’t exist. </p>
<h2>Didn’t Work: Ripping The Token Out Of the “Set-Cookie” Header</h2>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">void</span> DoSomeCRUD(<span class="kwrd">string</span> userName, <span class="kwrd">string</span> pass)
{
    HttpWebRequest request = System.Net.HttpWebRequest.Create(<span class="str">"https://myurl.com"</span>) <span class="kwrd">as</span> HttpWebRequest;
    <span class="kwrd">if</span> (IsolatedStorageSettings.ApplicationSettings.Contains[<span class="str">"MyToken"</span>])
    {
        <span class="kwrd">string</span> myToken = (<span class="kwrd">string</span>)IsolatedStorageSettings.ApplicationSettings[<span class="str">"MyToken"</span>];
        Cookie c = <span class="kwrd">new</span> Cookie(<span class="str">"MyCookieName"</span>, myToken, <span class="str">"[valid path]"</span>, <span class="str">"[valid domain]"</span>);
        request.CookieContainer = <span class="kwrd">new</span> CookieContainer();
        request.CookieContainer.Add(<span class="kwrd">new</span> Uri(<span class="str">"http://myurl.com"</span>), c);
    }
    <span class="kwrd">else</span>
        request.CookieContainer = <span class="kwrd">new</span> CookieContainer();
    request.Credentials = <span class="kwrd">new</span> NetworkCredential(userName, pass);
    request.BeginGetResponse(<span class="kwrd">new</span> AsyncCallback(GetMyResponse), request);
}

<span class="kwrd">private</span> <span class="kwrd">void</span> GetMyResponse(IAsyncResult MyResponseAsync)
{
    HttpWebRequest request = (HttpWebRequest)MyResponseAsync.AsyncState;
    HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(MyResponseAsync);
    <span class="rem">// this method looked for "Set-Cookie" information in the header</span>
    <span class="rem">// and the pulls out the token data by brute force and save the</span>
    <span class="rem">// token as a string</span>
    <span class="kwrd">if</span> (ResponseHasSetCookieInHeader(response))
    {
        <span class="kwrd">string</span> rawToken = GetTokenFromResponse(response);
        IsolatedStorageSettings.ApplicationSettings[<span class="str">"MyToken"</span>] = rawToken;
        IsolatedStorageSettings.ApplicationSettings.Save();
    }
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>The save worked here too, but the same result… it was like the cookie didn’t exist.</p>
<h2>This Worked: Adding the Cookie as a Header</h2>
<p>Finally we added the token and the credential information as header items. This finally worked. </p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">void</span> DoSomeCRUD(<span class="kwrd">string</span> userName, <span class="kwrd">string</span> pass)
{
    HttpWebRequest request = System.Net.HttpWebRequest.Create(<span class="str">"https://myurl.com"</span>) <span class="kwrd">as</span> HttpWebRequest;
    <span class="kwrd">if</span> (IsolatedStorageSettings.ApplicationSettings.Contains[<span class="str">"MyToken"</span>])
        request.Headers[<span class="str">"Cookie"</span>] = <span class="str">"MyTokenName="</span> + (<span class="kwrd">string</span>)IsolatedStorageSettings.ApplicationSettings[<span class="str">"MyToken"</span>];

    request.Headers[<span class="str">"Authentication"</span>] = <span class="str">"Basic "</span> + Convert.ToBase64String(StringToAscii(userName, pass));
    request.BeginGetResponse(<span class="kwrd">new</span> AsyncCallback(GetMyResponse), request);
}

<span class="kwrd">private</span> <span class="kwrd">void</span> GetMyResponse(IAsyncResult MyResponseAsync)
{
    HttpWebRequest request = (HttpWebRequest)MyResponseAsync.AsyncState;
    HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(MyResponseAsync);
    <span class="rem">// this method looks for "Set-Cookie" information in the header</span>
    <span class="rem">// and the pulls out the token data, saving it to Isolated Storage</span>
    <span class="kwrd">if</span> (ResponseHasSetCookieInHeader(response))
    {
        <span class="kwrd">string</span> rawToken = GetTokenFromResponse(response);
        IsolatedStorageSettings.ApplicationSettings[<span class="str">"MyToken"</span>] = rawToken;
        IsolatedStorageSettings.ApplicationSettings.Save();
    }
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>For the sake of giving credit, here is the StringToAscii method for the Authentication, tweaked from <a href="http://stackoverflow.com/questions/4022281/asciiencoding-in-windows-phone-7">this StackOverflow answer</a> from <a href="http://stackoverflow.com/users/17034/hans-passant">Hans Passant</a></p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">byte</span>[] StringToAscii(<span class="kwrd">string</span> userName, <span class="kwrd">string</span> pass)
{
    <span class="kwrd">string</span> s = userName + <span class="str">":"</span> + pass;
    <span class="kwrd">byte</span>[] retval = <span class="kwrd">new</span> <span class="kwrd">byte</span>[s.Length];
    <span class="kwrd">for</span> (<span class="kwrd">int</span> ix = 0; ix &lt; s.Length; ++ix)
    {
        <span class="kwrd">char</span> ch = s[ix];
        <span class="kwrd">if</span> (ch &lt;= 0x7f) retval[ix] = (<span class="kwrd">byte</span>)ch;
        <span class="kwrd">else</span> retval[ix] = (<span class="kwrd">byte</span>)<span class="str">'?'</span>;
    }
    <span class="kwrd">return</span> retval;
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2012/01/02/adding-cookies-to-a-windows-phone-7-httpwebrequest/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Adding+Cookies+to+a+Windows+Phone+7+HttpWebRequest+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1339" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Adding+Cookies+to+a+Windows+Phone+7+HttpWebRequest+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1339" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2012/01/02/adding-cookies-to-a-windows-phone-7-httpwebrequest/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Finding the Unique Device ID in Windows Phone 7 (And Device Manufacturer And Anonymous Windows Live ID)</title>
		<link>http://www.designersilverlight.com/2011/12/20/finding-the-unique-device-id-in-windows-phone-7-and-device-manufacturer-and-anonymous-windows-live-id/</link>
		<comments>http://www.designersilverlight.com/2011/12/20/finding-the-unique-device-id-in-windows-phone-7-and-device-manufacturer-and-anonymous-windows-live-id/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 18:13:37 +0000</pubDate>
		<dc:creator>matthias</dc:creator>
				<category><![CDATA[Mango]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Silverlight 4]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[Windows Phone 7]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=1334</guid>
		<description><![CDATA[I’m tired of trying to find things about Windows Phone 7 development, so I’m just going to post links that I find helpful so I can find them later. Here’s Nick Harris with a handy set of static methods for getting the following unique IDs: Device Manufacturer ID DeviceExtendedProperties.TryGetValue(&#8220;DeviceManufacturer&#8221;, out someObject); example: “HTC” Device ID [...]]]></description>
			<content:encoded><![CDATA[<p>I’m tired of trying to find things about Windows Phone 7 development, so I’m just going to post links that I find helpful so I can find them later.</p>
<p>Here’s <a href="http://www.nickharris.net/2010/09/windows-phone-7-how-to-find-the-device-unique-id-windows-live-anonymous-id-and-manufacturer/">Nick Harris with a handy set of static methods for getting the following unique IDs</a>:</p>
<ul>
<li>Device Manufacturer ID
<ul>
<li>DeviceExtendedProperties.TryGetValue(&#8220;DeviceManufacturer&#8221;, out someObject);</li>
<li>example: “HTC”</li>
</ul>
</li>
<li>Device ID
<ul>
<li>DeviceExtendedProperties.TryGetValue(&#8220;DeviceUniqueId&#8221;, out someObject);</li>
<li>requires ID_CAP_IDENTITY_DEVICE in the app manifest which will trigger a warning to users when they install the app</li>
<li>a byte[], converter to a string will looks like<br />
“12345678901234567890123456789012345678901234567890123”</li>
</ul>
</li>
<li>Anonymous Windows Live ID
<ul>
<li>A 32 character subset at offset 2  of the results of<br />
&#8220;UserExtendedProperties.TryGetValue(&#8220;ANID&#8221;, out someObject)</li>
<li>requires ID_CAP_IDENTITY_USER in the app manifest which will trigger a warning to users when they install the app</li>
<li>looks like “00FF00FF00FF00FF00FF00FF00FF00FF&#8221;</li>
<li></li>
</ul>
</li>
</ul>
<p>However, if you just need any unique identifier (not necessarily a device ID), you can always set and store a new global unique identifier using:</p>
<p>Guid.NewGuid();</p>
<p>which will return a 128-bit integer that will look something like this:</p>
<p>&#8220;e81644f1-46b6-4994-2903-1d1f1440c130&#8243;</p>
<p>This will not cause warnings to appear when the app is downloaded because it isn&#8217;t a constant identifier to that specific device.</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2011/12/20/finding-the-unique-device-id-in-windows-phone-7-and-device-manufacturer-and-anonymous-windows-live-id/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Finding+the+Unique+Device+ID+in+Windows+Phone+7+%28And+Device+Manufacturer+And+Anonymous+Windows+Liv...+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1334" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Finding+the+Unique+Device+ID+in+Windows+Phone+7+%28And+Device+Manufacturer+And+Anonymous+Windows+Liv...+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1334" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2011/12/20/finding-the-unique-device-id-in-windows-phone-7-and-device-manufacturer-and-anonymous-windows-live-id/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Windows Phone 7 Push Notification For Beginners&#8211;The Device</title>
		<link>http://www.designersilverlight.com/2011/06/28/windows-phone-7-push-notification-for-beginnersthe-device/</link>
		<comments>http://www.designersilverlight.com/2011/06/28/windows-phone-7-push-notification-for-beginnersthe-device/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 14:56:14 +0000</pubDate>
		<dc:creator>matthias</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[push notifications]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/2011/06/28/windows-phone-7-push-notification-for-beginnersthe-device/</guid>
		<description><![CDATA[OK… it’s been almost 2 months since I tried to start this series and now I’m going to finish it. A brief warning: this is done with pre-Mango bits so it won’t have all the latest, greatest most exciting things like the back-tile functionality or deep linking. (Here’s a good blog post on all that.) [...]]]></description>
			<content:encoded><![CDATA[<p>OK… it’s been almost 2 months since I tried to start this series and now I’m going to finish it. A brief warning: this is done with pre-Mango bits so it won’t have all the latest, greatest most exciting things like the back-tile functionality or deep linking. (<a href="http://blogs.microsoft.co.il/blogs/alex_golesh/archive/2011/05/24/windows-phone-mango-what-s-new-push-notifications-amp-tiles-part-8-of-8.aspx">Here’s a good blog post on all that</a>.) But it remains a good introduction.</p>
<p><a href="https://github.com/matthiasxc/Windows-Phone-7-Push-Notification-Sample-All/">Windows Phone 7 Push Notification Project Files (github)</a></p>
<p>The goal of this post is to provide a sample Push Notification application that is</p>
<ul>
<li>easy to test</li>
<li>good architecture</li>
<li><a href="http://www.designersilverlight.com/WP7PushTester/">provides a sample web app for testing your push code</a> (part of the delay has been because I’ve been trying to be a perfectionist on that web app. I’ve decided I’m never going to get around to making it perfect so this is the best I can do with the time I have)</li>
</ul>
<p>Too many of the sample apps I’ve seen shove the push notification code in the xaml code-behind, leaving it to us to separate out the bits and translate it into a real project. This project uses MVVMLight binding and an event-driven architecture to get the push stuff working.</p>
<p>So… let’s dig into it.</p>
<p>I created a class called PushNotificationService that held a number of helpful little variables and objects. The most important variable here is</p>
<pre class="csharpcode"><span class="kwrd">private</span> <span class="kwrd">static</span> <span class="kwrd">string</span> _pushChannelName = <span class="str">"SampleAppNotification"</span>;</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } -->This name will delineate our push service from other services. If something weird happens and your push service stops working, the first thing you should do is change this string.</p>
<p>Next, we have a method that allows us to control when we get the push notification Uri. As an overview of what we’re doing,</p>
<ol>
<li>See if we already have a valid HttpNotificationChannel (the object that will control the push permissions and handle information from the Microsoft Push server)</li>
<li>If we do have a valid HttpNotificationChannel, make sure we got the channel Uri correctly (the uri we will send out push notifications to). If we did, SUCCESS! Otherwise, go to step 3.</li>
<li>Set the event handlers so we can handle when we get a new channel Uri back from the Microsoft Push server.</li>
<li>Ask the Microsoft Push server for a new channel Uri.</li>
<li>Set the HttpNotificationChannel up to handle the right kind of push notifications.</li>
<li>Handle the returned uri from the Microsoft Push server &amp; send it to the rest of the app.</li>
</ol>
<h2>Step 1</h2>
<pre class="csharpcode">_notificationChannel = HttpNotificationChannel.Find(_pushChannelName);</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<h2>Step 2</h2>
<pre class="csharpcode"><span class="kwrd">if</span> (_notificationChannel.ChannelUri != <span class="kwrd">null</span>)
{
      <span class="rem">// Success! We run the event to send that info back to our ViewModel </span>
      RaiseGotPushUri(_notificationChannel.ChannelUri);
}</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<h2>Step 3</h2>
<pre class="csharpcode"><span class="kwrd">else</span>
{
    _notificationChannel = <span class="kwrd">new</span> HttpNotificationChannel(_pushChannelName);
    _notificationChannel.ChannelUriUpdated +=
<span class="kwrd">         new</span> EventHandler&lt;NotificationChannelUriEventArgs&gt;(_notificationChannel_ChannelUriUpdated);
    _notificationChannel.HttpNotificationReceived +=
<span class="kwrd">         new</span> EventHandler&lt;HttpNotificationEventArgs&gt;(_notificationChannel_HttpNotificationReceived);
    _notificationChannel.ErrorOccurred +=
<span class="kwrd">         new</span> EventHandler&lt;NotificationChannelErrorEventArgs&gt;(_notificationChannel_ErrorOccurred);</pre>
<pre class="csharpcode">
<pre>}</pre>
</pre>
<h2>Step 4</h2>
<pre class="csharpcode">_notificationChannel.Open();</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<h2>Step 5</h2>
<pre class="csharpcode">BindNotifications(_notificationChannel);</pre>
<h2>Binding Details</h2>
<p>In the pre-Mango push notifications, there are 3 kinds of push notifications and we have to announce what kind of notifications we plan on handling.<br />
First, there are toast notifications, which look like this (<a href="http://wildermuth.com/2011/01/02/Architecting_WP7_-_Part_8_of_10_Toast_Push_Notifications">stolen from Shawn Wildermuth</a>):<br />
<!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --><a href="http://www.designersilverlight.com/wp-content/uploads/2011/06/image.png"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/06/image_thumb.png" border="0" alt="image" width="244" height="58" /></a></p>
<p>Toast notifications consist of</p>
<ul>
<li>a title (“Toast Message” in the example above)</li>
<li>a message (“This is from the server”)</li>
</ul>
<p>To bind them, we simply type:</p>
<pre class="csharpcode">_thisChannel.BindToShellToast();</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } -->Tile notifications will only show up if the user has pinned the application to the front application tile board on the phone. I like to split Tile notifications into two types because we have to handle them differently in the code.</p>
<p>The first kind of tile notification is what I call “simple” Tile notifications. With simple Tile notifications, we can change a number and title on our app tile. The new title will show up where the title always shows up (at the bottom left) and the number will show up in a black circle at the top right.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/06/image1.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/06/image_thumb1.png" border="0" alt="image" width="115" height="117" /></a></p>
<p>Doing this much is simple:</p>
<pre class="csharpcode">_thisChannel.BindToShellTile();</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } -->But then there are Live Tiles, which allow us to send a whole new image to the tile to change it in a more holistic way to represent some push data. (We can still update numbers and titles too.) Live Tiles, however, require that we whitelist all the websites that might want to send an image to our phone. So we need to create a collection of whitelisted domains and add that to our tile binding.</p>
<pre class="csharpcode">System.Collections.ObjectModel.Collection&lt;Uri&gt; permittedImageHosts = <span class="kwrd">new</span> System.Collections.ObjectModel.Collection&lt;Uri&gt;();
permittedImageHosts.Add(<span class="kwrd">new</span> Uri(<span class="str">"http://www.designersilverlight.com"</span>));
_thisChannel.BindToShellTile(permittedImageHosts);</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } -->If you’re going to use my handy-dandy WP7 Push Tester, make sure you whitelist the exact domain above.</p>
<p>And that’s it… that’s all we need to do to get everything bound and ready to go! All we need now is to get the Uri from the Microsoft Push server so we know where to send our Push Notifications to.</p>
<h2>Step 6</h2>
<pre class="csharpcode"><span class="kwrd">void</span> _notificationChannel_ChannelUriUpdated(<span class="kwrd">object</span> sender, NotificationChannelUriEventArgs e)
{
      RaiseGotPushUri(e.ChannelUri);
}</pre>
<p><!-- .csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } -->This will run when we get the updated Uri back and we just send it in our event, which the ViewModel is listening to.</p>
<p>I’ve really streamlined the code in this blog post to deal with just the bare essentials. If you want to look at the project in detail, <a href="https://github.com/matthiasxc/Windows-Phone-7-Push-Notification-Sample-All/">you can download it here</a>.</p>
<p>Now, all we have to do is start testing it.</p>
<p>You can test it using my WP7 Push Notification web app. I’m also working on another post that walks through creating a push notification system using PHP, but in the meantime you might want to <a href="http://www.daveamenta.com/2010-11/send-push-notifications-to-windows-phone-7-from-php/">check out this PHP library that I used</a>.</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2011/06/28/windows-phone-7-push-notification-for-beginnersthe-device/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Windows+Phone+7+Push+Notification+For+Beginners%E2%80%93The+Device+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1329" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Windows+Phone+7+Push+Notification+For+Beginners%E2%80%93The+Device+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1329" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2011/06/28/windows-phone-7-push-notification-for-beginnersthe-device/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Windows Phone 7 Push Notifications For Beginners (Now With Testing!)</title>
		<link>http://www.designersilverlight.com/2011/04/18/windows-phone-7-push-notifications-for-beginners-now-with-testing/</link>
		<comments>http://www.designersilverlight.com/2011/04/18/windows-phone-7-push-notifications-for-beginners-now-with-testing/#comments</comments>
		<pubDate>Tue, 19 Apr 2011 04:27:04 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[push notifications]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=1316</guid>
		<description><![CDATA[I know there are about a thousand blog posts on implementing push notifications in a Windows Phone 7 application. But having now implemented push notifications a couple times into WP7 projects, I felt like something was missing from the community knowledge base. So, in order to try to cover WP7 Push notifications for the uninitiated, [...]]]></description>
			<content:encoded><![CDATA[<p>I know there are about <a href="http://www.sgtconker.com/2010/03/article-windows-phone-7-push-notifications/">a thousand</a> <a href="http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/05/06/using-push-notification-from-your-windows-phone-application.aspx">blog posts</a> <a href="http://msdn.microsoft.com/en-us/library/ff402545(v=VS.92).aspx">on implementing</a> push notifications in a Windows Phone 7 application. But having now implemented push notifications a couple times into WP7 projects, I felt like something was missing from the community knowledge base. So, in order to try to cover WP7 Push notifications for the uninitiated, I’m putting together a set of posts will try to cover the following topics:</p>
<ol>
<li>Windows Phone 7 Push Notifications (10,000 Foot View)</li>
<li>Implementing Push Notifications on a Device (with Project code)</li>
<li>Testing Push Notifications On My Device Without Writing a Goddamn Web Service (Also, How To Write A WP7 Push Service in PHP)</li>
</ol>
<h2>Windows Phone 7 Push Notifications (10,000 Foot View)</h2>
<p>The Windows Phone 7 push notification is actually an extremely elegant way of doing push notifications. Personally, I love it. I’ll walk through the steps conceptually here and then mirror the steps in the code post.</p>
<p>(Note to experts: I may be getting some of the details about how this works in the underlying architecture wrong. However, this is how it seems to me that it works and it makes sense this way.)</p>
<p><strong>Step 1:</strong> Say “Hey, phone! I want to send you push notifications about some stuff.” When you do this, you’re doing it with a couple of conditions. The first is that you’re giving your specific push service a name (like “Bob” but hopefully a little more specific).</p>
<p>Next, you’ll need to determine if you want to use the “Toast” notification or the “Tile” notification or the “Raw” notification or some combination of these three. When you know what kind of notifications you want, you’ll basically write a magic piece of code which communicates to the magical push notification fairy, who, in return for your good deeds, gives you a device/application specific URL that you will use to send notifications to your phone.</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/04/image.png"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/04/image_thumb.png" border="0" alt="image" width="154" height="244" /></a></p>
<p>You think I’m kidding. I’m not. As a preview, the code you need to write is: “myPushStuff.Open()”. And that’s it. Then you just wait for the magical push notification fairy to give you the URL you’ll use to send notifications to your phone.</p>
<p>You don’t actually need to send information about toast and tile to the push registration service. However, if you decide later on thatyou actually wanted to send a toast notifications, not a tile notification, your old URL won’t work… you’ll need to save a new one. Don’t know why or how exactly this happens… just passing along helpful information.</p>
<p>If you’re looking for information about the difference between tile, toast and raw notifications, the image below was <a href="http://msdn.microsoft.com/en-us/library/ff941124(v=VS.92).aspx">stolen from the msdn article</a> that talks about the differences. Go read about it there… I won’t stoop to copying and pasting all their excellent information into my blog post.</p>
<p><img style="margin: 5px;" src="http://i.msdn.microsoft.com/dynimg/IC430140.jpg" alt="AP_Con_Notifications_ToastTile" /></p>
<p><strong>Step 2:</strong> Once you have your magical URL, save it in such a way that whatever webservice you’re using can recognize which phone it’s tied to. Maybe you’re saving it along with a username or with a zip code (like with a weather service). In any case, you’ll want to be able to send the right push notifications to the right phones.</p>
<p>When the time comes to send the notification, your webservice will need to send an XML chunk created for your notification (<a href="http://msdn.microsoft.com/en-us/library/ff402545(v=VS.92).aspx">see details here</a>) to the phone-specific URL. Then, the Microsoft Push Notification Service handles your push request and forwards it to the phone, sending a response telling you that it worked (or didn’t work).</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/04/image1.png"><img style="background-image: none; margin: 5px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/04/image_thumb1.png" border="0" alt="image" width="244" height="162" /></a></p>
<p>I’ve got my gripes with Windows Phone 7, but the push notification implementation ain’t one of them. It’s very straightforward and can be implemented on the phone with very little code and on a server with similar ease. If you’re a newbie mobile developer and this looks complicated, go try to implement push notification on Android or iOS. For all you Android and iOS people out there I would like to say:</p>
<h1><span style="color: #000000;">Ha.</span></h1>
<p>The next post will walk through the steps to register your app for push notifications. I’ll post a link to it in this post when I get it up.</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2011/04/18/windows-phone-7-push-notifications-for-beginners-now-with-testing/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Windows+Phone+7+Push+Notifications+For+Beginners+%28Now+With+Testing%21%29+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1316" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Windows+Phone+7+Push+Notifications+For+Beginners+%28Now+With+Testing%21%29+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1316" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2011/04/18/windows-phone-7-push-notifications-for-beginners-now-with-testing/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How To Load MIX Outsider (With Or Without a Phone)</title>
		<link>http://www.designersilverlight.com/2011/04/10/how-to-load-mix-outsider-with-or-without-a-phone/</link>
		<comments>http://www.designersilverlight.com/2011/04/10/how-to-load-mix-outsider-with-or-without-a-phone/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 20:33:15 +0000</pubDate>
		<dc:creator>matthias</dc:creator>
				<category><![CDATA[MIX11]]></category>
		<category><![CDATA[Windows Phone 7]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=1312</guid>
		<description><![CDATA[The very latest and greatest version of the MIX Outsider application is up and ready for download. Mostly text-building fixes and settings updates. Also, check out the MIX Outsider website, built with loving care by Jason Alderman (Twitter: @justsomeguy) If you download the app above, you&#8217;ll notice it is in the *.xap format, which is [...]]]></description>
			<content:encoded><![CDATA[<p>The very latest and greatest version of the <a href="http://designersilverlight.com/wp-content/uploads/2011/04/MIXOutsider.xap">MIX Outsider application</a> is up and ready for download. Mostly text-building fixes and settings updates.</p>
<p>Also, check out the <a href="http://mixoutsider.com">MIX Outsider website</a>, built with loving care by <a href="http://huah.net/jason/blog">Jason Alderman</a> (Twitter: <a href="http://www.twitter.com/justsomeguy">@justsomeguy</a>)</p>
<p>If you download the app above, you&#8217;ll notice it is in the *.xap format, which is the format for all Silverlight based Windows Phone 7 mobile apps. Perhaps you&#8217;ve never side-loaded a WP7 app before or perhaps you don&#8217;t have a Windows Phone 7 device. Fear not! If you have the Windows Phone 7 developer tools, you can load the app to your emulator and just run it from there.</p>
<p>The following 90 second video show you how. It really is so easy that it takes less than 90 seconds.</p>
<p><iframe src="http://player.vimeo.com/video/22205221" width="360" height="482" frameborder="0"></iframe>
<p><a href="http://vimeo.com/22205221">Sideloading the MIX11 Outsider App To The Emulator</a> from <a href="http://vimeo.com/user2318107">Matthias Shapiro</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>Have fun and I&#8217;ll see you at MIX11!</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2011/04/10/how-to-load-mix-outsider-with-or-without-a-phone/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=How+To+Load+MIX+Outsider+%28With+Or+Without+a+Phone%29+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1312" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=How+To+Load+MIX+Outsider+%28With+Or+Without+a+Phone%29+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1312" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2011/04/10/how-to-load-mix-outsider-with-or-without-a-phone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing MIX11 Outsider for Windows Phone 7</title>
		<link>http://www.designersilverlight.com/2011/04/08/introducing-mix11-outsider-for-windows-phone-7/</link>
		<comments>http://www.designersilverlight.com/2011/04/08/introducing-mix11-outsider-for-windows-phone-7/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 17:02:42 +0000</pubDate>
		<dc:creator>matthias</dc:creator>
				<category><![CDATA[MIX11]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[MIX 11]]></category>
		<category><![CDATA[MIX11 Outsider]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=1295</guid>
		<description><![CDATA[UPDATE (4/9/2011) : MIX Outsider has been updated to fix some &#8220;no network&#8221; issues and refine the message creation. Download MIX Outsider (for sideloading) MIX11 Outsider is the MIX11 app that doesn’t care about your schedule. It cares about something more important: the people you want to talk to, meet, or otherwise hang out with [...]]]></description>
			<content:encoded><![CDATA[<p>UPDATE (4/9/2011) : MIX Outsider has been updated to fix some &#8220;no  network&#8221; issues and refine the message creation.<br />
<a href="http://www.designersilverlight.com/wp-content/uploads/2011/04/MIX_Outsider_Screen6.png"><img class="alignnone size-medium wp-image-1296" title="MIX_Outsider_Screen6" src="http://www.designersilverlight.com/wp-content/uploads/2011/04/MIX_Outsider_Screen6-180x300.png" alt="" width="180" height="300" /></a> <a href="http://www.designersilverlight.com/wp-content/uploads/2011/04/MIX_Outsider_Screen1.png"><img class="alignnone size-medium wp-image-1296" title="MIX_Outsider_Screen6" src="http://www.designersilverlight.com/wp-content/uploads/2011/04/MIX_Outsider_Screen1-180x300.png" alt="" width="180" height="300" /></a> <a href="http://www.designersilverlight.com/wp-content/uploads/2011/04/MIX_Outsider_Screen2.png"><img class="alignnone size-medium wp-image-1300" title="MIX_Outsider_Screen2" src="http://www.designersilverlight.com/wp-content/uploads/2011/04/MIX_Outsider_Screen2-180x300.png" alt="" width="180" height="300" /></a> <a href="http://www.designersilverlight.com/wp-content/uploads/2011/04/MIX_Outsider_Screen3.png"><img class="alignnone size-medium wp-image-1300" title="MIX_Outsider_Screen4" src="http://www.designersilverlight.com/wp-content/uploads/2011/04/MIX_Outsider_Screen3-180x300.png" alt="" width="180" height="300" /></a> <a href="http://www.designersilverlight.com/wp-content/uploads/2011/04/MIX_Outsider_Screen4.png"><img class="alignnone size-medium wp-image-1296" title="MIX_Outsider_Screen6" src="http://www.designersilverlight.com/wp-content/uploads/2011/04/MIX_Outsider_Screen4-180x300.png" alt="" width="180" height="300" /></a></p>
<h2><a href="http://designersilverlight.com/wp-content/uploads/2011/04/MIXOutsider.xap">Download MIX Outsider (for sideloading)</a></h2>
<p></p>
<p>MIX11 Outsider is the MIX11 app that doesn’t care about your schedule. It cares about something more important: the people you want to talk to, meet, or otherwise hang out with at MIX. Using a map of the conference floor and a simple “battleship” mapping metaphor, you can tweet, email or text your position at the conference. Don’t eat alone in awkward silence… instead find that Twitter friend who doesn’t have a clear picture of themselves in their avatar. Don’t spend half your pre-keynote time waving your hands in the air. Just tap where you are on the map and send out a link like this one.</p>
<p><a href="http://mixoutsider.com/H60">http://mixoutsider.com/H60</a></p>
<p>And a quick video of the application in action</p>
<p><iframe src="http://player.vimeo.com/video/22131760" width="360" height="600" frameborder="0"></iframe>
<p><a href="http://vimeo.com/22131760">MIX11 Outsider Windows Phone 7 App Screencast</a> from <a href="http://vimeo.com/user2318107">Matthias Shapiro</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>I wish I could introduce this app with a bit more fanfare, but I’ve been waiting since Monday for my app to get through the submission process. I was hopeful that, if I got it in a week before MIX, I would make it in time for the conference. At the moment, that hope fades. As a result, until I can get the app into the Marketplace, it will be available here for download so Windows Phone 7 devs can sideload it onto their phones</p>
<p><a href="http://designersilverlight.com/wp-content/uploads/2011/04/MIXOutsider.xap">MIX Outsider (for sideloading)</a></p>
<p>(Don&#8217;t know how to sideload an app? <a href="http://www.imaginativeuniversal.com/blog/post/2010/12/15/Windows-Phone-7-Side-Loading.aspx">James Ashley has a great post on sideloading to the emulator or to a device.</a>)</p>
<p>The funniest thing is that the “big idea” in this app isn’t really even the app itself. The app is really just the most complete extension of the original idea.</p>
<p>You see, last year at MIX 10, there was a massive coordination effort among my colleagues to try and sit together during the keynote talks. This led to e-mails, text messages, phone calls, and tweets with hard to understand directions like</p>
<p>“We’re 12 rows from the back in the middle of the far right side as you come in (stage left).”</p>
<p>But my decision to do something about it came when a friend spent 10+ minutes with his lunch plate in hand trying to find our table. I thought, “This is absurd… there must be a better way to find people.”</p>
<p>Unfortunately, my GPS did not work very well inside the conference… which didn’t really matter since (I assume) no one wants to open up a Google Maps or Bing Maps to find people inside a building.</p>
<p>So Jason Alderman and I discussed the problem and thought that it might be fun to do a “Battleship” metaphor for finding people at MIX11, laying the grid on a map of the conference floor. Based on that concept, I wrote a little application that allows user to tap to see where they are and send that information out. It then collects all the messages sent out with the app and shows them on the map with the users’ twitter avatars.</p>
<p>Users can send public messages using Twitter or private messages via text message or e-mail. Private messages are not broadcast and cannot be seen by anyone. They contain only the helpful link to the MIX Outsider reference website (designed by the aforementioned Jason Alderman) without any identifying information.</p>
<p>But my biggest hope is that this application gives people a point of reference so that even people who don’t have a Windows Phone 7 device can see the tweets, reference the website and still find the people they want to meet at MIX11.</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2011/04/08/introducing-mix11-outsider-for-windows-phone-7/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Introducing+MIX11+Outsider+for+Windows+Phone+7+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1295" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Introducing+MIX11+Outsider+for+Windows+Phone+7+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1295" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2011/04/08/introducing-mix11-outsider-for-windows-phone-7/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Fun Theme-Friendly Windows Phone Icon</title>
		<link>http://www.designersilverlight.com/2011/01/28/fun-theme-friendly-windows-phone-icon/</link>
		<comments>http://www.designersilverlight.com/2011/01/28/fun-theme-friendly-windows-phone-icon/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 18:34:15 +0000</pubDate>
		<dc:creator>Matthias Shapiro</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[Bing Maps]]></category>
		<category><![CDATA[Icon]]></category>
		<category><![CDATA[themes]]></category>

		<guid isPermaLink="false">http://www.designersilverlight.com/?p=1287</guid>
		<description><![CDATA[When designing a “You are here” icon for the map in ShopSavvy (download now on iPhone, Android and Windows Phone 7. It’s free and super awesome), I decided to try something a little different. Because ShopSavvy is a theme-compliant application, I thought it might be fun to have the “you are here” icon be representation [...]]]></description>
			<content:encoded><![CDATA[<p>When designing a “You are here” icon for the map in ShopSavvy (download now on iPhone, Android and Windows Phone 7. It’s free and super awesome), I decided to try something a little different. Because ShopSavvy is a theme-compliant application, I thought it might be fun to have the “you are here” icon be representation of the user’s actual phone. </p>
<p>So I created a little XAML icon that is a very rough approximation of the front Windows Phone 7 screen. I used shapes and theme-variant brushes so that the icon changes to represent whatever theme the user has in place on their phone. </p>
<p>Because the the icon is so small (48-by-80 px), I used only basic shapes and one custom path shape to represent the “maps” application. I also did everything on a “Canvas” in order to try to trim off as much layout computation time as possible. You could make it with a Grid and then scale it to your heart’s content. Probably won’t make a huge difference, but I’m paranoid about resources in my phone apps these days.</p>
<p>Here are a couple examples of how the icon could look, depending on the user’s theme choice:</p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image22.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb22.png" width="72" height="114" /></a>&#160; <a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image23.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb23.png" width="69" height="108" /></a>&#160; <a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image24.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb24.png" width="73" height="112" /></a></p>
<p><a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image25.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb25.png" width="72" height="108" /></a>&#160; <a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image26.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb26.png" width="69" height="108" /></a>&#160; <a href="http://www.designersilverlight.com/wp-content/uploads/2011/01/image27.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.designersilverlight.com/wp-content/uploads/2011/01/image_thumb27.png" width="82" height="115" /></a></p>
<p>All from the same XAML. </p>
<p>For the ShopSavvy version, I put a tiny little ShopSavvy icon at the top. In the code below, I took it out so the top right-hand will simply be a blank box. Or you would put a tiny version of your own app icon there.</p>
<p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:62bc71cd-d88c-4712-8d02-3ae49c861ef9" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px">Themed Windows Phone 7 Icon</div>
<div style="background: #ddd; max-height: 500px; overflow: auto">
<ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;">
<li><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Microsoft_Phone_Controls_Maps</span><span style="color:#0000ff">:</span><span style="color:#a31515">Pushpin</span><span style="color:#0000ff">&gt;</span></li>
<li style="background: #f3f3f3">    <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Border</span><span style="color:#ff0000"> BorderBrush</span><span style="color:#0000ff">=&quot;#FF9B9B9B&quot;</span><span style="color:#ff0000"> BorderThickness</span><span style="color:#0000ff">=&quot;1&quot;</span> </li>
<li>           <span style="color:#ff0000"> HorizontalAlignment</span><span style="color:#0000ff">=&quot;Center&quot;</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;80&quot;</span> </li>
<li style="background: #f3f3f3">           <span style="color:#ff0000"> VerticalAlignment</span><span style="color:#0000ff">=&quot;Center&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;48&quot;</span> </li>
<li>           <span style="color:#ff0000"> CornerRadius</span><span style="color:#0000ff">=&quot;4&quot;</span><span style="color:#ff0000"> Background</span><span style="color:#0000ff">=&quot;Black&quot;&gt;</span></li>
<li style="background: #f3f3f3">    <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Canvas</span><span style="color:#0000ff">&gt;</span></li>
<li>        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Ellipse</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;#FFE4E4E4&quot;</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;3&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Stroke</span><span style="color:#0000ff">=&quot;Black&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;3&quot;</span> </li>
<li>                   <span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;71&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;6&quot;/&gt;</span></li>
<li style="background: #f3f3f3">        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Ellipse</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;#FFE4E4E4&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;3&quot;</span><span style="color:#ff0000"> Stroke</span><span style="color:#0000ff">=&quot;Black&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;3&quot;</span><span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;71&quot;</span><span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;22&quot;/&gt;</span></li>
<li style="background: #f3f3f3">        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Ellipse</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;#FFE4E4E4&quot;</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;3&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Stroke</span><span style="color:#0000ff">=&quot;Black&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;3&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;71&quot;</span><span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;37&quot;/&gt;</span></li>
<li style="background: #f3f3f3">        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;62&quot;</span><span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;3&quot;</span> </li>
<li>                   <span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;5&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;40&quot;</span><span style="color:#ff0000"> RadiusX</span><span style="color:#0000ff">=&quot;1&quot;</span> </li>
<li>                   <span style="color:#ff0000"> RadiusY</span><span style="color:#0000ff">=&quot;1&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;{</span><span style="color:#a31515">StaticResource</span><span style="color:#ff0000"> PhoneBackgroundBrush}</span><span style="color:#0000ff">&quot;/&gt;</span></li>
<li>        <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;{</span><span style="color:#a31515">StaticResource</span><span style="color:#ff0000"> PhoneAccentBrush}</span><span style="color:#0000ff">&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;13&quot;</span><span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;13&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;7&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;9&quot; /&gt;</span></li>
<li>        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;{</span><span style="color:#a31515">StaticResource</span><span style="color:#ff0000"> PhoneAccentBrush}</span><span style="color:#0000ff">&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;13&quot;</span><span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;13&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;21&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;9&quot; /&gt;                </span></li>
<li style="background: #f3f3f3">        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;{</span><span style="color:#a31515">StaticResource</span><span style="color:#ff0000"> PhoneAccentBrush}</span><span style="color:#0000ff">&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;13&quot;</span><span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;13&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;7&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;23&quot; /&gt;            </span></li>
<li>        <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;{</span><span style="color:#a31515">StaticResource</span><span style="color:#ff0000"> PhoneAccentBrush}</span><span style="color:#0000ff">&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;13&quot;</span><span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;13&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;21&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;23&quot; /&gt;</span><span style="color:#a31515">           </span></li>
<li style="background: #f3f3f3">        <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;{</span><span style="color:#a31515">StaticResource</span><span style="color:#ff0000"> PhoneAccentBrush}</span><span style="color:#0000ff">&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;13&quot;</span><span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;27&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;7&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;37&quot; /&gt;</span><span style="color:#a31515">                        </span></li>
<li>        <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Ellipse</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;3&quot;</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;{</span><span style="color:#a31515">StaticResource</span><span style="color:#ff0000"> PhoneForegroundBrush}</span><span style="color:#0000ff">&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Stroke</span><span style="color:#0000ff">=&quot;Black&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;3&quot;</span> </li>
<li>                   <span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;10&quot;</span><span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;37&quot; /&gt;                            </span></li>
<li>        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;{</span><span style="color:#a31515">StaticResource</span><span style="color:#ff0000"> PhoneAccentBrush}</span><span style="color:#0000ff">&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;13&quot;</span><span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;13&quot;</span><span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;7&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;51&quot; /&gt;</span></li>
<li style="background: #f3f3f3">        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;{</span><span style="color:#a31515">StaticResource</span><span style="color:#ff0000"> PhoneAccentBrush}</span><span style="color:#0000ff">&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;13&quot;</span><span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;13&quot;</span><span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;21&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;51&quot; /&gt;</span></li>
<li>        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Ellipse</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;White&quot;</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;7&quot;</span><span style="color:#ff0000"> Stroke</span><span style="color:#0000ff">=&quot;Black&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;7&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;12&quot;</span><span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;10&quot;/&gt;</span></li>
<li style="background: #f3f3f3">        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;White&quot;</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;5&quot;</span><span style="color:#ff0000"> Stroke</span><span style="color:#0000ff">=&quot;Black&quot;</span> </li>
<li>                   <span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;7&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;10&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;27&quot;/&gt;</span></li>
<li>        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;White&quot;</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;5&quot;</span><span style="color:#ff0000"> Stroke</span><span style="color:#0000ff">=&quot;Black&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;5&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;28&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;43&quot;/&gt;</span></li>
<li style="background: #f3f3f3">        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;White&quot;</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;2&quot;</span><span style="color:#ff0000"> Stroke</span><span style="color:#0000ff">=&quot;Black&quot;</span> </li>
<li>                   <span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;21&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;46&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;5&quot;/&gt;</span></li>
<li>        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Path</span><span style="color:#ff0000"> Data</span><span style="color:#0000ff">=&quot;M226.1875,316.1875 L230.5,321.5 L232.75,322 L234.25,324 L235.5,325.5 L236.75,327.25 L238.875,328.375 L238.9375,316.125 z&quot;</span> </li>
<li style="background: #f3f3f3">               <span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;White&quot;</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;12.25&quot;</span> </li>
<li>               <span style="color:#ff0000"> Stretch</span><span style="color:#0000ff">=&quot;Fill&quot;</span><span style="color:#ff0000"> Stroke</span><span style="color:#0000ff">=&quot;Black&quot;</span> </li>
<li style="background: #f3f3f3">               <span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span><span style="color:#ff0000"> UseLayoutRounding</span><span style="color:#0000ff">=&quot;False&quot;</span> </li>
<li>               <span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;21.2&quot;</span> </li>
<li style="background: #f3f3f3">               <span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;51.1&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;12.751&quot;/&gt;</span></li>
<li>        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;White&quot;</span><span style="color:#ff0000"> Stroke</span><span style="color:#0000ff">=&quot;Black&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;7&quot;</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;5&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;9&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;55&quot;/&gt;</span></li>
<li style="background: #f3f3f3">        <span style="color:#0000ff">&lt;</span><span style="color:#a31515">Ellipse</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;White&quot;</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;6&quot;</span> </li>
<li>                   <span style="color:#ff0000"> Stroke</span><span style="color:#0000ff">=&quot;Black&quot;</span><span style="color:#ff0000"> StrokeThickness</span><span style="color:#0000ff">=&quot;0&quot;</span> </li>
<li style="background: #f3f3f3">                   <span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;6&quot;</span><span style="color:#ff0000"> Canvas.Top</span><span style="color:#0000ff">=&quot;26&quot;</span><span style="color:#ff0000"> Canvas.Left</span><span style="color:#0000ff">=&quot;24&quot;/&gt;</span></li>
<li>                        </li>
<li style="background: #f3f3f3">    <span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Canvas</span><span style="color:#0000ff">&gt;</span></li>
<li><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Border</span><span style="color:#0000ff">&gt;</span></li>
<li style="background: #f3f3f3"><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Microsoft_Phone_Controls_Maps</span><span style="color:#0000ff">:</span><span style="color:#a31515">Pushpin</span><span style="color:#0000ff">&gt;</span></li>
</ol></div>
</p></div>
</p></div>
</p>
<p>Not much. Just something fun that I thought might be fun to share</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http://www.designersilverlight.com/2011/01/28/fun-theme-friendly-windows-phone-icon/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Fun+Theme-Friendly+Windows+Phone+Icon+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1287" title="Post to Twitter"><img class="nothumb" src="http://www.designersilverlight.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Fun+Theme-Friendly+Windows+Phone+Icon+http%3A%2F%2Fdesignersilverlight.com%2F%3Fp%3D1287" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersilverlight.com/2011/01/28/fun-theme-friendly-windows-phone-icon/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

