Despite the advances in mobile computing, the primary functions of a mobile device are — besides other activities — communication and calendaring. These essential needs are on the Windows Mobile platform provided by the Pocket Outlook family of applications, such as Messaging and Calendar. We will show you how to consume, extend and visualize the PIM data stored in Pocket Outlook database in this sample application.
Because of backward and forward compatibility, all accesses to the PIM data must be through a well defined interface, called Pocket Outlook Object Model or POOM. The interface is provided as both native COM objects and managed .NET Compact Framework classes. The latter is found in the Microsoft.WindowsMobile.PocketOutlook
assembly.
The sample application provides the following methods:
- Read contacts and appointments from the POOM storage.
- Cross reference appointments with contacts.
- Display the information using Resco.AdvancedList.
- Use the contact information to place a phone call or start an email.
Prerequisites
You will need:
- Microsoft Windows Mobile 5.0 SDK (or later) which you can download here.
- Resco MobileForms Toolkit 2010 which you can download here.
- A Windows Mobile device or emulator.
- Microsoft VisualStudio 2008 to compile and debug the application.
Resco MobileForms Toolkit is a set of Visual Studio controls designed for mobile devices. After installing Resco MobileForms Toolkit Volume 2010 on your computer, the controls will be automatically added to the Visual Studio’s toolbox. We will use following Resco controls and libraries in the project:
- Resco AdvancedList library for .NET CF
- Resco TabControl for .NET CF
- Resco Scrollbar for .NET CF
The application is designed with .NET Compact Framework 3.5. Just download the appropriate version of Resco MobileForms Toolkit 2010.
Data Model
The ‘Data’ namespace contains classes related to the application data model, such as the repository and entity classes.
The Contact
class is a wrapper for the POOM contact object. It loads a few interesting properties and provides some custom methods.
The ContactDetail
class encapsulates contact information, such as phone number or email address. It also provides a way to act on the information, to place a call, or start an email.
The Appointment
class is similarly a wrapper for the POOM appointment object. It provides additional properties used for presentation.
The purpose of the PimRepository
class is to centralize the loading and management of PIM data: contacts and appointments.
User Interface
The application’s user interface is a simple list – detail pattern.
It uses a several powerful features of the AdvancedList control.
- Instead of creating a list row object we use data binding.
- Only the visible contacts are progressively loaded into the control.
Data binding is a powerful technique used throughout the .NET Framework. The AdvancedList control takes it further by providing unlimited templates and binding for IEnumerable<T>
types.
Templates represent the core of the AdvancedList functionality; they determine how each bound object is displayed. In the simplest case you will have one template for the “default” state and one “selected” template. The template itself consists of multiple cells. The purpose of each cell is to visualize a property of the object.
To bind a cell to the underlying data object property, simply set its CellSource.
There are special cells for text, images, links etc. You can even create your own. Each cell can be positioned within its row and designed by changing its font, fore and background color, alignment etc.
Both a Visual Studio integrated designer and a standalone application are provided for creating templates.
The list part is implemented by the ContactListForm
. Contact objects are loaded from the PimRepository and then bound into an embedded AdvancedList control. Filtering is provided by a simple TextBox control.
The detail part is provided by the ContactDetailForm
. The form is divided into two parts, the contact details and appointments. Both parts are backed by an AdvancedList control and toggling between them is provided by TabControl.
The contact information is loaded into several ContactDetail
objects, which are then bound into an AdvancedList control. Each detail is able to execute its information (place call), upon click.
The appointments tab contains appointments for which the loaded contact is listed as an attendee. They are loaded from the PimRepository.
Conclusion
As you can see, the data presentation and manipulation can be greatly simplified by using powerful controls such as the AdvancedList and TabControl. Of course there is a lot of functionality that these controls provide which was not mentioned in this article. Have you noticed that the contact list can be touch-scrolled? Enough of boring text, the best way to find out how easy is to create a powerful mobile application with the Resco MobileForms Toolkit is trying it yourself.
Download the source code of the application and find out.
Download the application (CAB file).
About Resco MobileForms Toolkit
Resco MobileForms Toolkit is one of the richest and most comprehensive sets of Microsoft Visual Studio controls and libraries designed for developers of software solutions for mobile devices. In its portfolio there are controls and libraries that tackle most problems developers encounter in the mobile environment. Flexible keyboard, professional list control, powerful grid control, charting control, and scheduling control - to mention only the most frequently used ones.
For more information about Resco MobileForms Toolkit, visit http://www.resco.net/developer/mobileformstoolkit/default.aspx