Next up, Orlando DevConnections!

Tuesday, April 08 2008 - , , , - 0 comments

DevConnections in Orlando is just around the corner and I'll be there presenting 4 sessions on mobile development, the Entity Framework and SQL Server. So much has changed with these technologies in the past few months so I have all new code samples for new techniques using the latest bits, especially with the Entity Framework. if you are going to be at DevConnections in April in Orlando, please stop by one of my sessions and say hi.

Here are the 4 session abstracts:

VMD302: Data Access Techniques and LINQ in Mobile Applications
John Papa
Data access layers, domain entities, and databases are all integral components of dealing with data in an enterprise application. Mobile applications also rely heavily on these types of data vehicles and stores. This session will delve into different ways of handling data in mobile applications using ADO.NET objects and domain entities. I will demonstrate different data binding techniques in mobile applications using both domain entities and DataSets as well as techniques using LINQ to interact with data on a mobile device.

 

VDA203: Getting Started with the Entity Framework
John Papa
The Entity Framework can be used to architect applications against a conceptual model that is mapped to the logic model. The Entity Framework has many components including EntityClient, Entity SQL, Object Services, the Entity Data Model, and LINQ to Entities. This session will discuss the architecture of the Entity Framework and explain the roles of each of its different components. It will also demonstrate how to write queries using the different options as well as how to evaluate which options within Object Services to use or if to use the EntityClient provider directly.

 

VDA202: Customizing Entity Data Models in the Entity Framework
John Papa
Designing the Entity Data Model with the Entity Framework is a critical aspect in developing an architecture. Once the model has been created it is beneficial to know how to customize the model to adapt to the business problems. This session will explore the different XML files that map the objects to the database schema and show how to modify them when needed. I will explain how you can design an object model with the Entity Framework using both the Entity Data Model Wizard as well as  by manually editing the XML files. I will demonstrate how to implement inheritance, how to merge multiple entities within  a conceptual model, how to take advantage of features such as conditions in the mapping layer, how to implement complex types, and how to hook into stored procedures. This session will demonstrate how to interact with the conceptual model using EntityClient, Entity SQL, and LINQ to Entities to perform queries and make updates to a database.

 

DevConnections

Accessing Data From a Mobile Application

Thursday, December 27 2007 - , , , , - 0 comments

I enjoy writing mobile device applications. Especially when I can combine modern architectural patterns that I use in most enterprise applications to mobile devices, as well. My latest article, titled "Accessing Data From a Mobile Application" is now available online in the January MSDN Magazine issue.

January08Coverlg

Here is a summary of the article:

Data access is an important aspect of developing applications with the Microsoft® .NET Compact Framework for Windows Mobile® devices. By using the existing architecture to send and receive data between your mobile application and your application server, you can pass data with either DataSets, custom objects, or scalar values.

In this installment of DataPoints, I will discuss best practices for data access strategies when developing mobile applications for Smartphones. I will also demonstrate how to design a data-driven Smartphone application that can display and save data over the Internet. I will show you how to communicate with a server application that exposes methods to get data using a DataSet, custom objects, and a generic List<T> of entities.

51st MSDN Magazine article! - Where has the time gone?

Friday, February 01 2008 - , , , - 5 comments

So I am a bit late realizing that my 50th article was published in MSDN Magazine (including its predecessors MIND [Microsoft Internet Developer] and MIND [Microsoft Interactive Developer]) last month. The article was titled Revisiting System.Transactions and was in the November 2006 issue of MSDN Magazine. I did not realize this until today when I saw my 51st article was published (RSS Feeds on a SmartPhone).

My first article with MIND was back in December of 1998 and I wrote every few months for them for a few years. But it was not until 2001 when I started the Data Points column ... which makes this year my 5th year authoring the column. Wow, time sure does fly!

The last book I was involved in was published back in 2000 ... I stopped writing books once the kids started coming along. Wow, talk about working overtime ... when I was writing books I would put in a regular work week at my job plus another 50 hours a week on the book. It was an insane time. I remember when writing my last book my youngest daughter had colic, so she would stay up all night crying. The only way to ease her crying was to hold and sway with her. Since I was up all night writing the book, I would have her in one arm, and i would be typing on the keyboard all while swaying ... all through the night (I dedicated that book to her since she was there the whole time I wrote it). That was when I decided it was time to hang up the books before I missed their childhood.

Anyway ... it's been a long ride for me with writing. Thank you very much for reading my thoughts all these years!

 

RSS Feeds on a Smartphone

Friday, February 01 2008 - , , - 0 comments

The December 2006 issue of MSDN Magazine is now posted online. My latest Data Points column discusses development with the SmartPhone (titled "RSS Feeds on a Smartphone"). Here is a excerpt from the article quoted from the introduction:

 This month I will demonstrate how to build a Windows Mobile® 5.0 application that reads RSS feeds and loads them into an ADO.NET DataSet. I will start out by showing how to request an RSS feed from a URL asynchronously and then demonstrate how to read the RSS feed and load it into a DataSet. Next, I will show you how to navigate the DataSet's hierarchy to find the appropriate data containing each feed's items. Then I will discuss how to use anonymous delegates to sort the data, how to check for the existence of a field in the RSS data using ADO.NET, and how to use the WebBrowser control to navigate to a URL or display HTML. Finally, I will demonstrate how to deploy the application to a mobile device using a CAB project. The full source code for this sample application is available from the MSDN®Magazine Web site.

You can read the article online here.

 

Invisible Shield - 3 Weeks Later

Friday, February 01 2008 - , - 1 comments

About 3 weeks ago I began using the Invisible Shield (IS) for my Motorola Q Smartphone (see my review here). The one issue I had right away was that the piece that protects the screen had a mark on it that I could not get rid of.

So I contacted Shield Zone about this and they sent me a replacement screen protector. I ran into another hitch at this point ... they sent me the wrong screen protector. Let me clarify this point because its a bit odd in my opinion. The screen protector that comes with in the "screen protector" package is not the same as the one they sell in the "front and back" package. The single screen protector only covers the screen. The "front and back" package's screen protector covers the screen and the top front of the Q, as well. Is it a big deal? Not really. But I was unaware of this difference and could not find a reference to it on their site. So I point it out only to help any future buyers out there in case it does matter to you.

Anyway, the service was great at Shield Zone. They sent me the replacement piece (the wrong one). I contacted them again to let them know and they immediately sent another replacement to me. This whole process took about 2 weeks due to mailing times. I wish it was faster, but hey, it was a free replacement so I can live with waiting a week for a replacement.

They did ask me to return the damaged pieces ... which I think is silly. But again, its a small price to pay for the lifetime replacement policy.

I put the replacement screen on today in about 5 minutes (now that I knew how to do it better). It looks great. Very clear.

I have used the IS on my Q now for 3 weeks overall (I left the damaged screen on it while I waited for the new one). I have been very happy with the results. I keep my phone in my pocket and it gets banged quite a bit. I have no new scratches on the phone since I put the IS on it. I've put it in my soccer bag with my keys, in my pocket with loose change and even let me 1 year old daughter play with it (gnaw at it) and it has held up very well. Not only are there no scratches but the screen is still very clear and it is easy to clean finger prints off of it. Other screen protectors I have used were so blurry after just a few days that it drove me nuts.

Use your judgement when looking at this product as it is a bit more expensive than its competition. But in my opinion the product is excellent, the service is great and the lifetime warranty makes it all worth it if you want to protect your investent in your phone.

Smartphone Skills: Part 03 - Development Environment

Friday, February 01 2008 - , - 7 comments

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:

Smartphone Skills: Part 02 - Setup and Device Emulators

Friday, February 01 2008 - , - 6 comments

In my last post (Smartphone Skills: Part 01 - Introduction) I ran through a few of the links that you can use to get started with Smartphone development. In this post I will discuss how to setup the .NET 2 development environment and use the Device Emulator Manager.

Assuming you already have Visual Studio.NET 2005 installed including the compact framework, the next steps are to download and install the rest of the tools you will need.

ActiveSync 4.1 (or latest version)

Download and install ActiveSync 4.1 if you have not already done so. ActiveSync is required by the Windows Mobile 5 SDK (next step). ActiveSync is used to synchronize the data and generally help you communicate with the mobile device. It also facilitates the installation of software from a PC to the device.

Windows Mobile 5.0 SDK for Smartphone 

Download the Windows Mobile 5.0 SDK for Smartphone and install it. This will give you all that you need to develop for the Smartphone. Make sure you download and install the Smartphone edition as there is also an edition for the Pocket PC available. Again, these are 2 different flavors of the Windows Mobile 5 OS. You can install both SDK’s if you intend to develop for both types of devices.

Once the SDK is installed, you will be able to create projects for the mobile devices. The SDK installs project templates that you can use to do this. The SDK also install the Device Emulator Manager, which gets added to your Tools menu in the Visual Studio.NET IDE. The Device Emulator Manager allows you to choose the destination device type that you want to test your application in. When you install the Smartphone SDK, several emulators are installed and show up in the available emulator list in the Device Emulator Manager including a versions for Smartphone 200 and Windows Mobile 5. When testing your application, you can select which emulator to run the app in. This is a great feature since it allows you to test the applications without installing software on a target device (and uninstalling, installing, repeat process … yuk). It also allows you to develop and test software for multiple target devices.

 

Custom Device Emulators

OK, so you bought a specific device and you want to make sure your application works in that specific device. Some manufacturers provide developers access to tools that help them develop software for their devices. Motorola provides a web site that has several tools and other information to assist developers. Since I recently bought a Motorola Q Smartphone, I went to their MotoDev web site and found the Motorola Q tools. On this page I downloaded the emulator for the 320x240 landscape screen (because the Q has a screen that is different from most Smartphones and PDA’s in that its screen is not square not portrait … it is landscape). This is actually a link to the Microsoft download site.

I then installed the emulator for the landscape screen. I could have stopped there as it would have given me what I needed to test the landscape UI, but I went one step further and downloaded and installed the Q plug-in for the landscape emulator. This plug-in adds an additional emulator to the Device Emulator Manager that looks just like the Motorola Q (similar to a skin). Of course, these custom emulators are not critical, you can sue the default ones that come with the Windows Mobile 5 SDK. Its just an extra step to make your emulator look and feel more like the target device. Its always a good idea to try your application’s code out in as many emulators as you are targeting devices.

Once you have have ActiveSync, the SDK and the emulators installed … you can start developing.

 

Smartphone Skills Series:

Smartphone Skills: Part 01 - Introduction

Friday, February 01 2008 - , - 2 comments

I decided to start a series of blog posts regarding various aspects of using, customizing and developing for the Windows Mobile 5 Smartphone. This will be the first post … in which I will begin by describing what to expect and where to get some of the basics. I’ll try to keep this series short and to the point so they are very digestible. (On that same note, there may end up being a lot of posts in this series depending on how many topics I end up covering.)

Let me start by getting this out right away … I will not be discussing any other mobile OS. I will only be focusing on the Windows Mobile 5 for Smartphones (with a light sprinkling of Pocket PC). yeah, the name “Smartphone Skills” is a bit odd … but I thought it was catchy.

 

What is it the Smartphone OS?

Its a bit of a niche … its not just Windows Mobile 5 development, but its development for the Smartphone version of the OS. The Smartphone version of the OS is a bit scaled down than that of the Pocket PC version of the OS. The Windows Mobile 5 for the Smartphone is targeted for (obviously) Smartphones … which generally are phone 1st, PDA 2nd. (There is also a Pocket PC edition and a Pocket PC Phone edition, the latter of which is generally agreed upon as PDA 1st and phone 2nd.) I won’t go into all of the differences nor do I know them all by heart. However, some of the big differences are that the Smartphone OS does not handle stylus/pen events as the screen for Smartphones are not interactive. The user uses special keys on the phone to interact with the applications. Smartphone OS usually does not support some software, as well … usually because the applications require too much stylus interaction with the touch screen. So Office products like Pocket Word and Pocket Excel do not come with the Windows Mobile 5 OS on the Smartphone. (However, Outlook does.) Anyway, a description as per Microsoft can be found on the site located here.

 

So What Do You Need?

There are plenty of tools that are helpful, but here is the core list of tools you need to get started in developing for the Smartphone.

  1. 1) Visual Studio.NET (I’ll be using 2005)
  2. 2) .NET Compact Framework (I’ll be using v 2.0 but you could use version 1.1)
  3. 3) Windows Mobile 5.0 SDK for Smartphone (there is another SDK for Pocket PC)
  4. 4) You do NOT need an actual Smartphone to do any development. You could instead use the device emulator that comes with Visual Studio.NET.
  5. 5) ActiveSync 4.1 … even if you are not going to use an actual Smartphone and you will instead rely on the emulator, you will still want to install the latest version of ActiveSync (currently 4.1). In fact, I believe the SDK will not even install unless ActiveSync is installed first.

Once you have these installed you can get started and write you first mobile application.

 

Other Useful Links (maybe):

Here are some links that can help you get started:

 

Next time in Smartphone Skills I will talk a little more about getting setup.

 

Smartphone Skills Series: