CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

John Papa [MVP C#]

.NET Code Samples, Data Access, and Other Musings

Smartphone Skills: Part 03 - Development Environment

So far in this series I have introduced the basics of Smartphone development and how to get setup with the device emulators. Now that we’re ready to do some Smartphone development (or in general in mobile development) its time to crank up the IDE, familiarize yourself with the tools and start coding. So that’s what we’ll do in this post.

*** In case you want to review my previous posts on this topic, I’ll include a list of the posts in this series at the bottom of each post.

*** Before we kick in too far,you might want to grab the latest service pack (which came out a week ago) for the mobile development. You can grab the .NET Compact Framework 2.0 Service Pack 1 from this link here.

 

Creating a New Project – Hello World!

Once you have the tools installed such as the CF, the Smartphone SDK and any emulators (see my previous posts in this series for the links if you need them) the next step is to create your first project. So we start by opening Visual Studio.NET 2005 and creating a new project. You’ll want to choose the language, then choose “Smart Device” and then select “Windows Mobile 5.0 Smartphone” from the project type list. Then select “Device Application” since we’ll be developing a simple interactive “Hello World” application. (If you do not see “Windows Mobile 5.0 Smartphone” in the project type list, you need to install the Smartphone SDK.)

 

 

The IDE

The first thing you’ll probably notice is that the default form’s designer appears (Form1.cs) and it looks like a Smartphone device. While the designer may not look exactly like the Smartphone you might own, its got the basic Smartphone criteria: the left and right menu buttons (soft keys), the D-pad for navigation and the ability to enter alphanumeric characters. Just like standard WinForm development, these buttons have events that you can write code for. The form itself has a title which you will want to customize (I’ll make mine say “Hello World”) and you can throw controls on the form, too.

 

The Toolbox

The Toolbox has some familiar controls such as the combo box, label, and textbox. On a Smartphone the button control is not used that often. Rather, the conventional way to select, save, continue or perform other events normally associated with a button control are handled with the soft key menu buttons or by clicking the middle of the D-pad. (A general rule of thumb is to always allow the click of the D-pad to perform a “selection” or a “done” action appropriate for the current screen.)

 

Menus

The soft keys are generally associated with menus that you can build in the Smartphone, too. The right menu (or soft key) often opens a menu for the current form. The menu often is used to show options for the current form including properties, settings, options, etc. Menu best practices still hold true here … keep your menu’s to 1 or 2 deep at most. On a Smartphone, even 2 deep menus can get messy. Keep your menu labels short, too. Space is very limited. Common terms are:

  • Options
  • Tools
  • Properties
  • Select
  • Refresh
  • Done
  • Cancel
  • Exit

 

Other Tips

Remember, we’re short of space. So keep the design of your forms small. Avoid the need to scroll  if possible, but it is OK to scroll a little. Generally, I try to keep my screens clean with all controls visible but if i cannot, I make sure there are no more than double the height (meaning don’t add more than a few controls off screen). Another option is to use the soft key menu (usually the right one) to continue to the next page … similar to a (gulp) wizard.

Make sure you include an Exit option in your application. Its a big pet peeve of mine when applications do not include an Exit menu option on a Smartphone. Leaving your application running with no friendly way to kill it is just wrong.

 

The Hello World Application

Well, I promised to keep each of these posts short and sweet. So I’ll save the Hello World application for the next post in this series. I hope this one gave you a quick and dirty run through of creating an application and getting familiar with the IDE.

 

Smartphone Skills Series:


Published Jun 25 2006, 08:54 PM by John Papa
Filed under: ,

Comments

John Papa [MVP C#] said:

Introduction to the "Smartphone Skills" series regarding using, customizing and developing for the Windows Mobile 5 Smartphone.  In this introduction I discuss what the Smartphone OS is and is NOT, what tools are needed for developing smartphone
# June 25, 2006 10:34 PM

John Papa [MVP C#] said:

Setting up the .NET 2 development environment for mobile development, using the Device Emulator Manager, installing custom emulators for devices.
# June 25, 2006 10:34 PM

dotnetkicks.com said:

Trackback from dotnetkicks.com
# June 26, 2006 8:01 AM

Jason Haley said:

# June 26, 2006 10:19 AM

Mike said:

Great Post!!  Many thanks
# July 19, 2006 1:21 PM

roger balakrishnan said:

Seems like you cant do smartphone dev w/o visual studio, is this true.

# September 8, 2006 1:01 PM

Jussi said:

Hi, I bumped into Microsoft Smartphone Handbook (www.microsoft.com/mobile/assets/Microsoft_Smartphone_Handbook.pdf) where it says:

"Required: No Exit Menu Item

Application cannot have an Exit menu item. The Smartphone device will ask the application to close when more memory is required for another application."

So basically if you want to get a "Designed for MS Windows for Smartphone" logo for you application you mustn't have Exit option in your menu.

I, too, find this a bit interesting since SP performance seems to get a big hit if mem is low.

# September 23, 2006 9:46 AM

sipho said:

Great article, gathers mobile application development in a nut shell.

# October 19, 2006 2:00 AM

techguy said:

Is this series based on using C# ?  I am looking to learn and follow along with this series, however there are numerous Visual Studio express editions and I am just not sure which will you be using as well what is the most preferred for WM5 smartphone development?

# December 10, 2006 5:56 PM

moody4prez said:

where's the next part to the series?

# October 16, 2007 4:50 PM

Peido Fedido said:

Great article, im new to this and could not find too much help out there. However, where is the last part of the HelloWorld app? This is like a movie w/ no ending!

# January 14, 2008 1:22 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About John Papa

John (C# MVP and MCSD.NET) has been working with Microsoft distributed architectures for over 10 years. He has enterprise experience architecting and developing with .NET technologies including ASP.NET as well as WebForms using both C# and VB.NET. He is a baseball fanatic who spends most of his summer nights rooting for the Yankees with his family and his faithful dog, Kadi. John has authored or co-authored several books on ADO, ADO.NET, XML, and SQL Server, is the author of the Data Points column in MSDN Magazine, has presented MSDN WebCasts and can often be found speaking at industry conferences such as VSLive and DevConnections. Check out Devlicio.us!