<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Agile mobility &#187; Code</title>
	<atom:link href="http://agilemobility.net/category/development/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://agilemobility.net</link>
	<description>All things from a mobile technology perspective.</description>
	<lastBuildDate>Fri, 18 May 2012 11:39:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Json.net library</title>
		<link>http://agilemobility.net/2010/10/json-net-library/</link>
		<comments>http://agilemobility.net/2010/10/json-net-library/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 22:03:01 +0000</pubDate>
		<dc:creator>Alexander Viken</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[json.net]]></category>
		<category><![CDATA[MonoTouch]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://agilemobility.net/?p=1820</guid>
		<description><![CDATA[Working with .NET in a connected world your new favorite library should be Json.net.  It just makes the world connect in an easy and RESTfull way.]]></description>
			<content:encoded><![CDATA[<p style="float:right; margin:0 0 10px 15px; width:240px;">
		<img src="http://agilemobility.net/wp-content/uploads/2010/10/JSON.gif" width="240" />
		</p><p>Working with .NET in a connected world your new favorite library should be <a href="http://json.codeplex.com/" target="_blank">Json.net</a>.  It just makes the world connect in an easy and REST-full way.</p>
<p>The developer of this library is Jason Newton-King, and he&#8217;s got a blog that shows you <a href="http://james.newtonking.com/pages/json-net.aspx" target="_blank">how easy it is to implement</a>.</p>
<p>Not only should it be a natural part of your .NET project but it can also be used for iPhone/iPad development through MonoTouch<a href="http://www.brettnagy.com/post/2009/11/21/Using-JsonNET-with-MonoTouch.aspx" target="_blank"> . Here&#8217;s also a guide</a> on how you do it. Hopefully it&#8217;ll transfer to MonoDroid when it becomes available.</p>
<p>Download Json.NET from here: <a href="http://json.codeplex.com/releases/view/50552" target="_blank">http://json.codeplex.com/releases/view/50552</a></p>
        <h3>Use Facebook to Comment on this Post</h3>
        <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://agilemobility.net/category/development/code/feed/" num_posts="4" width="600"></fb:comments>]]></content:encoded>
			<wfw:commentRss>http://agilemobility.net/2010/10/json-net-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Facebook SDK</title>
		<link>http://agilemobility.net/2010/09/c-facebook-sdk/</link>
		<comments>http://agilemobility.net/2010/09/c-facebook-sdk/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 13:55:28 +0000</pubDate>
		<dc:creator>Alexander Viken</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[CodePlex]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[Windows Phone 7]]></category>

		<guid isPermaLink="false">http://agilemobility.net/?p=1681</guid>
		<description><![CDATA[ jimzim and ntotten has released their Facebook C# SDK on Codeplex that  helps .Net developers create Facebook iframe and web apps.]]></description>
			<content:encoded><![CDATA[<p style="float:right; margin:0 0 10px 15px; width:240px;">
		<img src="http://agilemobility.net/wp-content/uploads/2010/09/facebook_logo.png" width="240" />
		</p><p>A new C# Facebook SDK makes it easy to connect your apps.</p>
<p><a href="http://agilemobility.net/wp-content/uploads/2010/09/facebook_logo.png"><img class="alignleft size-medium wp-image-1682" style="border: 0pt none; margin: 4px; background-color: #ffffff;" title="facebook_logo" src="http://agilemobility.net/wp-content/uploads/2010/09/facebook_logo-300x300.png" alt="" width="240" height="240" /></a> <a href="http://www.codeplex.com/site/users/view/jimzim" target="_blank">jimzim</a> and <a href="http://www.codeplex.com/site/users/view/ntotten">ntotten</a> has released their Facebook C# SDK on Codeplex that  helps .Net developers create Facebook iframe and web apps  using the most current and fully supported Facebook APIs.</p>
<p>This toolkit  allows you to quickly create a facebook application, or integrate your  website with Facebook, and use the new Graph API or old rest API.</p>
<p>Visit <a href="http://facebooksdk.codeplex.com/" target="_blank">Codeplext to have a look</a>. Downloadable SDK complete with documentation, getting started docs and sample code is available making it super easy to get your Facebook integration going.</p>
<p><strong>Features</strong></p>
<ul>
<li>Compatible with all Graph API and REST API Calls</li>
<li>Supports all forms of Facebook authentication: Cookies, OAuth 2.0,  Signed Requests</li>
<li>Supports .Net 4.0 and .Net 3.5</li>
<li>Supports .Net 4.0 Client Profile (WinForms and WPF)</li>
<li>Supports Silverlight 4</li>
<li>Supports Windows Phone 7</li>
<li>Samples Applications to get started quickly</li>
<li>Client authentication tool to get test access tokens</li>
</ul>
<p>Im going to check out the Windows Phone 7 support.</p>
        <h3>Use Facebook to Comment on this Post</h3>
        <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://agilemobility.net/category/development/code/feed/" num_posts="4" width="600"></fb:comments>]]></content:encoded>
			<wfw:commentRss>http://agilemobility.net/2010/09/c-facebook-sdk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hell-o world WebOS</title>
		<link>http://agilemobility.net/2010/09/hell-o-world-webos/</link>
		<comments>http://agilemobility.net/2010/09/hell-o-world-webos/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 13:38:14 +0000</pubDate>
		<dc:creator>Alexander Viken</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Hello World]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[Palm]]></category>
		<category><![CDATA[WebApps]]></category>
		<category><![CDATA[WebOS]]></category>

		<guid isPermaLink="false">http://agilemobility.net/?p=1612</guid>
		<description><![CDATA[Building native apps in HTML/Javascript and CSS. The idea is good, and it just might some day rid us of the programming language fragmentation....]]></description>
			<content:encoded><![CDATA[<p style="float:right; margin:0 0 10px 15px; width:240px;">
		<img src="http://agilemobility.net/wp-content/uploads/2010/09/buildapp_lg.png" width="240" />
		</p><p><a href="http://agilemobility.net/wp-content/uploads/2010/09/buildapp_lg.png"><img class="alignleft size-full wp-image-1613" style="border: 0pt none; margin: 4px; background-color: #ffffff;" title="buildapp_lg" src="http://agilemobility.net/wp-content/uploads/2010/09/buildapp_lg.png" alt="" width="269" height="135" /></a></p>
<div>Building native apps in HTML/Javascript and CSS. The idea is good, and it just might some day rid us of the programming language fragmentation&#8230;. Some day&#8230;</div>
<p>But not quite yet. Not in my opinion anyhow, after giving WebOS from Palm a try.  My previous experience with HTML/Javascript/CSS based native apps was by using PhoneGap in an iPhone application, that actually works the way I expected, with the &#8220;look and feel&#8221; of how i would create any other ordinary web/html application.  With WebOS and the Palm WebOS SDK there&#8217;s a different way to do it&#8230;.</p>
<p><strong>[Update: This post relates to WebOS release 1.4.x]</strong></p>
<p>Firstly, you download and install the SDK and the VirtualBox WebOS emulator. To start a new project you fire up a command prompt or terminal window and type the generate command:</p>
<p><span style="color: #ff0000;">&gt; palm-generate -p &#8220;{title:&#8217;Hello World&#8217;, id:com.mystuff.hello, version:&#8217;1.0.0&#8242;}&#8221; HelloWorld</span></p>
<p>This generates the basic application folder structure for you with the first &#8220;ViewController&#8221; called index.html. Then you need to create a View, or a Scene as they call it. (which actually is saved in a folder called views&#8230;..) The view is created yet again with the magic palm-generate command at command line.</p>
<p><span style="color: #ff0000;">&gt; palm-generate -t new_scene -p &#8220;name:first&#8221; HelloWorld</span></p>
<div id="attachment_1626" class="wp-caption alignleft" style="width: 298px"><a href="http://agilemobility.net/wp-content/uploads/2010/09/counter.png"><img class="size-full wp-image-1626  " style="border: 0pt none; margin: 4px; background-color: #ffffff;" title="counter" src="http://agilemobility.net/wp-content/uploads/2010/09/counter.png" alt="" width="288" height="452" /></a><p class="wp-caption-text">The application run from the emulator should look like this.</p></div>
<p>You now have a html file called &#8220;/app/views/first/first-scene.html&#8221;. This is where you place the content of that view/scene.  The content could look like this&#8230;</p>
<pre class="html:nogutter"><span style="color: #ff0000;">&lt;div id="main"&gt;
     &lt;div&gt;Header&lt;/div&gt;
     &lt;div id="count"&gt;0&lt;/div&gt;
     &lt;div id="MyButton"
          name="MyButton1"
          x-mojo-element="Button"&gt;&lt;/div&gt;
&lt;/div&gt;</span></pre>
<p>The ViewController (index.html) is controlled from &#8216;/app/assistants/stage-assistant.js&#8217; (someone has been fond of the theatre here) and the View/Scene is controlled by &#8216;/app/assistants/first-assistant.js&#8217;</p>
<p>You get your mojo going by hooking the button click event inside &#8216;first-assistant.js&#8217; and you configure the View/Scene in the setup method.</p>
<p>Ahh.. I phased out&#8230; too much code to many places to get a simple button push count app&#8230;.. If i&#8217;d been using Eclipse i could have avoided the trips out to the command line, but I&#8217;m not much of a Eclipse fan, and as web/html development it&#8217;s too bound to the WebOS platform for me.</p>
<p>Want to try for yourself you can find the complete guide here at <a href="http://developer.palm.com/index.php?option=com_content&amp;view=article&amp;id=1758&amp;Itemid=36" target="_blank">Palm Developer Center</a>.</p>
        <h3>Use Facebook to Comment on this Post</h3>
        <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://agilemobility.net/category/development/code/feed/" num_posts="4" width="600"></fb:comments>]]></content:encoded>
			<wfw:commentRss>http://agilemobility.net/2010/09/hell-o-world-webos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating a Cellular Line (GPRS) Modem from code</title>
		<link>http://agilemobility.net/2010/03/creating-a-cellular-line-gprs-modem-from-code/</link>
		<comments>http://agilemobility.net/2010/03/creating-a-cellular-line-gprs-modem-from-code/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 14:45:09 +0000</pubDate>
		<dc:creator>Alexander Viken</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[cellular line]]></category>
		<category><![CDATA[ConfigurationManager]]></category>
		<category><![CDATA[GPRS]]></category>
		<category><![CDATA[modem]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://agilemobility.net/?p=1131</guid>
		<description><![CDATA[Here's a code snippet i just found really usefull. I was getting 20 MC75 pda's ready for a customer pilot project and we've developed a solution but hadn't design any deployment system for getting the devices ready, so it was all manual work.]]></description>
			<content:encoded><![CDATA[<p style="float:right; margin:0 0 10px 15px; width:240px;">
		<img src="http://agilemobility.net/wp-content/uploads/2010/03/Pda_modem_connection5.png" width="240" />
		</p><p>Here&#8217;s a code snippet i just found really usefull. I was getting 20 MC75 pda&#8217;s ready for a customer pilot project and we&#8217;ve developed a solution but hadn&#8217;t design any deployment system for getting the devices ready, so it was all manual work.</p>
<p><a href="http://agilemobility.net/wp-content/uploads/2010/03/Pda_modem_connection.png"><img class="alignleft size-full wp-image-1132" style="margin: 4px; border: 0px;" title="Pda_modem_connection" src="http://agilemobility.net/wp-content/uploads/2010/03/Pda_modem_connection.png" alt="" width="240" height="320" /></a>The solution uses the network through GPRS/Edge and each of the devices needed to have a cellular (GPRS) Line modem connection defined. Doing this on 20 devices by browsing to Settings -&gt; Connections -&gt; Add new modem connection, then add the same data for APN, username, password was just to much of a pain.</p>
<p>An easier way of doing this is to use the ConfigurationManager, found in the Microsoft.WindowsMobile.Configuration namespace. My purpose was to just make sure there was a cellular modem connection defined  with a working configuration. I wanted this to be the first to be done, and i wanted this to be re-run at application launch each time to reset any &#8220;mis&#8221;-configuration done by end users thorough the pilot period.</p>
<p>Firstly i defined a method that would give me a string with xml data. &#8211; This could also have been done a bit more elegantly or smooth, but it works for me this way.</p>
<pre name="code" class="c-sharp:nogutter">
private static string XmlConnectionString()
{
     string connectionName = "GPRS";
     string username = "";
     string password = "";
     string apnName = "Telenor";
     string myString =

     "&lt;wap-provisioningdoc&gt;" +
     "&lt;characteristic type=\"CM_GPRSEntries\"&gt;" +
     "&lt;characteristic type=\"" + connectionName+ "\"&gt;" +
     "&lt;parm name=\"DestId\"" +
     " value=\"{ADB0B001-10B5-3F39-27C6-9742E785FCD4}\" /&gt;" +
     "&lt;parm name=\"UserName\" value=\" "+ username +"\" /&gt;" +
     "&lt;parm name=\"Password\" value=\"" + password +"\" /&gt;" +
     "&lt;parm name=\"Domain\" value=\"\" /&gt;" +
     "&lt;characteristic type=\"DevSpecificCellular\"&gt;" +
     "&lt;parm name=\"GPRSInfoValid\" value=\"1\" /&gt;" +
     "&lt;parm name=\"GPRSInfoAccessPointName\" value=\"" +
     apnName +"\" /&gt;" +
     "&lt;/characteristic&gt;" +
     "&lt;/characteristic&gt;" +
     "&lt;/characteristic&gt;" +
     "&lt;/wap-provisioningdoc&gt;";

     return myString;
}
</pre>
<p>Secondly I create my modem connection as the very first thing in the application Main method.</p>
<pre name="code" class="c-sharp:nogutter">
[MTAThread]
static void Main()
{
     try
     {
          XmlDocument configDoc = new XmlDocument();
          configDoc.LoadXml(XmlConnectionString());
          ConfigurationManager.ProcessConfiguration(configDoc, false);
     catch (Exception ex)
     {
          // Error Handling.....
     }
}
</pre>
<p>This was a quick and &#8220;dirty&#8221; way of doing it, and it saved me some time.</p>
        <h3>Use Facebook to Comment on this Post</h3>
        <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://agilemobility.net/category/development/code/feed/" num_posts="4" width="600"></fb:comments>]]></content:encoded>
			<wfw:commentRss>http://agilemobility.net/2010/03/creating-a-cellular-line-gprs-modem-from-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finger friendly UI controls for Windows Phone</title>
		<link>http://agilemobility.net/2009/11/finger-friendly-ui-controls-for-windows-phone/</link>
		<comments>http://agilemobility.net/2009/11/finger-friendly-ui-controls-for-windows-phone/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 21:13:29 +0000</pubDate>
		<dc:creator>Alexander Viken</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[.netcf]]></category>
		<category><![CDATA[alpha channel]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[beemobile4.net]]></category>
		<category><![CDATA[compact framework]]></category>
		<category><![CDATA[control suite]]></category>
		<category><![CDATA[controls]]></category>
		<category><![CDATA[dialogbox]]></category>
		<category><![CDATA[finger friendly]]></category>
		<category><![CDATA[Fluid]]></category>
		<category><![CDATA[GUI designer]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[iWeel]]></category>
		<category><![CDATA[kinetic]]></category>
		<category><![CDATA[mirabyte]]></category>
		<category><![CDATA[Mobileforms]]></category>
		<category><![CDATA[PocketPC]]></category>
		<category><![CDATA[Resco]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[toolkit]]></category>
		<category><![CDATA[transparency]]></category>
		<category><![CDATA[transparent]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[wm6.5]]></category>
		<category><![CDATA[WYSIWYG]]></category>

		<guid isPermaLink="false">http://agilemobility.net/?p=928</guid>
		<description><![CDATA[When it comes to application development on the Windows Phone platform things are on the move. Lessons are being learned from the iPhone and its usability experience, from the Android platform etc. The lesson learned is that you need to pay extra attention to how your application looks and feel. You should not under estimate [...]]]></description>
			<content:encoded><![CDATA[<p style="float:right; margin:0 0 10px 15px; width:240px;">
		<img src="http://agilemobility.net/wp-content/uploads/2009/11/bee4mobilescreen.png" width="240" />
		</p><p>When it comes to application development on the Windows Phone platform things are on the move. Lessons are being learned from the iPhone and its usability experience, from the Android platform etc. The lesson learned is that you need to pay extra attention to how your application looks and feel.</p>
<p>You should not under estimate the possibility of usability and design being the selling point in a purchase decisions before feature richness in a case  where two  similar featured apps are compared, where one looks and feels good, and the other has an extra amount of features beyond the core functionality it should handle.</p>
<p>As i am on the look out for a UI toolkit to standardize our enterprise development at work  on I´ll compile a list of libraries that could do the job as i find them. The criteria for the search is ease of use and finger friendliness. Hopeful others also find this list useful.</p>
<p><strong>Fluid<br />
</strong>Fluid is an <a href="http://fluid.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=23310" target="_blank">open source ui framework</a> that aims to mimic the IPhone ui controls. It is hosted by CodePlex and at the time of writing the current beta release is from February 15, 2009. It is released with a <a href="http://fluid.codeplex.com/license" target="_blank"><span id="currentLicense">Microsoft Public License (Ms-PL).<br />
</span></a></p>
<p>Fluid is maintained by a single developer by the looks from the &#8220;People&#8221; list and i can´t find anything that shows continued work on the project. The issue tracker show some new registrations but it´s uncertain if they will be fixed.  My guess on Fluid is that it is a good starting point, and if you are after a iPhone look and feel it is a  good UI library to extend and do continued development on.</p>
<div id="attachment_934" class="wp-caption aligncenter" style="width: 520px"><img class="size-full wp-image-934" title="Fluid" src="http://agilemobility.net/wp-content/uploads/2009/11/Fluid.png" alt="Fluid" width="510" height="419" /><p class="wp-caption-text">Fluid UI controls</p></div>
<p style="text-align: center;">
<p style="text-align: left;">A <a href="http://www.codeproject.com/KB/mobile/MobilePasswordSafe.aspx" target="_blank">Open Source demo application</a> called PasswordSafe that implements Fluid is available from CodeProject for download. The application also include support for Windows Mobile 6.5 gestures. Looking at the source code for PasswordSave i see that there first of all is no designer support. Secondly the application you create uses a &#8220;host&#8221; WinForm and then you create  screens in code and run these screens from the host WinForm. The idea is not bad, but if you are used to WYSIWYG UI design you could be in for a more &#8220;hardcore&#8221; development experience. The benefit of this is that you have more control of your own user interface.</p>
<p><strong> </strong></p>
<div id="attachment_932" class="wp-caption alignleft" style="width: 221px"><strong><strong><img class="size-medium wp-image-932" title="Silvermoon Explorer" src="http://agilemobility.net/wp-content/uploads/2009/11/Explorer3-211x300.jpg" alt="Silvermoon UI controls" width="211" height="300" /></strong></strong><p class="wp-caption-text">Silvermoon UI controls</p></div>
<p style="text-align: left;"><strong>Silvermoon<br />
</strong>Silvermoon is another <a href="http://silvermoon.codeplex.com/" target="_blank">open source ui control lib</a>. It has some of the same properties and aims to do the same as fluid. But where Fluid was copying the usability from iPhone, Silvermoon tries to mimic the behavior of the Windows Mobile 6.5 today screen and sub controls with some extra features. Have a look at this <a href="http://www.youtube.com/watch?v=0OQwo0nt_ek" target="_blank">demo of beta 2 on YouTube</a>.</p>
<p style="text-align: left;">Silvermoon uses OpenGL as the rendering engine, and thus enables rich animations and transitions.</p>
<p style="text-align: left;">At time of writing Silvermoon is out in a beta version 0.92 released with a <a href="http://silvermoon.codeplex.com/license" target="_blank">Microsoft Public License (Ms-PL)</a> on October 4, 2009.</p>
<p style="text-align: left;">The development &#8220;style&#8221; of Silvermoon is the same as with Fluid. The reason for this is (i think) mainly that the same developers does both of the projects. How Fluid and Silverlight will continue the development is uncertain, both projects look promising&#8230; but it could be time consuming to wait for bugfixes and new releases since they have only one developer, <a href="http://www.codeplex.com/site/users/view/Tom69" target="_blank">Thomas Gerber</a>.</p>
<p style="text-align: left;">I like his ideas, and to have a end to end control library that gives a Windows Mobile 6.5 look and feel that is consistent through the application is great. Silvermoon is a candidate for use. The desicion must then be to use and maintain the existing functionality and continue and extend it when we need to.</p>
<p style="text-align: left;"><strong>Resco MobileForms Toolkit</strong></p>
<div id="attachment_954" class="wp-caption alignleft" style="width: 190px"><a href="http://www.resco.net/developer/mobileformstoolkit/advancedlist.aspx"><img class="size-full wp-image-954" title="AdvancedList_02" src="http://agilemobility.net/wp-content/uploads/2009/11/AdvancedList_02.png" alt="Resco advanced list" width="180" height="240" /></a><p class="wp-caption-text">Resco advanced list</p></div>
<p>&#8220;Developer perfection combined with graphic designer creativity creates an unprecedented toolkit. The components and libraries are designed to eliminate hardware limitations of mobile devices, such as small screen or lower performance. A ground-breaking technology — seamlessly integrated in the components — offers multiple benefits to the developer community.&#8221;</p>
<p style="text-align: left;">That is the statement that awaits me at <a href="http://www.resco.net/developer/mobileformstoolkit/overview.aspx" target="_blank">resco.net</a>. Resco is the first commercial toolkit i am looking to evaluate.  <a href="http://www.resco.net/developer/mobileformstoolkit/pricing.aspx" target="_blank">Resco MFT can be purchased</a> as Standard, Professional and Enterprise. with a price from $750 &#8211; $3000 USD. where Standard is a single developer license and the Enterprise is for unlimited developers at a single site.</p>
<p style="text-align: left;">The Resco controls looks like they offer great flexibility, and they support WYSIVYG in Visual Studio. An article detailing the strength of the controls can be found <a href="http://www.resco.net/developer/company/articles.aspx?file=articles/article07" target="_blank">here</a>. When it comes to the weaknesses i´ll have to come back to that. We have some developers using these controls out on client development and their feedback has been that the controls they use has flexibility and is easy to use.</p>
<p style="text-align: left;"><img class="alignleft size-medium wp-image-957" title="smoothlistbox" src="http://agilemobility.net/wp-content/uploads/2009/11/smoothlistbox-198x300.jpg" alt="smoothlistbox" width="198" height="300" /></p>
<p style="text-align: left;">
<p style="text-align: left;">
<p style="text-align: left;"><strong>SmoothListBox</strong><br />
SmootListBox is not a multi control library. It is a listbox implementation created by <a href="http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=4459078" target="_blank">Fredrik Bornander</a> that you navigate using your finger. The control is well explained through an <a href="http://www.codeproject.com/KB/list/SmoothListBox.aspx" target="_blank">article hosted on CodeProjet</a>.</p>
<p style="text-align: left;">I´ve used this as a template for controls in several client solutions and i have found it is easy to implement and extend. Using this control you instantly get a new and look and feel to your application.  Theming the list into your application just makes it feels more smooth and professional&#8230;</p>
<p style="text-align: left;"><strong>Mirabyte Touch Control Suite</strong></p>
<p style="text-align: left;"><a href="http://agilemobility.net/wp-content/uploads/2009/11/MirabyteBox.png"><img class="alignright size-full wp-image-984" title="MirabyteBox" src="http://agilemobility.net/wp-content/uploads/2009/11/MirabyteBox.png" alt="" width="180" height="188" /></a>Mirabyte is a commercial control suite.  <a href="http://www.mirabyte.com/en/products/windows-mobile/touch-controls-suite-for-netcf/information.html" target="_blank">Their gallery display a nice set of useful controls</a> that includes a TouchListBox control upporting finger based kinetic scrolling promising  to be <em>very</em> responsive and smooth, supports multiple screen resolutions, intelligent item selection and stylish transition effects with sliding animation to all four sides of the screen. A ButtonBar and TitleBar, a TouchPicturBox that has a built in (stepped) zoom functionality and supports smooth scrolling  operations using the finger. A TouchPictureButton, a nice looking GlassDialog control that can be used as a  replacement for modal dialogs like MessageBox.Show(&#8230;); the background of the  form is dimmed and either a generic dialog box is shown or a custom skin can be  used (including alpha transparency!).  They&#8217;ve created a YouTube demo of the control features that can be viewed <a href="http://www.youtube.com/watch?v=IcdZaGcNKWw" target="_blank">here</a>.</p>
<p style="text-align: left;">The Mirabyte controls can be purchased at €70 EUR (There&#8217;s a special offer at €50 EUR going on (2010-01-15)  so if you are quick it still might be valid) .</p>
<p style="text-align: left;"><strong>beeMobile4</strong><br />
<a href="http://agilemobility.net/wp-content/uploads/2009/11/bee4mobilescreen.png"><img class="size-full wp-image-985 alignleft" title="bee4mobilescreen" src="http://agilemobility.net/wp-content/uploads/2009/11/bee4mobilescreen.png" alt="" width="240" height="320" /></a><a href="http://beemobile4.net/" target="_blank">beeMobile4.net</a> has a set of single controls that can be purchased off their website.  It&#8217;s not a complete suite, but a set of single controls that you purchase individually. A bit pricey for my liking but they have good looking controls. Each control costs around €40 Eur each.</p>
<p style="text-align: left;">Most interesting controls are the <a href="http://beemobile4.net/?sitecateg=products&amp;productID=4" target="_blank">iWeel</a> which allows the user to choose items from lists by rotating a cylinder. The  items of the list are spread over the surface of the cylinder and behave much  like iPhone&#8217;s date picker. The cylinder can be rotated by touching its surface  and hence spinning it. The <a href="http://beemobile4.net/?sitecateg=products&amp;productID=10" target="_blank">MessageBox</a> which functionality is the same as the of the standard well-known MessageBox control.  However, its stylish look, rounded corners as well as transparency give it  modern and attractiveve design. The <a href="http://beemobile4.net/?sitecateg=products&amp;productID=8" target="_blank">WaitingBar</a> which informs the user of a lengthy background operation. It can operate as either a progress bar or a waiting bar. They also has a set of controls called <a href="http://beemobile4.net/?sitecateg=products&amp;productID=5" target="_blank">TransparentControls</a> that contains a transparent picturebox, checkbox, label, form image button and a control called a VistaButton. All of them looks quite nice.</p>
<p style="text-align: left;">
        <h3>Use Facebook to Comment on this Post</h3>
        <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://agilemobility.net/category/development/code/feed/" num_posts="4" width="600"></fb:comments>]]></content:encoded>
			<wfw:commentRss>http://agilemobility.net/2009/11/finger-friendly-ui-controls-for-windows-phone/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Setting up a maintainable windows phone development project in Visual Studio 2008</title>
		<link>http://agilemobility.net/2009/10/setting-up-a-maintainable-windows-phone-project-in-visual-studio-2008/</link>
		<comments>http://agilemobility.net/2009/10/setting-up-a-maintainable-windows-phone-project-in-visual-studio-2008/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 13:35:09 +0000</pubDate>
		<dc:creator>Alexander Viken</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[.netcf]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[clean code]]></category>
		<category><![CDATA[compact framework]]></category>
		<category><![CDATA[Design Pattern]]></category>
		<category><![CDATA[Device Development]]></category>
		<category><![CDATA[log4net]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[Model-View-Presenter]]></category>
		<category><![CDATA[presenter]]></category>
		<category><![CDATA[quality assurance]]></category>
		<category><![CDATA[Robert C. Martin]]></category>
		<category><![CDATA[Roy Osherove]]></category>
		<category><![CDATA[Software design]]></category>
		<category><![CDATA[Unit testing]]></category>
		<category><![CDATA[view]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://agilemobility.net/2009/10/14/setting-up-a-maintainable-windows-phone-project-in-visual-studio-2008/</guid>
		<description><![CDATA[In this post i share what is my experience, and what i have found to work for me as a best practice for setting up my projects and software structure when developing windows phone applications in Visual Studio 2008. Basically I am  applying some Model-View-Presenter principles tweaked for simplicity and dividing the different parts into [...]]]></description>
			<content:encoded><![CDATA[<p style="float:right; margin:0 0 10px 15px; width:240px;">
		<img src="http://agilemobility.net/wp-content/uploads/2009/10/Clean-Code.jpg" width="240" />
		</p><p>In this post i share what is my experience, and what i have found to work for me as a best practice for setting up my projects and software structure when developing windows phone applications in Visual Studio 2008.</p>
<p>Basically I am  applying some Model-View-Presenter principles tweaked for simplicity and dividing the different parts into separate projects.</p>
<p>The Model-View-Presenter software design pattern is in my opinion the easiest pattern to use. It is also easy to get going with if you`re not familiar with the jungle of three or four letter acronym patterns and support frameworks available.</p>
<p>Patterns are important and you should use them! By applying, in this case a MVP pattern we can easily handle the rapid changes in new hardware, screen form factors, UX requirements and connectivity requirements to back-end systems.</p>
<p>Other software design patterns exists and they can do the same thing and more, but the MVP pattern is simplistic, easy to understand and to implement. It also (if implemented correctly) ensures testability.</p>
<p><strong>Model-View-Presenter pattern overview</strong><br />
As you will see later; each application form is a view. Each view sends and receives data through a presenter and the presenter is responsible for delivering the correct data required by the view. The presenter acts as a data broker between the back end model that communicate with back end databases and/or web services etc. and the front end view that is communicating with the end user.</p>
<p><img class="aligncenter size-full wp-image-873" title="mvp" src="http://agilemobility.net/wp-content/uploads/2009/10/mvp.png" alt="mvp" width="450" height="349" /></p>
<p>The most effective implementation of this pattern is by creating a 1:1 mapping for object:interface. Meaning that for each view you have a view interface, for every presenter a presenter interface and for each model object there is a model interface.</p>
<p>There is no specific requirements regarding the use of application level events in this pattern besides that events must follow the data flow set in the design pattern. A model interface can expose events to be consumed by a presenter, a presenter can expose events for the view to consume, and the presenter can subscribe to events from the view.</p>
<p><strong>Setting up the Visuals Studio 2008 solution<br />
</strong><img class="alignleft size-full wp-image-883" title="visualstudio2008" src="http://agilemobility.net/wp-content/uploads/2009/10/visualstudio2008.jpeg" alt="visualstudio2008" width="191" height="210" />When you are setting up Visual Studio 2008 for development you do this with a base set of 4 core projects which will be the foundation of your application. By applying this layering you create a solution that is easy to maintain and extend, this is valuable if you should need to re-design the application for a different mobile form factor or screen size. And it would be easy to replace the concrete implementation of the model if you are to use a different communication platform in the application or different back-end database system.</p>
<p>The next section shows in detail how you divide your solution and what you place where.</p>
<p><strong>Mobile.[ProjectName].MVP</strong><br />
The MVP project is created as a Library project type and is the skeleton for your application. In this project you create 3 subfolders named “Model”, “View” and “Presenter”.</p>
<p>My opinion on the best practice for naming conventions for interfaces is that every interface name should be prefixed with an upper case “I” to indicate that it is an interface.</p>
<p>There are different views on the topic of prefixing interfaces. The upper case &#8220;I&#8221;  is one opinion, another one, popular in the Java community is that you do not prefix interfaces and rather have an “impl” suffix on your concrete implementation classes. Example of this would be that you have a Login interface and a LoginImpl concrete class implementation, but I have found that prefixing interfaces makes more sense to me.</p>
<p>The skeleton project; Mobile.[ProjectName].MVP should NOT have any bindings to concrete hardware or software modules in code or thrugh references. This is to be implemented inside the concrete view or model projects.</p>
<p><strong>Mobile.[ProjectName].MVP parts</strong><br />
The next section is a detailed explanation on how the MVP  skeleton is implemented.</p>
<p><strong>Model<br />
</strong>In the model folder you place interfaces for retrieving data and sending data to the backend domain, this needs to be generic and should contain data access factory interfaces, communication factory interfaces etc.</p>
<pre name="code" class="c-sharp:nogutter">public interface ILoginModel
{
     Bool UserAuthenticated(string user, string password);
     SomeObject GetPreConditions();
}</pre>
<p><strong>View<br />
</strong>In the view folder you place the view interfaces. There must be an interface for each main application form. Each view interface name should be named logically for its use with a naming pattern like I&amp;lt;function&gt;View. For instance an interface for your login screen will be named ILoginView and product detail view should be called IProductDetailsView.</p>
<p><strong>ViewData/SaveData and View requirements</strong><br />
A view will have some requirements for initial data upon presentation and also return some changed or processed data that it wants to deliver up the application stack.  It might have need of localized resources like language spesific label texts, it might need a list of data the user is to do a selection from, or it is the product details to display on a product details form. This is what we call “ViewData” and “SaveData”. These requirements are defined in a view interface using generics.</p>
<pre class="c-sharp:nogutter">public interface ILoginView&lt;TViewData, TSaveData&gt; { … }</pre>
<p>You do not need to define both view and/or save data. Define those your view requires. The advantage of this is that you can havecustom view/savedata for each concrete implementation of the view interface, giving great flexibility. The constraint is that the concrete implementation of your presenter needs to know what this “custom” view/save data is throughout its lifecycle.</p>
<p>We’ve found that defining a BaseViewData class inside the Mobile.[ProjectName].View namespace ensures that it is always available.</p>
<p>The BaseViewData class encapsulates everything that is a common requirement for all views. This could i.e. be a text source reader for language specific UI labels amongst others.<br />
Inside the view interface file we create a concrete ViewData class for that specific view that extends the BaseViewData. The same can/should be done if there are common SaveData.</p>
<pre name="code" class="c-sharp:nogutter">namespace Mobile.[ProjectName].MVP.View
{
     public interface ILoginView
     {
          void InitializeView(TViewData viewData);
          void UserValidated();
          void InvalidUser(string reason);
     }

     public class LoginViewData : BaseViewData
     {
          LoginView specific view data
     }

     Public class LoginSaveData
     {
          LoginViewspecific save data
     }
}</pre>
<p><strong>Presenter</strong><br />
The presenter interfaces defines the minimum requirements for the concrete presenter implementations.</p>
<pre  name="code" class="c-sharp:nogutter">public interface ILoginPresenter
{
     void Initialize();
     void AuthenticateUser(string user, string pass);
}</pre>
<p>As we have designed it; it is not bound to a view or view interface.</p>
<p>The above explains how you create the &#8220;skeleton&#8221;,  next we continue with the concrete implementation of these interfaces.</p>
<p><strong>Mobile.[ProjectName].Model</strong><br />
The model project is created as a library project and has a reference to the Mobile.[ProjectName].MVP project/assembly. Mobile.[ProjectName].Model is the concrete implementations of the Mobile.[ProjectName].MVP.Model interfaces. This module should handle all database operations and network and hardware I/O  in your application. The model project should not need to know anything about your presenter or view.</p>
<pre name="code" class="c-sharp:nogutter">Public class LoginModel : ILoginModel
{
     Bool UserAuthenticated(string user, string password)
     {
          // connect to web service or database
          // check user credentials
          return (true|false)
     }

     SomeObject GetPreConditions()
     {
          // get some pre conditions and return them…
     }
}</pre>
<p><strong>Mobile.[ProjectName]<br />
</strong>The Mobile.[ProjectName] project is created as a Windows Application and is the concrete implementation of the Mobile.[ProjectName].MVP.View interfaces. All code specific to this implementation should be placed here. This is the UI of the application.</p>
<pre name="code" class="c-sharp:nogutter">public class LoginForm : Form , ILoginView&lt;LoginViewData&gt;
{
     ILoginPresenter _presenter = new LoginPresenter(this);
     Public LoginForm()
     {
          _presenter = new LoginPresenter(this);
          _presenter.Initialize();
     }
     public void InitializeView(LoginViewData viewData)
     {
          … Set up form data.
     }
     Private void LoginButton_Click(object s, EventArgs e)
     {
          // ask the presenter to validate user input….
          _presenter.AuthenticateUser(txtUser.Text, txtPass.Text);
     }
     public void UserValidated()
     {
          … Validated user can continue to work…
     }
     public void InvalidUser(string reason)
     {
          … Inform user about error…
     }
}</pre>
<p><strong>Mobile.[ProjectName].Presenter</strong><br />
The presenter project is created as a library project and references the Mobile.[ProjectName].MVP project. In this project you place all concrete presenter implementations. The concrete implementation of ILoginPresenter is in our implementation example bound to a login view interfaces and a concrete ViewData or SaveData class through its constructor.</p>
<pre name="code" class="c-sharp:nogutter">Namespace Mobile.[ProjectName].Presenter
{
     public class LoginPresenter : ILoginPresenter
     {
          private ILoginView&lt;LoginViewData&gt; _currentView;
          private ILoginModel _currentModel;
          Public LoginPresenter(
          ILoginView&amp;lt;LoginViewData&amp;gt; view,
          ILoginModel model

          public LoginPresenter(ILoginView&lt;LoginViewData&gt; view, ILoginModel model);
          {
               _currentView = view;
               _currentModel = model;
          }

          Public void Initialize()
          {
               LoginViewData lvd = new LoginViewData();

               // populate the view data object if needed.
               SomeObject obj = _currentModel.GetPreConditions();
               Lvd.property1 = obj.property1
               ….

               // send the data required  by the view
               _currentView.InitializeView(lvd);
          }

          Public void AuthenticateUser(string user, string pass)
          {
               If (_currentModel.UserAuthenticated(user,pass)
                    _currentView.UserValidated()
               Else
                    _currentView.InvalidUser(“Unknown user”);
          }
     }
}</pre>
<p><strong>Other supporting projects</strong><br />
In addition to the above 4 projects you might have utility classes that can be shared amongst different implementations. This could be custom UI controls placed in a separate project for reusability communication libraries etc. They should be referenced and consumed in either your concrete model or view implementations.</p>
<p><strong>Software Design Pattern Summary</strong><br />
From this pattern you see that there is constant communication between the presenter and the view and the presenter and the model. The concrete view is responsible for defining what presenter to use and tells the presenter what view is calling the presenter. The view then tells the presenter to start initialization, and the presenter informs the view by calling its initialize view method. The concrete presenter does not care where it gets its data from as long as it comes through a model interface, and it does not care about the inner workings of the view as long as its outer working environment is defined through the view interface.</p>
<p>We have now implemented testability.</p>
<p><em>This pattern could be extended even further; it is just a matter of finding the right layer of abstraction. For instance the ViewData and SaveData classes could have been interface based, more use of generics could have been implemented etc. but the preceding examples provides the layering we have found useful in our development projects</em>.</p>
<p><strong>Thoughts on code quality control</strong><br />
If you are ready to go this step into implementing a pattern that makes your code extendable, you should also think about how you code it and how you keep it bug free.</p>
<p><strong>Coding conventions</strong><br />
I choose to follow the naming conventions found here: <a href="http://msdn.microsoft.com/en-us/library/xzf533w0%28VS.71%29.aspx">http://msdn.microsoft.com/en-us/library/xzf533w0%28VS.71%29.aspx</a>, if you don’t like this one, find one that is commonly know and stick to it!</p>
<p>When naming methods, properties and variables make sure they are descriptive of what they do.  Descriptive property, method or variable names should make in-code comments obsolete.</p>
<p>There is no need to limit the amount of characters used for naming a method “GetListOfUsersFromNamedSource” is a descriptive name that explains what it does.</p>
<p>If your method name contains &#8220;and&#8221; in it; it indicates that your method does more than one thing and should be re-factored into two or more separate methods. One method should have one single responsibility.</p>
<p>Avoid &#8220;super methods&#8221;! If you have a method with an if/else block and e<img class="alignleft size-thumbnail wp-image-888" title="Clean-Code" src="http://agilemobility.net/wp-content/uploads/2009/10/Clean-Code-150x150.jpg" alt="Clean-Code" width="150" height="150" />ach of the blocks contain 30 lines of code, re-factor into a method with an if/else block that calls two descriptive methods.</p>
<p>More pointers on how to improve code quality can be found in the book &#8220;Clean Code&#8221; by Robert C. Martin &#8211; <a href="http://blog.objectmentor.com/articles/2008/04/08/clean-code-whew">http://blog.objectmentor.com/articles/2008/04/08/clean-code-whew</a>. It is a great book.</p>
<p><strong>Logging and Error handling</strong><br />
Log all errors! Logging of exception events shuld be done through log4net from Apache (<a href="http://logging.apache.org/log4net/index.html)">http://logging.apache.org/log4net/index.html)</a></p>
<p>All developed code modules should implement and use log4net as a logging mechanism. In a try/catch/finally code block, the catch block should always log it´s exception to log4net as in the following example.</p>
<pre name="code" class="c-sharp:nogutter">try
{
     .... do something
}
catch (SpesificException ex)
{
     log.Error("Unable to do something",ex);

     .... do error handling and/or push it up the stack.
}
catch (Exception ex)
{
     log.Error("Unhandled exception",ex);
}
finally
{
     ... do cleanup stuff
}</pre>
<p>If any other log4net logger types are used; Debug, Warn and Info, i check to confirm that the used type is configured like the following example:</p>
<pre name="code" class="c-sharp:nogutter">if (log.IsDebugEnabled)
     log.Debug("Some debug information");

if (log.IsInfoEnabled)
     log.Info("Some informational message")

if (log.IsWarnEnabled)
     log.Warn("Some warning message");</pre>
<p><strong>Testability<br />
</strong>While writing unit tests i try to follow the principles found in the book &#8220;Art of unit testing&#8221; by Roy Osherove  &#8211; <a href="http://www.artofunittesting.com/">http://www.artofunittesting.com/</a></p>
<p><em><img class="alignleft size-full wp-image-886" title="artofunittesting" src="http://agilemobility.net/wp-content/uploads/2009/10/artofunittesting.png" alt="artofunittesting" width="192" height="240" />&#8220;A unit test is an automated piece of code that invokes the method or class being tested and then checks some assumptions about the logical behavior of that method or class. A unit test is almost always written using a unit-testing framework. It can be written easily and runs quickly. It’s fully automated, trustworthy, readable, and maintainable.&#8221;</em></p>
<p>The preceding MVC implementation is created with testability in mind and each module containing logical code must have a set of accompanying unit tests proving how it behaves within and outside the bounds of its specification.</p>
<p>Logical code is any piece of code that has some sort of logic in it, small as it may be. It’s logical code if it has one or more of the following: an IF statement, a loop, switch or case statements, calculations, or any other type of decision-making code.</p>
<p>Unit tests must be implemented using the Nunit testing framework (<a href="http://www.nunit.org/index.php)">http://www.nunit.org/index.php)</a>and each of the tests must be created as isolated tests with no external requirements. Meaning that you have to run test s“a”, “b” and “c“ in sequence, or that have a tests that require any other pre-conditions like access to databases, network etc.</p>
<p>When naming test, for clarity use the naming convention from &#8220;Art of Unit Testing&#8221;:</p>
<pre name="code" class="c-sharp:nogutter">[Test]
public void [MethodUnderTest]_[Scenario]_[ExpectedBehavior]()
{
     .... test code
}</pre>
<p>A sample sample MVP Visual Studio 2008 solution <a href="http://cid-196625bc59fbf3e3.skydrive.live.com/self.aspx/Offentlig/SmartDeviceMvpDemo.zip" target="_blank">can be found here</a>.</p>
        <h3>Use Facebook to Comment on this Post</h3>
        <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://agilemobility.net/category/development/code/feed/" num_posts="4" width="600"></fb:comments>]]></content:encoded>
			<wfw:commentRss>http://agilemobility.net/2009/10/setting-up-a-maintainable-windows-phone-project-in-visual-studio-2008/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to use the MSDN managed code gesture wrapper in a Windows Mobile 6.5 device project</title>
		<link>http://agilemobility.net/2009/10/using-managed-gesture-wrapper/</link>
		<comments>http://agilemobility.net/2009/10/using-managed-gesture-wrapper/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 08:19:38 +0000</pubDate>
		<dc:creator>Alexander Viken</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[.netcf]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[compact framework]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[EventArgs]]></category>
		<category><![CDATA[GestureEventArgs]]></category>
		<category><![CDATA[GestureRecognizer]]></category>
		<category><![CDATA[gestures]]></category>
		<category><![CDATA[GestureScrollEventArgs]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[Windows Mobile 6.5]]></category>
		<category><![CDATA[wm6.5]]></category>

		<guid isPermaLink="false">http://agilemobility.net/?p=805</guid>
		<description><![CDATA[Here´s a short how-to for getting started with gestures in your Windows Mobile applications. First how you set up your device project, and then i explain how it works using the managed gesture wrapper from MSDN. First of all you need to consider if you would like to do it the &#8220;hardcore&#8221; way? by doing all the P/Invoke [...]]]></description>
			<content:encoded><![CDATA[<p style="float:right; margin:0 0 10px 15px; width:240px;">
		<img src="http://agilemobility.net/wp-content/uploads/2009/10/gestureevents.gif" width="240" />
		</p><p>Here´s a short how-to for getting started with gestures in your Windows Mobile applications. First how you set up your device project, and then i explain how it works using the managed gesture wrapper from MSDN.</p>
<p>First of all you need to consider if you would like to do it the &#8220;hardcore&#8221; way? by doing all the P/Invoke native calls yourself (then<a href="http://msdn.microsoft.com/en-us/library/ee220920.aspx" target="_blank"> this documentation </a>on MSDN is really useful) or if you just want to get gestures working and use the managed wrapper available in the <a href="http://code.msdn.microsoft.com/gestureswm/Release/ProjectReleases.aspx?ReleaseId=3177" target="_blank">MSDN code library,</a> - You can also find the source code for the  wrapper there if you later need to find out how it really works. I haven´t  investigated the wrapper library yet, so I am not sure if it  encapsulates all the native functionality that is available.</p>
<p>First of all; Start Visual Studio 2008 and create a new device application solution. There is no specific Windows Mobile 6.5 application template so you just choose a Windows Mobile 6 project. Next you need to do is to add a reference to Microsoft.WindowsMobile.Gestures.dll (assuming now that you have downloaded the dll file) in your WYSIWYG in VS08.</p>
<ol>
<li><img class="size-full wp-image-808 alignright" title="VisualStudio2008 toolbox" src="http://agilemobility.net/wp-content/uploads/2009/10/tooboximport.gif" alt="Visual Studio 2008 toolbox" width="194" height="252" />Right click on the General tab in the toolbox and select &#8220;choose items&#8230;&#8221;</li>
<li>In the &#8220;Choose toolbox items&#8221; dialog select the browse button in the &#8220;.NET Framework Components&#8221; tab</li>
<li>Browse to where you extracted the Gestures dll file and select it.</li>
<li>A component called &#8220;GestureRecognizer&#8221; has it´s checkbox checked and selected.  Click the OK button.</li>
</ol>
<p>If you look at your toolbox now you see that you have two new components. GestureRecognizer and PhysicEngine. These are non-visual components that you use in your application to interact with the native api&#8217;s.</p>
<p>Drag a GestureRecognizer component onto your application form and it is placed next to the default mainMenu1 component.  The GestureRecognizer component has very few properties and most important are the &#8220;Name&#8221; and &#8220;TargetControl&#8221;. You should name your component so that it reflects the target control you intend to &#8220;gesturize&#8221;. The TargetControl property has a drop down list with all components in your form. You will need to attach the GestureRecognizer to a component, or to the form itself.</p>
<p style="text-align: center;"><img class="size-full wp-image-815 aligncenter" title="VisualStudio" src="http://agilemobility.net/wp-content/uploads/2009/10/VisualStudio.gif" alt="Visual Studio 2008" width="400" height="300" /></p>
<p>The interesting part of the component is found when you view the events that GestureRecognizer exposes. The events are Begin, DoubleSelect, End, Gesture, Hold, Pan, Scroll and Select.</p>
<ul>
<li><strong><img class="alignright size-full wp-image-818" title="gestureevents" src="http://agilemobility.net/wp-content/uploads/2009/10/gestureevents.gif" alt="gestureevents" width="194" height="222" />Pan</strong> gesture is the event you want to use for moving things around with the finger in your UI.</li>
<li><strong>Scroll </strong>is triggered when you accelerate the pan, meaning that when a pan event occurs, and you move your finger in any direction a Scroll event is fired. The pan state has entered “Inertia”.</li>
<li><strong>Select</strong> is when you tap the screen.</li>
<li><strong>DoubleSelect</strong> is the same as a double tap.</li>
<li><strong>Hold</strong> fired when you tap and then hold your finger on the screen.</li>
<li><strong>Begin</strong> is as the name implies an event that is triggered at the start of any gesture.</li>
<li><strong>End</strong> is triggered when any gesture is ending.</li>
<li><strong>Gesture</strong> is a generic event that fires on all events.</li>
</ul>
<p>Each of the event work in a familiar way and each event carries an Microsoft.WindowsMobile.Gestures.GestureEventArgs object that extends from EventArgs. Here are the properties from GestureEventArgs:</p>
<ul>
<li><strong>.Kind </strong>gives you an enum with what type of gesture was triggered (Begin, DoubleSelect, End, Hold, Pan, Scroll and Select)</li>
<li><strong>.State </strong>gives you an enum value with the state of the gesture. The gesture state can be one of the following: Begin, End, Inertia or None.</li>
<li><strong>.X</strong> is the int coordinate from left</li>
<li><strong>.Y</strong> is the int coordinate from the top.</li>
<li><strong>.Location</strong> is a Point of X and Y</li>
</ul>
<p>The exception from this is the Scroll event that gives you a GestureScrollEventArgs object that inherits from GestureEventArgs. The GestureScrollEventArgs object has some additional properties.</p>
<ul>
<li><strong>.Angle</strong> of the scroll movement.</li>
<li><strong>.ScrollDirection </strong>is an enum value of either Up, Down, Left or Right.</li>
<li><strong>.Velocity</strong> is the speed of your moment as a number representing pixels per second movement.</li>
</ul>
<p>The best way to see this in work is to add a label control to your form, resize it so it can contain multiple lines. Then try to subscribe to the ie. pan event. Inside the Pan event method you can add the following code:</p>
<pre name="code" class="c-sharp:nogutter">private void gestureRecognizer1_Pan(object sender, Microsoft.WindowsMobile.Gestures.GestureEventArgs e)
{
     string outPattern = "{0}:{1}-({2}:{3})";
     label1.Text = string.Format(outPattern, e.Kind, e.State, e.X, e.Y);
}</pre>
<p>If you then run this on your Windows Mobile 6.5 device or emulator you can see the tracking information from the event inside the label. Playing around with this is useful and you can add more events to try the interaction between them. When you are familiar with how it work it is much easier to use it in your later projects.</p>
        <h3>Use Facebook to Comment on this Post</h3>
        <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://agilemobility.net/category/development/code/feed/" num_posts="4" width="600"></fb:comments>]]></content:encoded>
			<wfw:commentRss>http://agilemobility.net/2009/10/using-managed-gesture-wrapper/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WM 6.5 gestures and physics engine</title>
		<link>http://agilemobility.net/2009/09/wm-6-5-gestures-and-physics-engine/</link>
		<comments>http://agilemobility.net/2009/09/wm-6-5-gestures-and-physics-engine/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 11:40:40 +0000</pubDate>
		<dc:creator>Alexander Viken</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[.netcf]]></category>
		<category><![CDATA[Alex Yakhnin]]></category>
		<category><![CDATA[compact framework]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[gesture events]]></category>
		<category><![CDATA[gestures]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[listview]]></category>
		<category><![CDATA[managed code]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[physics engine]]></category>
		<category><![CDATA[PocketPC]]></category>
		<category><![CDATA[Ron Buckton]]></category>
		<category><![CDATA[tab control]]></category>
		<category><![CDATA[treeview]]></category>
		<category><![CDATA[webcast]]></category>
		<category><![CDATA[webview]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[Windows Mobile 6.5]]></category>
		<category><![CDATA[wm6.5]]></category>

		<guid isPermaLink="false">http://agilemobility.net/?p=774</guid>
		<description><![CDATA[It&#8217;s friday and time for some fun, and having a look at the gesture and physics engine of WM 6.5 qualifies as such . Googling for developer references i found that on august 26th and september 2nd 2009 Microsoft through Alex Yakhnin and Ron Buckton hosted two developer webcasts (level 400) on the gesture and physics engine of [...]]]></description>
			<content:encoded><![CDATA[<p style="float:right; margin:0 0 10px 15px; width:240px;">
		<img src="http://agilemobility.net/wp-content/uploads/2009/09/wm65emulator.jpg" width="240" />
		</p><p><img class="alignleft size-medium wp-image-775" title="wm65emulator" src="http://agilemobility.net/wp-content/uploads/2009/09/wm65emulator-197x300.jpg" alt="wm65emulator" width="197" height="300" />It&#8217;s friday and time for some fun, and having a look at the gesture and physics engine of WM 6.5 qualifies as such . Googling for developer references i found that on august 26th and september 2nd 2009 Microsoft through <a href="http://blogs.msdn.com/priozersk" target="_blank">Alex Yakhnin</a> and <a href="http://blogs.msdn.com/rbuckton" target="_blank">Ron Buckton</a> hosted two developer webcasts (level 400) on the gesture and physics engine of Windows Mobile 6.5.</p>
<p>This was a really useful intro on how to implement this your own .netcf applications. Gestures are supported in the existing standard ListView, Listbox, WebView, TreeView and Tab controls. and you get this characteristics just by running the application on a WM 6.5 device. But to programmatically control the gestures you need to handle the Select, Scroll, Pan, Hold and DoubleSelect events.</p>
<p>A detailed guide on how for the gesture apithis can be found on <a href="http://msdn.microsoft.com/en-us/library/ee220920.aspx" target="_blank">MSDN here</a>. To fully understand this you need to be familiar with P/Invoke and native calls.</p>
<p><a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032422141&amp;EventCategory=5&amp;culture=en-US&amp;CountryCode=US" target="_blank">WebCast part 1</a><br />
<a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&amp;EventID=1032422151&amp;CountryCode=US" target="_blank">WebCast part 2</a><br />
Download code samples and the managed <a href="http://code.msdn.microsoft.com/gestureswm/Release/ProjectReleases.aspx?ReleaseId=3177" target="_blank">gesture wrapper here</a>.</p>
        <h3>Use Facebook to Comment on this Post</h3>
        <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://agilemobility.net/category/development/code/feed/" num_posts="4" width="600"></fb:comments>]]></content:encoded>
			<wfw:commentRss>http://agilemobility.net/2009/09/wm-6-5-gestures-and-physics-engine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>.netcf code on the iPhone</title>
		<link>http://agilemobility.net/2009/09/netcf-code-on-the-iphone/</link>
		<comments>http://agilemobility.net/2009/09/netcf-code-on-the-iphone/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 10:41:40 +0000</pubDate>
		<dc:creator>Alexander Viken</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.netcf]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[compact framework]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[redFIVElabs]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[Symbian]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://agilemobility.net/2009/09/15/netcf-code-on-the-iphone/</guid>
		<description><![CDATA[Norwegian online paper digi.no (Norwegain article) has an interesting article today about an anouncement from the open source project MONO. They have completed a SDK called MonoTouch. MonoTouch is the Mono edition for Apple&#8217;s iPhone and Apple&#8217;s iPod Touch devices.  MonoTouch allows developers to create C# and .NET based applications that run on the iPhone [...]]]></description>
			<content:encoded><![CDATA[<p style="float:right; margin:0 0 10px 15px; width:240px;">
		<img src="http://agilemobility.net/wp-content/uploads/2009/09/mtlogo_thumb.png" width="240" />
		</p><p><a href="http://agilemobility.net/wp-content/uploads/2009/09/mtlogo.png"><img style="display: inline" title="mt-logo" src="http://agilemobility.net/wp-content/uploads/2009/09/mtlogo_thumb.png" alt="mt-logo" width="240" height="68" /></a></p>
<p>Norwegian online paper digi.no (<a href="http://www.digi.no/823289/%C5pner-for-net-utvikling-for-iphone" target="_blank">Norwegain article</a>) has an interesting article today about an anouncement from the open source project MONO. They have completed a SDK called MonoTouch. MonoTouch is the Mono edition for Apple&#8217;s iPhone and Apple&#8217;s iPod Touch devices.  MonoTouch allows developers to create C# and .NET based applications that run on the iPhone and can take advantage of the iPhone APIs as well as reusing both code and libraries that have been built for .NET as well as existing skills. MonoTouch also includes XCode integration.</p>
<p><a href="http://agilemobility.net/wp-content/uploads/2009/09/Md_hw_iphone8.png"><img style="border-right-width: 0px; margin: 0px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Md_hw_iphone8" src="http://agilemobility.net/wp-content/uploads/2009/09/Md_hw_iphone8_thumb.png" border="0" alt="Md_hw_iphone8" width="240" height="179" align="left" /></a>MonoTouch is not open source and comes with some quirks when it comes to application distribution and licensing but it is a good step in the right direction.</p>
<p>MonoTouch comes in three version Personal for $399, Enterprise for $999 and Enterprise 5 for $3 99.</p>
<p>You are still (more or less) required to own a Macintosh to do development.</p>
<p>This is a great benefit for .netcf developers looking into developing applications for the Iphone without the pain of having to go through learning objective-c, the native iPhone application language.</p>
<p>The release is for the official version 1.0 of the SDK and more information can be found on the project website, including documentation and tutorials.</p>
<p><a href="http://monotouch.net/">http://monotouch.net/</a></p>
<p>Now, together with redFiveLabs (<a title="http://www.redfivelabs.com/" href="http://www.redfivelabs.com/">http://www.redfivelabs.com/</a>) and their wrapper for the Symbian OS, you theoretically can deploy the same code base to all of the major mobile platforms.</p>
<p>As soon as the trial edition is available i´ll have a go at it and see if it´s good for anything.</p>
        <h3>Use Facebook to Comment on this Post</h3>
        <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://agilemobility.net/category/development/code/feed/" num_posts="4" width="600"></fb:comments>]]></content:encoded>
			<wfw:commentRss>http://agilemobility.net/2009/09/netcf-code-on-the-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subscribe to form events with Dexterra</title>
		<link>http://agilemobility.net/2009/07/subscribe-to-form-events-with-dexterra/</link>
		<comments>http://agilemobility.net/2009/07/subscribe-to-form-events-with-dexterra/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 11:29:03 +0000</pubDate>
		<dc:creator>Alexander Viken</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[.netcf]]></category>
		<category><![CDATA[actionback]]></category>
		<category><![CDATA[actionlaunch]]></category>
		<category><![CDATA[compact framework]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Dexterra]]></category>
		<category><![CDATA[Dexterra.Framework.Screen]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[smartmobile]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://agilemobility.net/?p=595</guid>
		<description><![CDATA[When you work with the Dexterra framework, you don&#8217;t really have access to any of the notification engines you normally would have on the front end of an application. This became a major problem for us in a project we were working on. Our goal was that we had a details screen for data with [...]]]></description>
			<content:encoded><![CDATA[<p>When you work with the Dexterra framework, you don&#8217;t really have access to any of the notification engines you normally would have on the front end of an application. This became a major problem for us in a project we were working on.</p>
<p>Our goal was that we had a details screen for data with a button that would take you to a form with a list of selectable items. When an item was selected from the list, we wanted to show the selection in our details screen without having to send the data back into the dexterra business objects from the list screen, and then read the updated data from the database into the detail screen.</p>
<p>We were using Dexterra version 5.6.1 for our development and the solution we found was this.</p>
<p>We have two forms DetailsScreen and ListScreen inheriting from the Dexterra.Framework.Screen class.<br />
Inside the ListScreen we have an public event named ListItemSelectedEvent and on the DetailsScreen we have a button named btnListSelection.</p>
<p>I am not going to show how the ListItemSelectedEvent gets triggered in this example,if needed i can post an update with the code.</p>
<p>First of all we need to create an ActionLaunch object. We solved this in our application with an FlowHander class.</p>
<pre name="code" class="c-sharp:nogutter">
FlowHandler flow = new FlowHandler();
</pre>
<p>We have a number of methods in this class. Returning the most common Action objects we use from the Dexterra framework, ActionLaunch, ActionDone, ActionExit, ActionBack. The one we need is ActionLaunch and we get it from the method GoToNewScreen:</p>
<pre name="code"  class="c-sharp:nogutter">
public ActionLaunch GoToNewScreen(Component parentComponent,
                                             String target)
{
        ActionLaunch actionLaunch = new ActionLaunch();
        actionLaunch.EventHandlerTypeName = "actionLaunch";
        actionLaunch.FriendlyName = "actionLaunch";
        actionLaunch.InitiatorEvent = "Click";
        actionLaunch.ParentComponent = parentComponent;
        // CreatePocketPCSheet returns a configured
        // PocketPCSheet object
        // Not included
        actionLaunch.Target =
                   CreatePocketPCSheet(target);

        ActionFlow actionFlow = new ActionFlow();
        actionFlow.Actions.Add(actionItem);
        actionFlow.EventHandlerTypeName = "";
        actionFlow.FiringPattern = FiringPattern.None;
        actionFlow.FriendlyName = "actionFlow";
        actionFlow.InitiatorClass = null;
        actionFlow.InitiatorEvent = null;

        return actionLaunch;
}
</pre>
<p>In our DetailsScreen class we have a member variable for the ActionLaunch and our ListScreen;</p>
<pre name="code"  class="c-sharp:nogutter">
private ActionLaunch _newScreenLaunch;
private ListScreen _listScreen;
</pre>
<p>In the Load method of DetailsScreen we create the ActionLaunch and subscribe to our button click event.</p>
<pre name="code"  class="c-sharp:nogutter">
private void Form_Load(object sender, System.EventArgs e)
{
        btnListSelection.Click += btnListSelectionEvent;
        string newScreen = "projectname.ListScreen";
        _newScreenLaunch = flow.GoToNewScreen(this,newScreen);
}
</pre>
<p>DetailsScreen is the parent component (this) and newScreen is the full path to the screen to open. Dexterra will use reflection to add this to it&#8217;s stack.</p>
<p>Finally we have the event method for our button click where we perform the _newScreenLaunch action and get the ListScreen from the screen stack.</p>
<pre name="code"  class="c-sharp:nogutter">
private void BtnChangeStationClick(object sender, EventArgs e)
{
        _newScreenLaunch.PerformAction();
        Host host =
            EngineCache.Instance[EngineCache.DEFAULT]
              .ScreenStack.Peek();
        if (IsTargetMyListScreen(host.TargetInstance)
        {
            _listScreen = (ListScreen) host.TargetInstance;
            _listScreen.ListItemSelectedEvent +=
                UpdateDetailsFormWithSelection;
        }
}
</pre>
<p>We perform the action &#8211; this puts our ListScreen on the top of the screen stack and trigger Dexterra action for opening the screen.We then retrieve it from our screen stack. Validate that it is a ListScreen we got before we subscribe to the event.</p>
<pre name="code"  class="c-sharp:nogutter">
private bool IsTargetMyListScreen(Dexterra.Framework.Screen target)
{
        if (target == null) return false;
        if (target is ListScreen) return true;
        else return false;
}
</pre>
<p>and then subscribe to the event on the ListScreen.</p>
<pre name="code"  class="c-sharp:nogutter">
    _listScreen = (ListScreen) host.TargetInstance;
    _listScreen.ListItemSelectedEvent +=
                   UpdateDetailsFormWithSelection;
</pre>
<p>When the ListItemSelectedEvent event fires &#8211; the UpdateDetailsFormWithSelection method is triggered and we update our DetailsScreen data.</p>
<p>I am still quite new to Dexterra but have not found any easier way to come around this, we also got pointers from Dexterra Central that this was the best way to do it.</p>
<p>What must be said here is that our application was created from code and code only, we did not use any of the WYSIWYG (What You See Is What You Get) Dexterra encourages you to use, since we found that building applications in drag and drop just doesn&#8217;t give you usable applications in any commercial form.</p>
<p>We created the application with a MVP (Model-View-Presenter) application pattern and used Dexterra as an integration and data access platform in this app.</p>
        <h3>Use Facebook to Comment on this Post</h3>
        <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://agilemobility.net/category/development/code/feed/" num_posts="4" width="600"></fb:comments>]]></content:encoded>
			<wfw:commentRss>http://agilemobility.net/2009/07/subscribe-to-form-events-with-dexterra/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

