<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Sudhindra Kovalam&#039;s Blog</title>
	<atom:link href="http://sudheerkovalam.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sudheerkovalam.wordpress.com</link>
	<description>My Geeky Blog</description>
	<lastBuildDate>Wed, 04 Jan 2012 12:08:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sudheerkovalam.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Sudhindra Kovalam&#039;s Blog</title>
		<link>http://sudheerkovalam.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sudheerkovalam.wordpress.com/osd.xml" title="Sudhindra Kovalam&#039;s Blog" />
	<atom:link rel='hub' href='http://sudheerkovalam.wordpress.com/?pushpress=hub'/>
		<item>
		<title>My Experiences in Silverlight 4 : Writing re-usable Controls</title>
		<link>http://sudheerkovalam.wordpress.com/2011/04/04/my-experiences-in-silverlight-4-writing-re-usable-controls/</link>
		<comments>http://sudheerkovalam.wordpress.com/2011/04/04/my-experiences-in-silverlight-4-writing-re-usable-controls/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 18:43:00 +0000</pubDate>
		<dc:creator>sudheerkovalam</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Custom Controls]]></category>
		<category><![CDATA[Silverlight 4]]></category>
		<category><![CDATA[Template Binding]]></category>

		<guid isPermaLink="false">https://sudheerkovalam.wordpress.com/?p=215</guid>
		<description><![CDATA[These days I am working on Silverlight and creating Custom controls which would be re-usable in another projects. And when you set out to write re-usable Silverlight controls, Silverlight toolkit is the best code to look up to. When you download the Silverlight toolkit. The toolkit installer also copies source code of the toolkit at&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=215&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>These days I am working on Silverlight and creating Custom controls which would be re-usable in another projects. And when you set out to write re-usable Silverlight controls, Silverlight toolkit is the best code to look up to. </p>
<p>When you download the Silverlight toolkit. The toolkit installer also copies source code of the toolkit at&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; “%Program Files%\Microsoft SDKs\Silverlight\v4.0\Toolkit\Apr10\Source” folder. When you start exploring the source code, you will notice a peculiar way the source code for toolkit is arranged. Every control in toolkit is written as a content control and has a resource dictionary that has a default style.</p>
<p><a href="http://sudheerkovalam.files.wordpress.com/2011/04/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 5px;" title="image" border="0" alt="image" src="http://sudheerkovalam.files.wordpress.com/2011/04/image_thumb.png?w=351&#038;h=363" width="351" height="363" /></a>&#160;</p>
<p>So, inspired by this style of writing custom controls, I set out. Now the reason why you want write a custom control is you require certain custom fields and a custom style and behaviors. So when you define these controls and the style, you also want your custom properties to appear in your style(Or else why would you define those additional controls. Typically your style for your control would look something like this.</p>
<p>&#160;</p>
<p>and the your custom control would look something like this.</p>
<p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:8b0eebd9-5e3c-4e98-9f9d-37e312c1d905" class="wlWriterEditableSmartContent">
<pre style="white-space:normal;">
<pre class="brush: xml; pad-line-numbers: true;">
&lt;ResourceDictionary   xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
  xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
  xmlns:vsm=&quot;clr-namespace:System.Windows;assembly=System.Windows&quot;
  xmlns:layoutPrimitivesToolkit=&quot;clr-namespace:System.Windows.Controls.Primitives&quot;
  xmlns:layoutToolkit=&quot;clr-namespace:System.Windows.Controls&quot;&gt;

  &lt;Style TargetType=&quot;my:CustomControl1&quot;&gt;
    &lt;Setter Property=&quot;Foreground&quot; Value=&quot;#FF000000&quot; /&gt;
    &lt;Setter Property=&quot;BorderBrush&quot; Value=&quot;#FFEAEAEA&quot;/&gt;
    &lt;Setter Property=&quot;HorizontalAlignment&quot; Value=&quot;Left&quot; /&gt;
    &lt;Setter Property=&quot;Template&quot;&gt;
      &lt;Setter.Value&gt;
        &lt;ControlTemplate TargetType=&quot;my:CustomControl1&quot;&gt;
          &lt;Grid x:Name=&quot;Root&quot;&gt;
            &lt;vsm:VisualStateManager.VisualStateGroups/&gt;
            &lt;Border
              	x:Name=&quot;Border&quot;
              	BorderThickness=&quot;{TemplateBinding BorderThickness}&quot; Padding=&quot;{TemplateBinding Padding}&quot; Background=&quot;{TemplateBinding Background}&quot; 
              	BorderBrush=&quot;{TemplateBinding BorderBrush}&quot;&gt;
						&lt;TextBlock Text={TemplateBinding MyCustomProperty1}
              &lt;/Border&gt;
          &lt;/Grid&gt;
        &lt;/ControlTemplate&gt;
      &lt;/Setter.Value&gt;
    &lt;/Setter&gt;
  &lt;/Style&gt;
&lt;/ResourceDictionary&gt;
</pre>
</pre>
</div>
<p>And your .cs file would look something like this. Notice that there is a peculiar way I chose to name the Dependency Property. You might want to follow this pattern (i.e. your DependencyProperty should be named your Variabale Name suffixed with “Property”.</p>
<p>You must adhere to this Naming convention if you intend to use Blend in your Project. (If your Dependency Property is named otherwise, You might not be able to Use Blend to set these template Bindings.)</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:e1aa79a4-2cd0-4c49-8afb-bd469eeddb02" class="wlWriterEditableSmartContent">
<pre style="white-space:normal;">
<pre class="brush: csharp;">
  public class MyCustomControl1 : ContentControl
    {

			public string MyCustomProperty1
        {
            get { return (ExpandDirection)GetValue(MyCustomProperty1Property); }
            protected internal set
            { SetValue(MyCustomProperty1Property, value); }
        }

        public static readonly DependencyProperty MyCustomProperty1Property=
                DependencyProperty.Register(
                        &quot;MyCustomProperty1&quot;,
                        typeof(string),
                        typeof(MyCustomControl1),
                        new PropertyMetadata(ExpandDirection.Down, OnExpandDirectionPropertyChanged));
...
</pre>
</pre>
</div>
<p>&#160;</p>
<p>Now my control should show the value I set in MyCustomProperty1 on the UI right?. Something like this:</p>
<p><div style="display:inline;float:none;margin:0;padding:0;" id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:0aaa0ceb-f23c-4581-9376-11892c4a0e8a" class="wlWriterEditableSmartContent">
<pre style="white-space:normal;">
<pre class="brush: xml;">
&lt;Grid x:Name=&quot;LayourRoot&quot;&gt;
	&lt;my:CustomControl1  MyCustomProperty1=&quot;Hello Content Control&quot;/&gt;
&lt;/Grid&gt;
</pre>
</pre>
</div>
<p>But this does-not seem to happen. After searching for sometime on <a href="http://forums.silverlight.net/forums/" target="_blank">Silverlight .Net forums</a>, I could not exactly find out what I was doing wrong here. After some Binging on Bing and Binging on Google <img style="border-style:none;" class="wlEmoticon wlEmoticon-smilewithtongueout" alt="Smile with tongue out" src="http://sudheerkovalam.files.wordpress.com/2011/04/wlemoticon-smilewithtongueout.png?w=580" /> . I found that for custom properties, TemplateBinding doesnot seem to work the way I expect it to work.</p>
<p>So instead as per the suggestions on the <a href="http://forums.silverlight.net/forums/" target="_blank">Silverlight .Net forums</a>, I modified the template of the control by replacing TemplateBinding. Now My TextBlock Markup looks something like this.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:b427e626-c05d-4f9e-9bf3-15f76bca27d0" class="wlWriterEditableSmartContent">
<pre style="white-space:normal;">
<pre class="brush: xml;">
&lt;TextBlock Text={Binding RelativeSource={RelativeSource TemplatedParent},Path=MyCustomProperty1} /&gt;
</pre>
</pre>
</div>
<p>&#160;</p>
<p>Now My Template binding works as I expect it to work. Essential what has changed in the previous representation and the new representation is still a matter of research for me. Will Keep posting more about this as and when I discover more about it.</p>
<p>If I have made any mistakes, feel free to write Comments about what I am mistaken about. I&#8217;ll Happily Correct it <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sudheerkovalam.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sudheerkovalam.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sudheerkovalam.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sudheerkovalam.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sudheerkovalam.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sudheerkovalam.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sudheerkovalam.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sudheerkovalam.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sudheerkovalam.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sudheerkovalam.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sudheerkovalam.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sudheerkovalam.wordpress.com/215/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sudheerkovalam.wordpress.com/215/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sudheerkovalam.wordpress.com/215/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=215&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sudheerkovalam.wordpress.com/2011/04/04/my-experiences-in-silverlight-4-writing-re-usable-controls/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>18.507673 73.800734</georss:point>
		<geo:lat>18.507673</geo:lat>
		<geo:long>73.800734</geo:long>
		<media:content url="http://0.gravatar.com/avatar/467f451b75e69e3409c660cbbf0737cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sudheerkovalam</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2011/04/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2011/04/wlemoticon-smilewithtongueout.png" medium="image">
			<media:title type="html">Smile with tongue out</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Open XML SDK v2.0 on Windows Azure</title>
		<link>http://sudheerkovalam.wordpress.com/2011/02/19/using-open-xml-sdk-v2-0-on-windows-azure/</link>
		<comments>http://sudheerkovalam.wordpress.com/2011/02/19/using-open-xml-sdk-v2-0-on-windows-azure/#comments</comments>
		<pubDate>Sat, 19 Feb 2011 03:38:00 +0000</pubDate>
		<dc:creator>sudheerkovalam</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[.NET 4 Roles on Azure]]></category>
		<category><![CDATA[Intellitrace]]></category>
		<category><![CDATA[Open XML format]]></category>
		<category><![CDATA[Open XML SDK v2.0]]></category>
		<category><![CDATA[Word Report Generation]]></category>

		<guid isPermaLink="false">https://sudheerkovalam.wordpress.com/?p=203</guid>
		<description><![CDATA[Hello folks, Its been really long that I have written a post. And I have no excuses, Just couldn’t find the right time and the right topic to blog on . Generating Word/Excel reports is a fairly common requirement. Now that we intend to migrate our application to cloud, we realize that on Windows Azure, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=203&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hello folks,</p>
<p>Its been really long that I have written a post. And I have no excuses, Just couldn’t find the right time and the right topic to blog on <img style="border-style:none;" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="Open-mouthed smile" src="http://sudheerkovalam.files.wordpress.com/2011/02/wlemoticon-openmouthedsmile.png?w=580" />.</p>
<p>Generating Word/Excel reports is a fairly common requirement. Now that we intend to migrate our application to cloud, we realize that on Windows Azure, You do-not have&#160; Office DLLs or infact, any other (unnecessary from Azure’s perspective) DLLs available to you. You can always package Office DLLs with your app deployment package and use them in you application on Windows Azure (You can find articles on the blogosphere about how this can be done).</p>
<p>I opted for using <a href="http://www.openxmldeveloper.org/" target="_blank">Open XML SDK v2.0</a>. Using Open XML SDK for .NET available <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyId=C6E744E5-36E9-45F5-8D8C-331DF206E0D0&amp;displaylang=en" target="_blank">here</a> . I Can generated Word / Excel reports on the fly. </p>
<p>Here’s a sample code to write to create a Word Document</p>
<p><pre class="brush: csharp;">  
//Using Statements Required 
using DocumentFormat.OpenXml;    
using DocumentFormat.OpenXml.Packaging;    
using DocumentFormat.OpenXml.Wordprocessing;      

//Code to Create a Word Document at the provided File Path    
using (WordprocessingDocument wordDocument =
    	WordprocessingDocument.Create(filepath, WordprocessingDocumentType.Document))
    		{
   			mainPart.Document = new Document(
   				new Body(
   					new Paragraph(
   						new Run(
   							new Text(&quot;Report Generated by Open XML SDK &quot;)))));
   			wordDocument.MainDocumentPart.Document.Save();
   			wordDocument.Close();
   		} 
</pre>      </p>
<p>ok. Now that we have everything in place, We’d want to deploy this “Report Generation Solution” to the cloud. But First , run it locally on the compute Emulator.</p>
<p>Everything seems to be working, Next step is to deploy your application to your azure account.</p>
<p>This blog post talks about a <a href="http://social.msdn.microsoft.com/Forums/en/windowsazure/thread/2cd7264f-4d7f-431e-81d1-5bea388f756b" target="_blank">known issue</a> on using Open XML SDK in&#160; .NET 4 Roles on Windows Azure.</p>
<p>When you right click your solution to do a publish</p>
<p>&#160;<a href="http://sudheerkovalam.files.wordpress.com/2011/02/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 5px;" title="image" border="0" alt="image" src="http://sudheerkovalam.files.wordpress.com/2011/02/image_thumb.png?w=299&#038;h=338" width="299" height="338" /></a></p>
<p>Windows Azure would ask you for the Hosted service where you want to deploy the solution, If you have not already set that up, the dialog box also has a provision to do that for you.</p>
<p><a href="http://sudheerkovalam.files.wordpress.com/2011/02/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 5px;" title="image" border="0" alt="image" src="http://sudheerkovalam.files.wordpress.com/2011/02/image_thumb1.png?w=322&#038;h=373" width="322" height="373" /></a></p>
<p>Please Remember to <strong>UnCheck, </strong>(you read that right) “<strong>UNCHECK</strong>” Enable Intellitrace for .NET 4 roles.</p>
<p>You may want to argue that Intellitrace helps us in historical debugging in an event&#160; of a fatal crash, but for now you will have to live with the Windows Azure Diagnostics Logging for now.</p>
<p>The reason, why this needs to be disable is, <em>“Enabling Intellitrace for .NET 4 roles when using the OPEN XML SDK seems to freeze your web/worker role.”</em></p>
<p>I Learnt this the hard way (after being billed for a week for a&#160; (Frozen, just because I Enabled Intellitrace and am using Open XML SDK in my azure app) Extra Large VM ). In other words, that’s a lot of money. <img style="border-style:none;" class="wlEmoticon wlEmoticon-cryingface" alt="Crying face" src="http://sudheerkovalam.files.wordpress.com/2011/02/wlemoticon-cryingface.png?w=580" /><img style="border-style:none;" class="wlEmoticon wlEmoticon-cryingface" alt="Crying face" src="http://sudheerkovalam.files.wordpress.com/2011/02/wlemoticon-cryingface.png?w=580" /><img style="border-style:none;" class="wlEmoticon wlEmoticon-cryingface" alt="Crying face" src="http://sudheerkovalam.files.wordpress.com/2011/02/wlemoticon-cryingface.png?w=580" />&#160;</p>
<p>Keep reading this space for such posts to come. I am working on Windows Azure now, So I am sure there are many such topics on which I can post. <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://sudheerkovalam.files.wordpress.com/2011/02/wlemoticon-smile.png?w=580" />. Thank You.</p>
</p></div>
</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sudheerkovalam.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sudheerkovalam.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sudheerkovalam.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sudheerkovalam.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sudheerkovalam.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sudheerkovalam.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sudheerkovalam.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sudheerkovalam.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sudheerkovalam.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sudheerkovalam.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sudheerkovalam.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sudheerkovalam.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sudheerkovalam.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sudheerkovalam.wordpress.com/203/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=203&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sudheerkovalam.wordpress.com/2011/02/19/using-open-xml-sdk-v2-0-on-windows-azure/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>18.507673 73.800734</georss:point>
		<geo:lat>18.507673</geo:lat>
		<geo:long>73.800734</geo:long>
		<media:content url="http://0.gravatar.com/avatar/467f451b75e69e3409c660cbbf0737cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sudheerkovalam</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2011/02/wlemoticon-openmouthedsmile.png" medium="image">
			<media:title type="html">Open-mouthed smile</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2011/02/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2011/02/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2011/02/wlemoticon-cryingface.png" medium="image">
			<media:title type="html">Crying face</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2011/02/wlemoticon-cryingface.png" medium="image">
			<media:title type="html">Crying face</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2011/02/wlemoticon-cryingface.png" medium="image">
			<media:title type="html">Crying face</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2011/02/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	</item>
		<item>
		<title>Community Techdays Mumbai</title>
		<link>http://sudheerkovalam.wordpress.com/2010/11/26/community-techdays-mumbai/</link>
		<comments>http://sudheerkovalam.wordpress.com/2010/11/26/community-techdays-mumbai/#comments</comments>
		<pubDate>Fri, 26 Nov 2010 04:49:41 +0000</pubDate>
		<dc:creator>sudheerkovalam</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>

		<guid isPermaLink="false">http://sudheerkovalam.wordpress.com/?p=192</guid>
		<description><![CDATA[I am travelling to Mumbai tomorrow. I would be speaking at community tech days there along with mayur tendulkar. My session is called Developing Line of Business applications for Windows Phone Hope to catch some of you folks there For more details visit : http://www.communitytechdays.com/agenda.aspx#mumbai Those who are attending , Lemme assure you, You folks are in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=192&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am travelling to Mumbai tomorrow. I would be speaking at community tech days there along with mayur tendulkar. My session is called</p>
<p><strong>Developing Line of Business applications for Windows Phone</strong></p>
<p>Hope to catch some of you folks there <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>For more details visit : <a href="http://www.communitytechdays.com/agenda.aspx#mumbai">http://www.communitytechdays.com/agenda.aspx#mumbai</a></p>
<p>Those who are attending , Lemme assure you, You folks are in for a treat <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>See you there.</p>
<p>Also, if you are keen on learnign windows phone development, there is an ongoing screencast series (organised by Pune User Group) on windows phone 7 development. you can find more info at</p>
<p><a href="http://www.puneusergroup.org/windows-phone-7-webcasts.aspx">http://www.puneusergroup.org/windows-phone-7-webcasts.aspx</a></p>
<p>Also stay tuned on this blog.</p>
<p> Some really really cool articles are in the works <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sudheerkovalam.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sudheerkovalam.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sudheerkovalam.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sudheerkovalam.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sudheerkovalam.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sudheerkovalam.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sudheerkovalam.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sudheerkovalam.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sudheerkovalam.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sudheerkovalam.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sudheerkovalam.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sudheerkovalam.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sudheerkovalam.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sudheerkovalam.wordpress.com/192/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=192&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sudheerkovalam.wordpress.com/2010/11/26/community-techdays-mumbai/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>18.507673 73.800734</georss:point>
		<geo:lat>18.507673</geo:lat>
		<geo:long>73.800734</geo:long>
		<media:content url="http://0.gravatar.com/avatar/467f451b75e69e3409c660cbbf0737cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sudheerkovalam</media:title>
		</media:content>
	</item>
		<item>
		<title>Writing windows phone apps for SharePoint</title>
		<link>http://sudheerkovalam.wordpress.com/2010/11/04/writing-windows-phone-apps-for-sharepoint/</link>
		<comments>http://sudheerkovalam.wordpress.com/2010/11/04/writing-windows-phone-apps-for-sharepoint/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 15:03:01 +0000</pubDate>
		<dc:creator>sudheerkovalam</dc:creator>
				<category><![CDATA[Application Design]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[WP7dev]]></category>

		<guid isPermaLink="false">https://sudheerkovalam.wordpress.com/?p=184</guid>
		<description><![CDATA[Writing a blog post after quite some time. (Well frankly was thinking on what sort of post to write) We have heard / seen / read about how windows phone has good SharePoint 2010 integration features as to how the office hub can integrate with your corporate intranet SharePoint site and how, you can leverage [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=184&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Writing a blog post after quite some time. (Well frankly was thinking on what sort of post to write)</p>
<p>We have heard / seen / read about how windows phone has good SharePoint 2010 integration features as to how the office hub can integrate with your corporate intranet SharePoint site and how, you can leverage the SharePoint workspace capabilities in windows phone.</p>
<p>after reading about this, you’d say cool, can i write an app which speaks to my SharePoint site. Well the answer is Yes. But there are some changes that you need to to do on SharePoint site configuration.</p>
<p>“Argh!!, making changes on SharePoint site, My boss(and/or system admin) will kill me! “.</p>
<p>Was this your reaction ? (at least, that was my initial reaction).</p>
<p>In that case, this post might not be of that much help.</p>
<p>However, we can always host a cloud service that would help you get data from SharePoint and you can consume the data from this “middle man” cloud service. ( Off course this does add up expenses that at the end of the day needs to be taken care off by some one)</p>
<p>So, why is that I cannot consume SharePoint service directly from my windows phone.</p>
<p>Well it all began, when windows phone SDK team decided to omit NTLM auth support from the SDK, thus preventing us 3rd party developers from directly writing cool apps that speak to your SharePoint site.</p>
<p>“Why did they do this to us? “ you ask!!, Well frankly, i don&#8217;t have an answer to that.</p>
<p>But, There is a way out of this. How is that? Well , all you got to do is enable Forms based authentication for your SharePoint site.</p>
<p>How do I do that? There is a good article <a href="http://blogs.msdn.com/b/sridhara/archive/2010/01/07/setting-up-fba-claims-in-sharepoint-2010-with-active-directory-membership-provider.aspx" target="_blank">here</a>. (Remember, you need to be very very strong hearted to take up all these changes, as these changes might literally take down your SharePoint site. )</p>
<p>Here’s a pictorial representation of auth mechanisms and SharePoint support for the same.</p>
<p>(Stolen from Paul Stubbs blog on MSDN, Sorry!! )</p>
<p><a href="http://sudheerkovalam.files.wordpress.com/2010/11/5488-image_thumb_0d9fc62a.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 5px;" title="5488.image_thumb_0D9FC62A" src="http://sudheerkovalam.files.wordpress.com/2010/11/5488-image_thumb_0d9fc62a_thumb.png?w=583&#038;h=368" border="0" alt="5488.image_thumb_0D9FC62A" width="583" height="368" /></a></p>
<p>Well what story, the above diagram is trying to tell is:</p>
<p>SharePoint 2010 supports two different authentication modes.</p>
<p>1. Classic mode (The Loner left side branch, support NTLM authentication only)</p>
<p>2. Claims based mode (The right side branch of the diagram above)</p>
<p>What you can realise is that if you use the <strong>claims based mode</strong> for creating your SharePoint web application, you can use any of the claims providers to authenticate yourself (in this case, your phone app’s code) to your SharePoint site. (Off course, your system administrator can have hard time configuring the same, but lets not get into that <img class="wlEmoticon wlEmoticon-openmouthedsmile" style="border-style:none;" src="http://sudheerkovalam.files.wordpress.com/2010/11/wlemoticon-openmouthedsmile.png?w=580" alt="Open-mouthed smile" />)</p>
<p>Once you have the infrastructure in place. All you got to do is use the SharePoint 2010 Web services to access SharePoint lists etc.</p>
<p>In SharePoint, you cannot make any changes to a spsite until you are an authenticated user. So You need to log in programmatically to make changes such as adding list items, modifying ‘em etc.</p>
<p>For Logging in , you can use the authentication.asmx web service to authenticate yourself.</p>
<p>(the spsite you are trying to access via your code needs to allow form based authentication.) The Authentication site is available at : <a href="http://[YourSiteName]/_vti_bin/authentication.asmx">http://[YourSiteName]/_vti_bin/authentication.asmx</a></p>
<h2>Logging into SharePoint</h2>
<p>Here’s what happens when you visit a SharePoint site: (Again stolen for Paul stubbs’ blog , sorry again!!)</p>
<p><a href="http://sudheerkovalam.files.wordpress.com/2010/11/4606-image_4d69acaf.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 5px;" title="4606.image_4D69ACAF" src="http://sudheerkovalam.files.wordpress.com/2010/11/4606-image_4d69acaf_thumb.png?w=720&#038;h=349" border="0" alt="4606.image_4D69ACAF" width="720" height="349" /></a></p>
<p>1. you visit a SharePoint site page.</p>
<p>2. you are redirected to the login page(this internally uses the authentication web service), you enter your credentials here.</p>
<p>3. the authentication service returns a security token(FEDAUTH).</p>
<p>4. this security token is passed for all subsequent calls to the SharePoint site.</p>
<p>5. this security token is verified by the server for validity and then the server returns the requested resource.</p>
<h3>How Do I do this Programatically?</h3>
<p>Well, for programmatically mimicking the above mentioned behaviour, you can write  code that looks something like this:</p>
<div id="scid:9EDA38F6-AE13-4003-B74A-83E8474F528D:19b5d02e-ae78-4334-add1-27142583bbf7" class="wlWriterEditableSmartContent" style="width:701px;display:block;float:none;margin-left:auto;margin-right:auto;padding:0;"><pre class="brush: csharp;">
CookieContainer cookieJar = new CookieContainer();
    private void Authenticate()
    {
      System.Uri authServiceUri = new Uri(&quot;http://[YourSPSite]/_vti_bin/authentication.asmx&quot;);

      HttpWebRequest spAuthReq = HttpWebRequest.Create(authServiceUri) as HttpWebRequest;
      spAuthReq.CookieContainer = cookieJar;
      spAuthReq.Headers[&quot;SOAPAction&quot;] = &quot;http://schemas.microsoft.com/sharepoint/soap/Login&quot;;
      spAuthReq.ContentType = &quot;text/xml; charset=utf-8&quot;;
      //spAuthReq.Accept = &quot;text/xml&quot;;
      spAuthReq.Method = &quot;POST&quot;;

      //add the soap message to the request
      spAuthReq.BeginGetRequestStream(new AsyncCallback(spAuthReqCallBack), spAuthReq);
    }

    private void spAuthReqCallBack(IAsyncResult asyncResult)
    {
      string envelope =
          @&quot;&lt;?xml version=&quot;&quot;1.0&quot;&quot; encoding=&quot;&quot;utf-8&quot;&quot;?&gt;
          &lt;soap:Envelope xmlns:xsi=&quot;&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&quot;
               xmlns:xsd=&quot;&quot;http://www.w3.org/2001/XMLSchema&quot;&quot;
                xmlns:soap=&quot;&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&quot;&gt;
          &lt;soap:Body&gt;
            &lt;Login xmlns=&quot;&quot;http://schemas.microsoft.com/sharepoint/soap/&quot;&quot;&gt;
            &lt;username&gt;{0}&lt;/username&gt;
            &lt;password&gt;{1}&lt;/password&gt;
            &lt;/Login&gt;
          &lt;/soap:Body&gt;
          &lt;/soap:Envelope&gt;&quot;;

      UTF8Encoding encoding = new UTF8Encoding();
      HttpWebRequest request = (HttpWebRequest)asyncResult.AsyncState;
      Stream _body = request.EndGetRequestStream(asyncResult);
      envelope = string.Format(envelope, &quot;userName&quot;, &quot;password&quot;);
      byte[] formBytes = encoding.GetBytes(envelope);

      _body.Write(formBytes, 0, formBytes.Length);
      _body.Close();

      request.BeginGetResponse(new AsyncCallback(ResponseCallback), request);
    }

    private void ResponseCallback(IAsyncResult asyncResult)
    {
      HttpWebRequest request = (HttpWebRequest)asyncResult.AsyncState;
      HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asyncResult);
      Stream content = response.GetResponseStream();

      if (request != null &amp;&amp; response != null)
      {
        if (response.StatusCode == HttpStatusCode.OK)
        {
          using (StreamReader reader = new StreamReader(content))
          {
            //Put debugging code here
            string _responseString = reader.ReadToEnd();
            reader.Close();
          }
        }
      }

      //authentication complete
      //Use the Cookie Container for all subsequent calls
    }

</pre></p>
</div>
<p>&nbsp;</p>
<p>Now that you have the FEDAUTH token in the CookieContainer instance, you can pass it around to access other list services.</p>
<div id="scid:9EDA38F6-AE13-4003-B74A-83E8474F528D:db605637-d44b-4d29-9a19-2e853b211dd8" class="wlWriterEditableSmartContent" style="padding:0;"><pre class="brush: csharp;">System.Uri listServiceUri = new Uri(&quot;http://[YourSpSite]/_vti_bin/lists.asmx&quot;);
HttpWebRequest spAuthReq = HttpWebRequest.Create(listServiceUri) as HttpWebRequest;
spAuthReq.CookieContainer = cookieJar;</pre></p>
</div>
<p>&nbsp;</p>
<p>Will try and post up a complete working sample of the same very very soon! Till then keep checking this space for more updates <img class="wlEmoticon wlEmoticon-smile" style="border-style:none;" src="http://sudheerkovalam.files.wordpress.com/2010/11/wlemoticon-smile.png?w=580" alt="Smile" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sudheerkovalam.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sudheerkovalam.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sudheerkovalam.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sudheerkovalam.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sudheerkovalam.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sudheerkovalam.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sudheerkovalam.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sudheerkovalam.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sudheerkovalam.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sudheerkovalam.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sudheerkovalam.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sudheerkovalam.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sudheerkovalam.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sudheerkovalam.wordpress.com/184/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=184&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sudheerkovalam.wordpress.com/2010/11/04/writing-windows-phone-apps-for-sharepoint/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<georss:point>18.507673 73.800734</georss:point>
		<geo:lat>18.507673</geo:lat>
		<geo:long>73.800734</geo:long>
		<media:content url="http://0.gravatar.com/avatar/467f451b75e69e3409c660cbbf0737cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sudheerkovalam</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/11/5488-image_thumb_0d9fc62a_thumb.png" medium="image">
			<media:title type="html">5488.image_thumb_0D9FC62A</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/11/wlemoticon-openmouthedsmile.png" medium="image">
			<media:title type="html">Open-mouthed smile</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/11/4606-image_4d69acaf_thumb.png" medium="image">
			<media:title type="html">4606.image_4D69ACAF</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/11/wlemoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	</item>
		<item>
		<title>two minutes to PDC10</title>
		<link>http://sudheerkovalam.wordpress.com/2010/10/28/two-minutes-to-pdc10/</link>
		<comments>http://sudheerkovalam.wordpress.com/2010/10/28/two-minutes-to-pdc10/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 16:03:21 +0000</pubDate>
		<dc:creator>sudheerkovalam</dc:creator>
		
		<guid isPermaLink="false">http://sudheerkovalam.wordpress.com/?p=179</guid>
		<description><![CDATA[Here we are at microsoft mumbai office waiting for PDC 10 Keynote to begin. SteveB is expected to make some major announcements.  (lets hope its free  windowsphone 7 for everyone in india ) SteveB is pumped up as he claims . But no Developer Prance ??  lets hope my dream comes true. will keep tweeting [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=179&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here we are at microsoft mumbai office waiting for PDC 10 Keynote to begin.</p>
<p>SteveB is expected to make some major announcements.  (lets hope its free  windowsphone 7 for everyone in india <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
<p>SteveB is pumped up as he claims . But no Developer Prance ??  <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>lets hope my dream comes true. will keep tweeting about it</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sudheerkovalam.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sudheerkovalam.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sudheerkovalam.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sudheerkovalam.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sudheerkovalam.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sudheerkovalam.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sudheerkovalam.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sudheerkovalam.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sudheerkovalam.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sudheerkovalam.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sudheerkovalam.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sudheerkovalam.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sudheerkovalam.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sudheerkovalam.wordpress.com/179/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=179&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sudheerkovalam.wordpress.com/2010/10/28/two-minutes-to-pdc10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/467f451b75e69e3409c660cbbf0737cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sudheerkovalam</media:title>
		</media:content>
	</item>
		<item>
		<title>A Windows Phone Twitter Application : Part 2 of 2</title>
		<link>http://sudheerkovalam.wordpress.com/2010/09/05/a-windows-phone-twitter-application-part-2-of-2/</link>
		<comments>http://sudheerkovalam.wordpress.com/2010/09/05/a-windows-phone-twitter-application-part-2-of-2/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 14:12:37 +0000</pubDate>
		<dc:creator>sudheerkovalam</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[#wp7]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Windows Phone 7 Application]]></category>

		<guid isPermaLink="false">https://sudheerkovalam.wordpress.com/?p=165</guid>
		<description><![CDATA[(Update : For trying out code posted on this blog post, Kindly use the official/ locked emulator . The unlocked emulator images have a known issue with HTTPS ) This is the second post in the series of posts explaining how you can build your own twitter application on Windows Phone 7 Post(s) in this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=165&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><em>(Update : For trying out code posted on this blog post, Kindly use the official/ locked emulator . The unlocked emulator images have a known issue with HTTPS )</em></strong></p>
<p>This is the second post in the series of posts explaining how you can build your own twitter application on Windows Phone 7</p>
<p>Post(s) in this series:</p>
<p><a href="http://sudheerkovalam.wordpress.com/2010/08/28/a-windows-phone-7-twitter-application-part-1/" target="_blank">Part 1: Understanding oAuth</a></p>
<p>As explained in part one, the hard part of writing a twitter application is, to figure out/ understand the authentication/ authorization mechanism. Once You have done that, you can pretty much write an app for any service that has oauth as its authentication/authorization mechanism.</p>
<p>Now that we have obtained all the necessary authorization token(s), we can now access the protected resources on the user’s behalf.</p>
<h3>How to Post a Tweet on a User’s behalf?</h3>
<p>Using the access token and our app’s consumer secret , we need to make a POST request to twitter’s API to post a tweet from our app.</p>
<p>Using Hammock’s REST Library, You would do something like this :</p>
<div id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:72752f62-a602-485a-a776-5b8ee1a76ed8" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;"><pre class="brush: csharp; pad-line-numbers: true;">
if (txtBoxNewTweet.Text.Trim().Length == 0) { return; }
var credentials = new OAuthCredentials
{
      Type = OAuthType.ProtectedResource,
       SignatureMethod = OAuthSignatureMethod.HmacSha1,
       ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
       ConsumerKey = TwitterSettings.consumerKey,
       ConsumerSecret = TwitterSettings.consumerKeySecret,
       Token = this.accessToken,
       TokenSecret = this.accessTokenSecret,
       Version = &quot;1.0&quot;
};

var restClient = new RestClient
{
        Authority = TwitterSettings.StatusUpdateUrl,
        HasElevatedPermissions = true,
        Credentials = credentials,
        Method = WebMethod.Post
};

restClient.AddHeader(&quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded&quot;);

// Create a Rest Request and fire it
var restRequest = new RestRequest
{
       Path = &quot;1/statuses/update.xml?status=&quot; + txtBoxNewTweet.Text
};

var ByteData = Encoding.UTF8.GetBytes(txtBoxNewTweet.Text);
restRequest.AddPostContent(ByteData);
restClient.BeginRequest(restRequest, new RestCallback(PostTweetRequestCallback));
</pre></p>
</div>
<p>Now that you are able to make posts, you need a way to see the posts you have made on the user’s twitter account!</p>
<p>Well For looking at status updates, you don&#8217;t need authorization. You can directly give a call to the twitter api and you will get your status updates. ( This sample code is as demonstrated on <a href="http://weblogs.asp.net/scottgu/archive/2010/03/18/building-a-windows-phone-7-twitter-application-using-silverlight.aspx" target="_blank">Scott Gu’s blog</a> )</p>
<div id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:1fda0239-8ea1-4469-939d-80935986c0b5" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;"><pre class="brush: csharp;">
 private void GetUserTimeLine()
        {
            WebClient wcTwitterTimeline = new WebClient();
            wcTwitterTimeline.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wcTwitterTimeline_DownloadStringCompleted);
            wcTwitterTimeline.DownloadStringAsync(new System.Uri(&quot;http://api.twitter.com/1/statuses/public_timeline.xml?screen_name=&quot; + userScreenName));
        }

        void wcTwitterTimeline_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            { return; }
            XElement Tweets = XElement.Parse(e.Result);
            listboxMyTimeline.ItemsSource = from tweet in Tweets.Descendants(&quot;status&quot;)
                                            select new TwitterItem
                                            {
                                                UserName = tweet.Element(&quot;user&quot;).Element(&quot;screen_name&quot;).Value,
                                                Tweet = tweet.Element(&quot;text&quot;).Value,
                                                ImageSource = tweet.Element(&quot;user&quot;).Element(&quot;profile_image_url&quot;).Value
                                            };
            Dispatcher.BeginInvoke(() =&gt;
            {
                listboxMyTimeline.Visibility = Visibility.Visible;
                txtBoxNewTweet.Visibility = Visibility.Visible;
                btnPostTweet.Visibility = Visibility.Visible;
            });
        }
</pre></p>
</div>
<p>With this, you are pretty much able to make a basic twitter app, that allows you to post tweets.</p>
<p>Using the Twitter api (<a href="http://dev.twitter.com/doc/" target="_blank">Found here</a>) You can create a full fledged twitter app.</p>
<p>As promised, I am uploading the source code for the app. You can <a title="Twitter Application for Windows Phone 7" href="http://cid-5e51a69c0b38399a.office.live.com/self.aspx/.Public/TwitterApp.zip" target="_blank">download the source here</a>.</p>
<p>(<em>UPDATE : I have updated the code snippet, so that the app now runs on the public beta of the tools , Thanks Don for pointing this out </em>)</p>
<p>Once again, Thanks for your support. With the final SDK Bits coming out this September 16th and with WP7 hitting the RTM status (Congratulations to the Windows Phone team @MSFT, Will be  queuing up the store when, it hits retail <img class="wlEmoticon wlEmoticon-smile" style="border-style:none;" src="http://sudheerkovalam.files.wordpress.com/2010/09/wlemoticonsmile.png?w=580" alt="Smile" />), The next couple of weeks seem to be really really interesting.  Stay tuned for more exciting WP7 stuff</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sudheerkovalam.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sudheerkovalam.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sudheerkovalam.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sudheerkovalam.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sudheerkovalam.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sudheerkovalam.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sudheerkovalam.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sudheerkovalam.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sudheerkovalam.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sudheerkovalam.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sudheerkovalam.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sudheerkovalam.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sudheerkovalam.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sudheerkovalam.wordpress.com/165/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=165&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sudheerkovalam.wordpress.com/2010/09/05/a-windows-phone-twitter-application-part-2-of-2/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		<georss:point>18.507673 73.800734</georss:point>
		<geo:lat>18.507673</geo:lat>
		<geo:long>73.800734</geo:long>
		<media:content url="http://0.gravatar.com/avatar/467f451b75e69e3409c660cbbf0737cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sudheerkovalam</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/09/wlemoticonsmile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	</item>
		<item>
		<title>A Windows Phone 7 Twitter Application : Part 1 of 2 (Understanding oAuth)</title>
		<link>http://sudheerkovalam.wordpress.com/2010/08/28/a-windows-phone-7-twitter-application-part-1/</link>
		<comments>http://sudheerkovalam.wordpress.com/2010/08/28/a-windows-phone-7-twitter-application-part-1/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 07:58:39 +0000</pubDate>
		<dc:creator>sudheerkovalam</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Hammock]]></category>
		<category><![CDATA[oAuth example]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Windows phone 7]]></category>
		<category><![CDATA[Windows Phone 7 Application]]></category>
		<category><![CDATA[WP7dev]]></category>

		<guid isPermaLink="false">https://sudheerkovalam.wordpress.com/?p=156</guid>
		<description><![CDATA[This post is about how you can create your own twitter application for windows phone 7.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=156&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:9e473550-d1c2-44f8-b34e-6535210d8025" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/Windows+Phone+7">Windows Phone 7</a>,<a rel="tag" href="http://technorati.com/tags/WP7Dev">WP7Dev</a>,<a rel="tag" href="http://technorati.com/tags/Twitter+app">Twitter app</a>,<a rel="tag" href="http://technorati.com/tags/Hammock">Hammock</a>,<a rel="tag" href="http://technorati.com/tags/oauth">oauth</a></div>
<p><strong><em>(Update : For trying out code posted on this blog post, Kindly use the official/ locked emulator . The unlocked emulator images have a known issue with HTTPS )</em></strong></p>
<div>
As Promised in the previous post(I Know it was very long ago), We will try to build a Twitter application. Building a twitter app is a very easy task, and this post intends to guide you Step by step in creating your first twitter application. This post will speak about getting the app authenticated/authorized using the oAuth Mechanism.</div>
<blockquote style="width:697px;height:39px;">
<div>The target platform is Windows Phone 7  in  this post, but you can pretty much a build a twitter app on any other platform based on this tutorial</div>
</blockquote>
<div>Step 1: Register Your Twitter app on dev.twitter.com</div>
<blockquote>
<div>Twitter needs to know that You are writing an app which accesses/posts tweets on your behalf. You tell this to twitter by registering your app on twitter.</div>
</blockquote>
<div><a href="http://sudheerkovalam.files.wordpress.com/2010/08/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 5px;" title="image" src="http://sudheerkovalam.files.wordpress.com/2010/08/image_thumb.png?w=566&#038;h=332" border="0" alt="image" width="566" height="332" /></a><br />
<a href="http://sudheerkovalam.files.wordpress.com/2010/08/twitterappregistration.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 5px;" title="twitterAppRegistration" src="http://sudheerkovalam.files.wordpress.com/2010/08/twitterappregistration_thumb.png?w=582&#038;h=394" border="0" alt="twitterAppRegistration" width="582" height="394" /></a></div>
<div>When Registering your app, ensure that You set the Application type to browser and specify a call-back URL. (Twitter has certain requirements on Call-back URLs, i.e. it will not accept non HTTP URLs ( You need to ask twitter specially for  that ). For Demo purposes, i have specified Google.com as my default call-back URL.You can specify your custom page hosted on your domain, if you want to</div>
<div>This is how your app settings on twitter would look like:</div>
<div><a href="http://sudheerkovalam.files.wordpress.com/2010/08/appsettings.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 5px;" title="AppSettings" src="http://sudheerkovalam.files.wordpress.com/2010/08/appsettings_thumb.png?w=599&#038;h=411" border="0" alt="AppSettings" width="599" height="411" /></a></div>
<div>Make a note of the highlighted URLs and your consumer key and secret.( Wondering what these are? Continue Reading or Read about oauth <a href="http://www.oauth.net" target="_blank">here</a>)</div>
<div>Now comes the fun part, As usual fire up Visual studio 2010. Do a File | New Project. Select a <em>Windows Phone Application</em> from <em>Silverlight for Windows Phone</em> Section.</div>
<div>Twitter exposes a RESTful Service to access a user’s tweets etc. Twitter as of now only allows oAuth and XAuth as the only authorization mechanism. Since we have to have to consume a REST service along with oAuth, we will be  using a REST Client helper, that abstracts a lot of the hard work for me. (Such as adding the necessary headers, Computing oAuth Parameters such as Signature, Nonce, Timestamp etc. etc.)</div>
<div>For this demo, we’d be using the Hammock REST client available for download <a href="http://hammock.codeplex.com" target="_blank">here</a>. (Ohh BTW, Hammock is a very good example as to how same source code can target multiple platforms and multiple .net versions. Curious , about knowing how ? Go straight to the site and download the source code and have a look for yourselves.)</div>
<div>Now Lets get our hands dirty with some code for our first Twitter Application on Windows Phone 7 <img class="wlEmoticon wlEmoticon-smile" style="border-style:none;" src="http://sudheerkovalam.files.wordpress.com/2010/08/wlemoticonsmile.png?w=580" alt="Smile" /></div>
<div>First Using the consumer Key and consumer key secret that you got by registering your application on twitter’s site, you need to request for a <em>request token</em> and <em>request token secret</em></div>
<blockquote>
<div><em>Request Token and request token secret are temporary set of credentials that let you acquire oauth access Tokens. The access token and access token secret are needed to access a user’s tweets.</em></div>
</blockquote>
<div>To do this, I will use some neatly written helper classes in the Hammock library.( Else I would be actually writing code to do a lot of ugly stuff)<br />
<pre class="brush: csharp;">
 var oauth = new OAuthWorkflow
{
     ConsumerKey = TwitterSettings.consumerKey,
     ConsumerSecret = TwitterSettings.consumerKeySecret,
     SignatureMethod = OAuthSignatureMethod.HmacSha1,
     ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
     RequestTokenUrl = TwitterSettings.RequestTokenUri,
     Version = TwitterSettings.oAuthVersion,
     CallbackUrl = TwitterSettings.CallbackUri
};

var info = oauth.BuildRequestTokenInfo(WebMethod.Get);
var objOAuthWebQuery = new OAuthWebQuery(info);
objOAuthWebQuery.HasElevatedPermissions = true;
objOAuthWebQuery.SilverlightUserAgentHeader = &quot;Hammock&quot;;
objOAuthWebQuery.SilverlightMethodHeader = &quot;GET&quot;;

</pre></p>
<div>What this helper class does is, hide a lot of stuff from the end user that needs to be done to acquire the request token and secret. Using the oauth WebQuery object all i have to do is to instantiate  a Hammock Rest Client object to fire a request to twitter’s servers.<br />
<pre class="brush: csharp;">
 var requestTokenQuery = oAuthHelper.GetRequestTokenQuery();
 requestTokenQuery.RequestAsync(TwitterSettings.RequestTokenUri, null);
 requestTokenQuery.QueryResponse += new EventHandler(requestTokenQuery_QueryResponse);
</pre></p>
<div>In the response received event, I parse the response sent across by twitter. This should have the <em>request token</em> and <em>request token secret </em>in the response body.</div>
<p><pre class="brush: csharp; collapse: false; first-line: 1; html-script: true; light: true;">
var parameters = HelperMethods.GetQueryParameters(e.Response);
OAuthTokenKey = parameters[&quot;oauth_token&quot;];
tokenSecret = parameters[&quot;oauth_token_secret&quot;];
var authorizeUrl = TwitterSettings.AuthorizeUri+ &quot;?oauth_token=&quot; + OAuthTokenKey;
</pre></p>
<p>Now using the request token and secret, we need to get our app authorized to read/write data from the end user’s twitter account. To do this, we need to open a web browser and redirect the end user to twitter’s sign-in/ authorize page. To do this, I will be using a Web browser control and redirecting it to the authorize URL I have created above.</p></div>
<p><pre class="brush: csharp;">
Dispatcher.BeginInvoke(() =&gt;
{
      this.objAuthorizeBrowserControl.Navigate(new Uri(authorizeUrl));
});
</pre></p>
<div>The XAML for the browser control would look something like this:<br />
<pre class="brush: xml;">






</pre></p>
<div>The User sees the twitter page, where s/he signs in to twitter. Here, s/he is asked to authorize our twitter app.</div>
<div><a href="http://sudheerkovalam.files.wordpress.com/2010/08/twiiter_homescreen.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 5px;" title="twiiter_HomeScreen" src="http://sudheerkovalam.files.wordpress.com/2010/08/twiiter_homescreen_thumb.png?w=138&#038;h=244" border="0" alt="twiiter_HomeScreen" width="138" height="244" /></a><a href="http://sudheerkovalam.files.wordpress.com/2010/08/twitter_startscreen.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="twitter_startScreen" src="http://sudheerkovalam.files.wordpress.com/2010/08/twitter_startscreen_thumb.png?w=144&#038;h=244" border="0" alt="twitter_startScreen" width="144" height="244" /></a><a href="http://sudheerkovalam.files.wordpress.com/2010/08/twitter_signin.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;margin:0;" title="twitter_signIn" src="http://sudheerkovalam.files.wordpress.com/2010/08/twitter_signin_thumb.png?w=140&#038;h=244" border="0" alt="twitter_signIn" width="140" height="244" /></a><a href="http://sudheerkovalam.files.wordpress.com/2010/08/twitter_signin_2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border:0;margin:0 5px;" title="twitter_signIn_2" src="http://sudheerkovalam.files.wordpress.com/2010/08/twitter_signin_2_thumb.png?w=137&#038;h=244" border="0" alt="twitter_signIn_2" width="137" height="244" /></a><a href="http://sudheerkovalam.files.wordpress.com/2010/08/tiwtter_authorize.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="tiwtter_authorize" src="http://sudheerkovalam.files.wordpress.com/2010/08/tiwtter_authorize_thumb.png?w=145&#038;h=244" border="0" alt="tiwtter_authorize" width="145" height="244" /></a></div>
<div>After you have authorized the application to access your data on your behalf, twitter will send the <em>oauth request token</em> (you received in the previous step) and a <em>verification pin</em>. Using these tokens, you can now request for the <em>access token</em> and <em>access token secret. </em>( Arrgh!!! another set of tokens….)</div>
<div>Using the Hammock helper class that we used to get request tokens, we can acquire <em>Access tokens</em> as follows:</div>
<div id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:ad5e2988-0abf-4917-8256-b0ba7ab94506" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;"><pre class="brush: csharp;">
 var AuthorizeResult = HelperMethods.GetQueryParameters(e.Uri.ToString());
var VerifyPin = AuthorizeResult[&quot;oauth_verifier&quot;];
this.objAuthorizeBrowserControl.Visibility = Visibility.Collapsed;

//We now have the Verification pin
//Using the request token and verification pin to request for Access tokens

var AccessTokenQuery = oAuthHelper.GetAccessTokenQuery(
                                             OAuthTokenKey,     //The request Token
                                             tokenSecret,       //The request Token Secret
                                             VerifyPin         // Verification Pin
                                          );

AccessTokenQuery.QueryResponse += new EventHandler(AccessTokenQuery_QueryResponse);
AccessTokenQuery.RequestAsync(TwitterSettings.AccessTokenUri, null);
</pre></p>
</div>
<div>In response twitter sends us the access tokens, the userID and the user’s screen name. I am going to store ‘em all, (Can prove to be very handy.)</div>
<div id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:6ad050ae-601d-45c5-9d55-44f7de3bef85" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;"><pre class="brush: csharp;">
var parameters = HelperMethods.GetQueryParameters(e.Response);
 accessToken = parameters[&quot;oauth_token&quot;];
accessTokenSecret = parameters[&quot;oauth_token_secret&quot;];
userID = parameters[&quot;user_id&quot;];
userScreenName = parameters[&quot;screen_name&quot;];

HelperMethods.SetKeyValue(&quot;AccessToken&quot;, accessToken);
HelperMethods.SetKeyValue(&quot;AccessTokenSecret&quot;, accessTokenSecret);
Dispatcher.BeginInvoke(() =&gt;
{
    MenuItemSignIn.IsEnabled = false;
    MenuItemSignOut.IsEnabled = true;
    TweetButton.IsEnabled = true;
});
</pre></p>
</div>
<div>Phew!!! Now we are authenticated. We can now use the tokens we have received till now and the app can now access the user’s data(such as tweets, timeline etc.)</div>
</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sudheerkovalam.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sudheerkovalam.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sudheerkovalam.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sudheerkovalam.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sudheerkovalam.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sudheerkovalam.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sudheerkovalam.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sudheerkovalam.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sudheerkovalam.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sudheerkovalam.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sudheerkovalam.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sudheerkovalam.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sudheerkovalam.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sudheerkovalam.wordpress.com/156/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=156&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sudheerkovalam.wordpress.com/2010/08/28/a-windows-phone-7-twitter-application-part-1/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		<georss:point>18.507673 73.800734</georss:point>
		<geo:lat>18.507673</geo:lat>
		<geo:long>73.800734</geo:long>
		<media:content url="http://0.gravatar.com/avatar/467f451b75e69e3409c660cbbf0737cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sudheerkovalam</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/twitterappregistration_thumb.png" medium="image">
			<media:title type="html">twitterAppRegistration</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/appsettings_thumb.png" medium="image">
			<media:title type="html">AppSettings</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/wlemoticonsmile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/twiiter_homescreen_thumb.png" medium="image">
			<media:title type="html">twiiter_HomeScreen</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/twitter_startscreen_thumb.png" medium="image">
			<media:title type="html">twitter_startScreen</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/twitter_signin_thumb.png" medium="image">
			<media:title type="html">twitter_signIn</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/twitter_signin_2_thumb.png" medium="image">
			<media:title type="html">twitter_signIn_2</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/tiwtter_authorize_thumb.png" medium="image">
			<media:title type="html">tiwtter_authorize</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows  Phone 7 : Launcher and Choosers : Part 2</title>
		<link>http://sudheerkovalam.wordpress.com/2010/08/14/windows-phone-7-launcher-and-choosers-part-2/</link>
		<comments>http://sudheerkovalam.wordpress.com/2010/08/14/windows-phone-7-launcher-and-choosers-part-2/#comments</comments>
		<pubDate>Sat, 14 Aug 2010 09:01:13 +0000</pubDate>
		<dc:creator>sudheerkovalam</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[#windowsPhone7]]></category>
		<category><![CDATA[#wp7]]></category>
		<category><![CDATA[Windows phone 7]]></category>
		<category><![CDATA[Windows phone 7 Launchers and choosers]]></category>
		<category><![CDATA[WP7dev]]></category>

		<guid isPermaLink="false">http://sudheerkovalam.wordpress.com/?p=109</guid>
		<description><![CDATA[Let us continue our exploration of Windows Phone 7 Launchers and Choosers. I had described Windows Phone 7 launchers here. A Chooser is an API , that launched a  built in functionality for the user to accomplish some task and returns back the data that was chosen by the user to the app. We had seen [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=109&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Let us continue our exploration of Windows Phone 7 Launchers and Choosers.</p>
<p>I had described Windows Phone 7 launchers <a href="http://sudheerkovalam.wordpress.com/2010/08/06/96/" target="_blank">here</a>.</p>
<p>A <strong><span style="text-decoration:underline;">Chooser</span></strong> is an API , that launched a  built in functionality for the user to accomplish some task and returns back the data that was chosen by the user to the app.</p>
<p>We had seen how we could do a new launcher as and where needed, But in case of Choosers, the game is a little different.</p>
<p>A Chooser starts a different application ( Your app gets <a title="Windows Phone 7 Application Life cycle" href="http://sudheerkovalam.wordpress.com/2010/07/21/windows-phone-7-process-life-cycle/" target="_blank">tombstoned</a>)  and after the intended action is complete, ( Your app is back from the grave mwahahah!! ) the results are returned to your application. So we will have to declare the Chooser objects at a global scope within the PhoneApplicationPage class and  instantiate  it  in the page&#8217;s ctor and do the necessary plumbing (By that, i mean handling the necessary events etc.)</p>
<p>As of now following choosers are exposed</p>
<p>1. <strong>CameraCaptureTask</strong>:</p>
<p>The Camera Capture Task starts the camera of the phone. Now, the user is  actually seeing the phone&#8217;s camera app, where s/he can click  photos. Once the Photo is taken , we can save this photo in the Phone&#8217;s Media library. For doing this, we need to add a reference to XNA.Framework assembly.</p>
<p><pre class="brush: csharp;">
using Microsoft.Xna.Framework.Media;
public partial class page2 : PhoneApplicationPage
{
   CameraCaptureTask cameraCaptureTask;

   // Constructor
   public page2()
   {
      InitializeComponent();
      // Initialize the CameraCaptureTask and assign the Completed handler in the page constructor.
      cameraCaptureTask = new CameraCaptureTask();
      cameraCaptureTask.Completed += new EventHandler&lt;PhotoResult&gt;(cameraCaptureTask_Completed);
   }

   private void btnCamera_Click(object sender, RoutedEventArgs e)
   {
      cameraCaptureTask.Show();
   }
   void objCameraCapture_Completed(object sender, PhotoResult e)
   {
       if (e.TaskResult == TaskResult.OK)
       {
          MediaLibrary library = new MediaLibrary();
          Random r = new Random(1234);
          Picture pic = library.SavePicture(&quot;SavedPicture_&quot; + r.Next(11, 99).ToString() + &quot;.jpg&quot;, e.ChosenPhoto);
       }
    }
}
</pre></p>
<p>ScreenShots:<br />
<a href="http://sudheerkovalam.files.wordpress.com/2010/08/cameracapturescreen.png"><img class="alignnone size-medium wp-image-113" title="CameraCaptureScreen" src="http://sudheerkovalam.files.wordpress.com/2010/08/cameracapturescreen.png?w=300&#038;h=160" alt="Picture Capture Screen" width="300" height="160" /></a> <a href="http://sudheerkovalam.files.wordpress.com/2010/08/cameracapturescreen_pic.png"><img class="alignnone size-medium wp-image-114" title="CameraCaptureScreen_Pic" src="http://sudheerkovalam.files.wordpress.com/2010/08/cameracapturescreen_pic.png?w=300&#038;h=157" alt="Accept or Retake the Pic" width="300" height="157" /></a></p>
<p><a href="http://sudheerkovalam.files.wordpress.com/2010/08/cameracapturescreen_pic.png"></a><br />
2. <strong>PhotoChooserTask</strong>:</p>
<p>As the Name suggests, the choosers shows you the WP7 picture library,from where you are allowed to pick a photo, in the completed event,<br />
you receive a PhotoResult object that contains the Stream representation of the photo Chosen.<br />
You Can do what you want to with the Photos&#8217; File stream.<br />
(Such as displaying it, uploading it to some service provider etc etc)</p>
<p><pre class="brush: csharp;">
public partial class Page2 : PhoneApplicationPage
{
     PhotoChooserTask objPhotoChooser;
     public Page2()
     {
            InitializeComponent();
            objPhotoChooser = new PhotoChooserTask();
            objPhotoChooser.Completed += new EventHandler&lt;PhotoResult&gt;(objPhotoChooser_Completed);
     }
     private void btnChosePhoto_Click(object sender, RoutedEventArgs e)
        {            objPhotoChooser.Show();        }

     void objPhotoChooser_Completed(object sender, PhotoResult e)
        {
            if (e.TaskResult == TaskResult.OK)
                MessageBox.Show(&quot;Photo Selected&quot;);
        }
}
</pre></p>
<p>ScreenShots:</p>
<p><a href="http://sudheerkovalam.files.wordpress.com/2010/08/photochoser1.png"><img class="size-medium wp-image-115" title="PhotoChoser_AlbumView" src="http://sudheerkovalam.files.wordpress.com/2010/08/photochoser1.png?w=163&#038;h=300" alt="Media Library : Album View" width="163" height="300" /></a><img class="size-medium wp-image-116" title="PhotoChoser : Photo Views" src="http://sudheerkovalam.files.wordpress.com/2010/08/photochoser2.png?w=171&#038;h=300" alt="Photo List shown in a pivot " width="171" height="300" /></p>
<p>3. <strong>SavePhoneNumberTask</strong>:</p>
<p>This Chooser, as  the name suggests, saves a phone number in the Phone&#8217;s contacts. This chooser does not return anything. The Completed event receives argument stating the status of the operation.</p>
<p>Note : You need to set the <span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;line-height:18px;font-size:12px;white-space:pre;">PhoneNumber property before you call the Choosers show() method. (Else your code might not work)</span></p>
<p><span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;line-height:18px;font-size:12px;white-space:pre;"> </span></p>
<p><pre class="brush: csharp;">&lt;/span&gt;
&lt;pre&gt;public partial class Page2 : PhoneApplicationPage
{
     SavePhoneNumberTask objSavePhoneNumber;
     public Page2()
     {
            InitializeComponent();
            objSavePhoneNumber = new SavePhoneNumberTask();
            objSavePhoneNumber.Completed += new EventHandler&lt;TaskEventArgs&gt;(objSavePhoneNumber_Completed);
     }
     private void btnSavePhoneNumber_Click(object sender, RoutedEventArgs e)
     {
            objSavePhoneNumber.PhoneNumber = &quot;123-345-4567&quot;;
            objSavePhoneNumber.Show();
     }

     void objSavePhoneNumber_Completed(object sender, TaskEventArgs e)
     {
            if (e.TaskResult == TaskResult.OK)
            {
                MessageBox.Show(&quot;Phone Number Saved..&quot;);
            }
     }
}
</pre></p>
<p>Screenshots:<br />
<a href="http://sudheerkovalam.files.wordpress.com/2010/08/savephonenumber.png"><img class="alignnone size-medium wp-image-118" title="savePhoneNumber" src="http://sudheerkovalam.files.wordpress.com/2010/08/savephonenumber.png?w=165&#038;h=300" alt="Saving a phone number for a existing contact" width="165" height="300" /></a> <a href="http://sudheerkovalam.files.wordpress.com/2010/08/savephonenumber2.png"><img class="alignnone size-medium wp-image-119" title="Save Phone Number Screen" src="http://sudheerkovalam.files.wordpress.com/2010/08/savephonenumber2.png?w=167&#038;h=300" alt="" width="167" height="300" /></a> <a href="http://sudheerkovalam.files.wordpress.com/2010/08/savephonenumber3.png"><img class="alignnone size-medium wp-image-120" title="Phone Number Type" src="http://sudheerkovalam.files.wordpress.com/2010/08/savephonenumber3.png?w=170&#038;h=300" alt="Phone Number Type" width="170" height="300" /></a> <a href="http://sudheerkovalam.files.wordpress.com/2010/08/savephonenumber4.png"><img class="alignnone size-medium wp-image-121" title="View Contact Detail" src="http://sudheerkovalam.files.wordpress.com/2010/08/savephonenumber4.png?w=182&#038;h=300" alt="" width="182" height="300" /></a></p>
<p>4. <strong>PhoneNumberChooserTask</strong></p>
<p>PhoneNumberChooserTask Allows you to pick a phone number from your contacts. If the contact has multiple phone numbers, you get to pick one of the phone numbers ( Isn&#8217;t that quite handy)</p>
<p><pre class="brush: csharp;">
public partial class Page2 : PhoneApplicationPage
{
     PhoneNumberChooserTask objPhoneNumberChooser;
     public Page2()
     {
            InitializeComponent();
            objPhoneNumberChooser = new PhoneNumberChooserTask();
            objPhoneNumberChooser.Completed += new EventHandler&lt;PhoneNumberResult&gt;(objPhoneNumberChooser_Completed);
     }
     private void btnChoosePhoneNumber_Click(object sender, RoutedEventArgs e)
     {
            objPhoneNumberChooser.Show();
     }

     void objPhoneNumberChooser_Completed(object sender, PhoneNumberResult e)
     {
            if (e.TaskResult == TaskResult.OK)
            {
                MessageBox.Show(&quot;Selected :&quot; + e.PhoneNumber);
            }
     }
}
</pre></p>
<p>Screenshots:<br />
<a href="http://sudheerkovalam.files.wordpress.com/2010/08/phonenumberchooser1.png"><img class="alignnone size-medium wp-image-122" title="Contact List" src="http://sudheerkovalam.files.wordpress.com/2010/08/phonenumberchooser1.png?w=165&#038;h=300" alt="" width="165" height="300" /></a> <a href="http://sudheerkovalam.files.wordpress.com/2010/08/phonenumberchooserchoice.png"><img class="alignnone size-medium wp-image-124" title="If Multiple=" alt="" /></a> <a href="http://sudheerkovalam.files.wordpress.com/2010/08/phonenumberchooser2.png"><img class="alignnone size-medium wp-image-123" title="Selected Phone Number Displayed in app" src="http://sudheerkovalam.files.wordpress.com/2010/08/phonenumberchooser2.png?w=163&#038;h=300" alt="" width="163" height="300" /></a></p>
<p>5. <strong>SaveEmailAddressTask</strong></p>
<p>As the name suggests, this choosers saves an email to the contact list.</p>
<p>6. <strong>EmailAddressChooserTask</strong></p>
<p>As the name suggests, this choosers shows you the contact list from where , you can chose a  contact and your app will receive the chosen contact&#8217;s default email address. Again, if multiple email addresses are available, the user is presented a choice of picking up an email address. This is sent back to your app.</p>
<p><a href="http://cid-5e51a69c0b38399a.office.live.com/self.aspx/.Public/LaunchersChoosersDemo.zip" target="_blank">Source Code</a> for the sample Launcher and Chooser Demo,( whose screenshots are visible above )</p>
<p>Once Again, thanks for your support by reading this post. Keep watching this space for more on windows Phone 7.</p>
<p>Next Post : Building your twitter client for Windows Phone 7 with oAuth <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sudheerkovalam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sudheerkovalam.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sudheerkovalam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sudheerkovalam.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sudheerkovalam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sudheerkovalam.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sudheerkovalam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sudheerkovalam.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sudheerkovalam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sudheerkovalam.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sudheerkovalam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sudheerkovalam.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sudheerkovalam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sudheerkovalam.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=109&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sudheerkovalam.wordpress.com/2010/08/14/windows-phone-7-launcher-and-choosers-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>18.507673 73.800734</georss:point>
		<geo:lat>18.507673</geo:lat>
		<geo:long>73.800734</geo:long>
		<media:content url="http://0.gravatar.com/avatar/467f451b75e69e3409c660cbbf0737cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sudheerkovalam</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/cameracapturescreen.png?w=300" medium="image">
			<media:title type="html">CameraCaptureScreen</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/cameracapturescreen_pic.png?w=300" medium="image">
			<media:title type="html">CameraCaptureScreen_Pic</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/photochoser1.png?w=163" medium="image">
			<media:title type="html">PhotoChoser_AlbumView</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/photochoser2.png?w=171" medium="image">
			<media:title type="html">PhotoChoser : Photo Views</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/savephonenumber.png?w=165" medium="image">
			<media:title type="html">savePhoneNumber</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/savephonenumber2.png?w=167" medium="image">
			<media:title type="html">Save Phone Number Screen</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/savephonenumber3.png?w=170" medium="image">
			<media:title type="html">Phone Number Type</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/savephonenumber4.png?w=182" medium="image">
			<media:title type="html">View Contact Detail</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/phonenumberchooser1.png?w=165" medium="image">
			<media:title type="html">Contact List</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/phonenumberchooser2.png?w=163" medium="image">
			<media:title type="html">Selected Phone Number Displayed in app</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows Phone 7 : Launchers and Choosers</title>
		<link>http://sudheerkovalam.wordpress.com/2010/08/06/96/</link>
		<comments>http://sudheerkovalam.wordpress.com/2010/08/06/96/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 03:02:08 +0000</pubDate>
		<dc:creator>sudheerkovalam</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[#windowsPhone7]]></category>
		<category><![CDATA[#wp7]]></category>
		<category><![CDATA[Windows phone 7]]></category>
		<category><![CDATA[Windows phone 7 Launchers and choosers]]></category>
		<category><![CDATA[WP7dev]]></category>

		<guid isPermaLink="false">http://sudheerkovalam.wordpress.com/?p=96</guid>
		<description><![CDATA[This post is about Windows Phone 7 Launchers and how third party developers can leverage it.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=96&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Windows Phone 7 seems to have captured my attention a lot these days. So I am ( and will be ) blogging about Windows Phone 7 like crazy. I believe that it is Microsoft’s first step in the right direction (in the phone OS business). So coming back to Windows phone 7 Platform. We all, by now know that all applications in Windows Phone 7 runs in its own sandbox (execution and file storage, both). And since, we  are developing apps for windows Phone 7, we will certainly need access to common, phone related functionality, say like sending an email, SMS etc. Recently, in Community Tech Days Pune, in the Windows Phone 7 app development session by <a href="http://www.mayurtendulkar.com/" target="_blank">Mayur Tendulkar</a>, a very cool app was demoed for Windows Mobile 6.x. This app would send “happy new year” or “happy holidays” message to all the contacts in your phone. The idea was pretty cool. So for designing this app, we would need access to the phone’s contact list and then, will have to use the phone’s SMS API to send out Text messages. It is a different ball game here on Windows Phone 7 platform. Windows Phone 7 doesn&#8217;t give you access to native functionality directly, so <a href="http://www.Microsoft.com/" target="_blank">Microsoft</a> has exposed certain common functionality that you would want to use in your apps in the form of <strong><em>Launchers</em></strong> and <strong><em>Choosers.</em></strong></p>
<blockquote><p>A <strong><span style="text-decoration:underline;">Launcher</span></strong> is an API, that launches built in functionality for the user to accomplish some task and returns nothing back to the calling function in  your app. API to make calls, Send SMS or Emails etc are an example of such APIs</p></blockquote>
<blockquote><p>A <strong><span style="text-decoration:underline;">Chooser</span></strong> on the other hand is an API , that launched a  built in functionality for the user to accomplish some task and returns back the data that was chosen by the user to the app. API for Choosing contacts, photos etc. come under this category.</p></blockquote>
<p><span style="color:#ff0000;"><em>Important Note :</em></span><span style="color:#ffc000;"> </span><span style="color:#c0504d;">Your application de-activates (i.e. gets tombstoned), when you trigger a launcher or a chooser. (Not sure what tombstoned means, read more about Windows Phone app life cycle <a href="http://sudheerkovalam.wordpress.com/2010/07/21/windows-phone-7-process-life-cycle/" target="_blank"><span style="color:#0000ff;"><span style="text-decoration:underline;">here</span></span></a></span><span style="color:#c0504d;"> </span><span style="color:#ffc000;"><span style="color:#c0504d;">).</span> </span>How to use Launchers in your application : Launchers are available in <a href="http://www.Microsoft.com/" target="_blank"><em><strong>Microsoft</strong></em></a><em><strong>.Phone.Tasks</strong></em> Namespace. Make sure to add a using statement for this namespace.</p>
<p>As of now Following Launchers have been exposed to us (Not exactly …):</p>
<p>1. EmailComposeTask :</p>
<blockquote><p>As the name suggests, The EmailComposeTask lets you compose emails and send ‘em. You will off course need to setup an email account before you can actually use the email compose functionality. The good news, if no email account has been setup, the shell will ask you to setup an account. ( I guess in the final RTW SDK, this might actually trigger email setup, if not done already)</p></blockquote>
<p><pre class="brush: csharp;">

EmailComposeTask emailComposeTask = new EmailComposeTask();
emailComposeTask.To = &quot;bill.gates@microsoft.com&quot;;
emailComposeTask.Body = &quot;Windows Phone Rocks!!!&quot;
emailComposeTask.Cc = &quot;SteveBallmer@MSFT.com&quot;;
emailComposeTask.Subject = &quot;Windows Phone&quot;;
emailComposeTask.Show();

</pre></p>
<p><a href="http://sudheerkovalam.files.wordpress.com/2010/08/1.png"><img class="alignnone size-medium wp-image-77" title="1.png" src="http://sudheerkovalam.files.wordpress.com/2010/08/1.png?w=164&#038;h=300" alt="" width="164" height="300" /></a></p>
<p>2. PhoneCallTask:</p>
<blockquote><p>Again, quite evident by the name itself. Phone call task will let you make a phone call.</p></blockquote>
<p><pre class="brush: csharp;">
PhoneCallTask phoneCallTask = new PhoneCallTask();
phoneCallTask.PhoneNumber = &quot;180018001800&quot;;
phoneCallTask.DisplayName = &quot;Steve Jobs&quot;;
phoneCallTask.Show();
</pre></p>
<pre><a href="http://sudheerkovalam.files.wordpress.com/2010/08/phonecall_1.png">
<img class="alignnone size-medium wp-image-79" title="PhoneCall_1.png" src="http://sudheerkovalam.files.wordpress.com/2010/08/phonecall_1.png?w=166&#038;h=300" alt="" width="166" height="300" /></a><a href="http://sudheerkovalam.files.wordpress.com/2010/08/phonecall.png"><img class="alignnone size-medium wp-image-81" title="phonecall.png" src="http://sudheerkovalam.files.wordpress.com/2010/08/phonecall.png?w=161&#038;h=300" alt="" width="161" height="300" /></a></pre>
<blockquote><p>Quite a wrong person to call, I know <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p></blockquote>
<p><em>3. SMSComposeTask :</em></p>
<blockquote><p><em>Lets you compose an SMS</em></p></blockquote>
<p><pre class="brush: csharp;">
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = &quot;1800-180-1800&quot;;
smsComposeTask.Body = &quot;Cool Phone!!&quot;;
&lt;pre&gt;smsComposeTask.show();&lt;/pre&gt;
</pre></p>
<p>4. SearchTask :</p>
<blockquote><p>Lets you open the shell search engine</p></blockquote>
<p><pre class="brush: csharp;">
SearchTask searchTask = new SearchTask();
searchTask.SearchQuery = &quot;Windows Phone 7&quot;;
searchTask.Show();
</pre></p>
<p><a href="http://sudheerkovalam.files.wordpress.com/2010/08/search1.png"><img class="alignnone size-medium wp-image-84" title="search1.png" src="http://sudheerkovalam.files.wordpress.com/2010/08/search1.png?w=173&#038;h=300" alt="" width="173" height="300" /></a><a href="http://sudheerkovalam.files.wordpress.com/2010/08/search2.png"><img class="alignnone size-medium wp-image-86" title="search2.png" src="http://sudheerkovalam.files.wordpress.com/2010/08/search2.png?w=165&#038;h=300" alt="" width="165" height="300" /></a><a href="http://sudheerkovalam.files.wordpress.com/2010/08/search3.png"><img class="alignnone size-medium wp-image-88" title="search3.png" src="http://sudheerkovalam.files.wordpress.com/2010/08/search3.png?w=160&#038;h=300" alt="" width="160" height="300" /></a></p>
<p>5. MediaPlayerLauncher:</p>
<blockquote><p>Will Trigger the Phone’s Media Player Application</p></blockquote>
<p><pre class="brush: csharp;">
MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher();
mediaPlayerLauncher.Media = new Uri(&quot;vs_logo2010_WMV9_640x360.wmv&quot;, UriKind.Relative);
mediaPlayerLauncher.Show();
</pre></p>
<p>6. WebBrowserTask:</p>
<blockquote><p>The WebBrowserTask will let you trigger the phone’s IE mobile browser and redirect the user to the page specified.</p></blockquote>
<p><pre class="brush: csharp;">
WebBrowserTask webBrowserTask = new WebBrowserTask();
webBrowserTask.URL = &quot;http://developer.windowsphone.com&quot;;
webBrowserTask.show();
</pre></p>
<p>I was not able to find much detail on these Launchers. Folks reading this block can contribute.:</p>
<p>7.MarketplaceDetailTask:</p>
<blockquote><p>From the Name of it seems, it will launch the phone’s Marketplace app and show details. Not used this one.</p></blockquote>
<p>8. MarketplaceHubTask:</p>
<blockquote><p>Launches the Marketplace Hub, i guess. I don&#8217;t think we will be able to test this on the locked emulator.</p></blockquote>
<p>9. MarketplaceReviewTask</p>
<p>10. MarketplaceSearchTask</p>
<p>I will be posting the next post on using the Choosers and will also post the entire solution for your ready reference. Once again, thanks for your support and keep looking at this space for more Windows Phone 7 related posts.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sudheerkovalam.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sudheerkovalam.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sudheerkovalam.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sudheerkovalam.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sudheerkovalam.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sudheerkovalam.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sudheerkovalam.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sudheerkovalam.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sudheerkovalam.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sudheerkovalam.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sudheerkovalam.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sudheerkovalam.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sudheerkovalam.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sudheerkovalam.wordpress.com/96/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=96&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sudheerkovalam.wordpress.com/2010/08/06/96/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<georss:point>18.507673 73.800734</georss:point>
		<geo:lat>18.507673</geo:lat>
		<geo:long>73.800734</geo:long>
		<media:content url="http://0.gravatar.com/avatar/467f451b75e69e3409c660cbbf0737cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sudheerkovalam</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/1.png?w=164" medium="image">
			<media:title type="html">1.png</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/phonecall_1.png?w=166" medium="image">
			<media:title type="html">PhoneCall_1.png</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/phonecall.png?w=161" medium="image">
			<media:title type="html">phonecall.png</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/search1.png?w=173" medium="image">
			<media:title type="html">search1.png</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/search2.png?w=165" medium="image">
			<media:title type="html">search2.png</media:title>
		</media:content>

		<media:content url="http://sudheerkovalam.files.wordpress.com/2010/08/search3.png?w=160" medium="image">
			<media:title type="html">search3.png</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows Phone 7 Design Considerations</title>
		<link>http://sudheerkovalam.wordpress.com/2010/07/26/windows-phone-7-design-considerations/</link>
		<comments>http://sudheerkovalam.wordpress.com/2010/07/26/windows-phone-7-design-considerations/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 05:14:43 +0000</pubDate>
		<dc:creator>sudheerkovalam</dc:creator>
				<category><![CDATA[Application Design]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[#wp7]]></category>
		<category><![CDATA[PuneUserGroup]]></category>
		<category><![CDATA[Windows phone 7]]></category>
		<category><![CDATA[WP7 Design Considerations]]></category>
		<category><![CDATA[WP7dev]]></category>

		<guid isPermaLink="false">http://sudheerkovalam.wordpress.com/?p=64</guid>
		<description><![CDATA[Windows Phone 7 is an amazing platform. It delivers what it promised. But the experience is not 100% complete. Now it’s up to us to complete the experience by developing some cool apps. Now We all are aware that a Silverlight developer can easily develop apps for Windows Phone. Yeah, we still have all the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=64&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Windows Phone 7 is an amazing platform. It delivers what it promised. But the experience is not 100% complete. Now it’s up to us to complete the experience by developing some cool apps.</p>
<p>Now We all are aware that a Silverlight developer can easily develop apps for Windows Phone. Yeah, we still have all the Drag and Drop goodness, but we need to keep into consideration , when we are designing the application, that the target device is a phone with 1 GHz  single core processor , Most of us will develop apps on a Core 2 Duo machine.</p>
<p>Since, I have been playing around with Silverlight development experience, am not sure about whether these points are exactly applicable( as is) to XNA game development. But still, here it goes:</p>
<p>1. Keep the User Experience simple:</p>
<p>The Silverlight runtime on the phone does not exactly have a lot of raw processing power available, so it has been optimized accordingly. There are certain points that you need to take into consideration when designing UI for the phone.</p>
<p>- Keep it simple</p>
<blockquote><p>Less Elaborate UI means Less Code means less activity which will lead to better performance</p></blockquote>
<p>- Limit the activity on the UI thread</p>
<blockquote><p>The UI thread must be limited to User interaction , accepting input etc.</p></blockquote>
<p>- Leverage the Render thread</p>
<blockquote><p>The render thread, is separate thread that will take care of simple animations etc. This will result in smoother User Experience ( Remember, customer experience comes first)</p></blockquote>
<p>- Leverage the GPU of the phone</p>
<blockquote><p>We have a dedicated GPU on the phone. Use it! And Since yours is the only program that runs in the foreground, you can design your app to leverage the GPU (and by that I meant justifiable usage , remember you are running on a small handheld device )</p></blockquote>
<p>If you are interested in drilling down more, there was a nice session at MIX’10 on Silverlight performance on Windows Phone. Seema Ramchandani&#8217;s session on <a href="http://ecn.channel9.msdn.com/o9/mix/10/wmv/CL60.wmv" target="_blank">Silverlight performance on Windows Phone</a>.</p>
<p>2. Make sure you only upload necessary data:</p>
<blockquote><p>As you must be aware that on a small radio device, transmitting from the device can always prove to be more costly as compared to receiving transmission ( in terms of battery life). The Same principle applies here too.</p></blockquote>
<blockquote><p>Upload/ Send to server only the data you need to, Say for example, In your app, you receive an array if  say tasks, in which say you update some of these tasks, instead of sending the entire updated array to the server ( or your backend service) send across only some information, such as only the ID of the Task, property changed and the updated value.</p></blockquote>
<blockquote><p>This will result in overall better application performance as well as better battery life on the phone ( Very crucial IMO)</p></blockquote>
<p>3. Deactivate Quickly</p>
<blockquote><p>In WM 6.x, apps never had an exit option, There never was an event that would let us know that the app is about to get killed. So in order to overcome this danger, what people did was to save state of the application periodically.</p>
<p>Well in Windows Phone 7, You do have an App Closing and App Deactivating event. ( Not sure about what that means? , read my <a href="http://sudheerkovalam.wordpress.com/2010/07/21/windows-phone-7-process-life-cycle/" target="_blank">post</a> on WP7 app life cycle). When you receive this event, you save data to the phone’s isolated storage/ or some backend service  and retrieve it back when the app activates again.</p></blockquote>
<blockquote><p>Now If your app is mammoth and needs to save a lot of data in the deactivating event, Your app will take time to tombstone. What this will lead to is a delay in the launched/chooser to show up making the phone run sluggish.</p></blockquote>
<blockquote><p>What we can do to overcome this is  to save state  periodically ( When people say OLD IS GOLD, they aren’t kidding, are they?)</p></blockquote>
<p>We can do something on these lines:</p>
<p><pre class="brush: csharp;">
    // Constructor
    public App()
    {
        UnhandledException += Application_UnhandledException;

        // Standard Silverlight initialization
        InitializeComponent();

        // Phone-specific initialization
        InitializePhoneApplication();

        // Add a Timer to save state Periodically
        DispatcherTimer dt = new DispatcherTimer();
        dt.Interval = new TimeSpan(0, 0, 0, 10); // 10 seconds
        dt.Tick += new EventHandler(dt_Tick);
    }

    void dt_Tick(object sender, EventArgs e)
    {
        //Dirty Flag is set, when something that has to saved 
        // in the application's state has changed.
        if (_dirtyFlag)
        {
            // Save state incrementally.
        }
    }

    // Code to execute when the application is deactivated (sent to background)
    // This code will not execute when the application is closing
    private void Application_Deactivated(object sender, 
        DeactivatedEventArgs e)
    {
        System.Diagnostics.
            Debug.WriteLine(&quot;Go to sleep...zzz&quot;);
        if (_dirtyFlag)
        {
            // Only save state if there is a change.
        }
    }
</pre><br />
</code></p>
<p><code><br />
</code>Well these are all the points i can think off as of now.</p>
<p>These may not be applicable to all apps that we will write on WP7 , But i believe it is “Good to Know / Things to ponder on, when designing my WP7 app” stuff.</p>
<p>Any suggestions/ comments/ thoughts/ abuses are welcome.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sudheerkovalam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sudheerkovalam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sudheerkovalam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sudheerkovalam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sudheerkovalam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sudheerkovalam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sudheerkovalam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sudheerkovalam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sudheerkovalam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sudheerkovalam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sudheerkovalam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sudheerkovalam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sudheerkovalam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sudheerkovalam.wordpress.com/64/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sudheerkovalam.wordpress.com&amp;blog=8595060&amp;post=64&amp;subd=sudheerkovalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sudheerkovalam.wordpress.com/2010/07/26/windows-phone-7-design-considerations/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
<enclosure url="http://ecn.channel9.msdn.com/o9/mix/10/wmv/CL60.wmv" length="97536821" type="video/asf" />
		<georss:point>18.507673 73.800734</georss:point>
		<geo:lat>18.507673</geo:lat>
		<geo:long>73.800734</geo:long>
		<media:content url="http://0.gravatar.com/avatar/467f451b75e69e3409c660cbbf0737cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sudheerkovalam</media:title>
		</media:content>
	</item>
	</channel>
</rss>
