Windows Mobile 6 Managed Classes

Windows Mobile 6 is the new platform designed by Microsoft that targets smartphones and Pocket PCs. WM6 is a truly rich platform, which gives the developer all he needs to build powerful and innovative applications for mobile devices. It features quick and managed programming through the .NET Compact Framework 3.5 and a rich API for native C++ Win32 applications. We’ll cover the managed classes added to .NETCF by downloading the Windows Mobile 6 Professional and Standard Software Development Kits Refresh from Microsoft. These managed classes offer the following features you can use in your managed application that you can create with Visual Studio 2005 or 2008:

  • Microsoft.WindowsMobile.Configuration namespace. It contains the ConfigurationManager class. It’s a very useful class you can use to get information for the device’s configuration settings but you can also use it to change or test these settings! All this is done very comfortably through XML files with predefined structures. E.g. You can set a new browser favourite, ringtone, scheme. You can configure bluetooth, the clock, synchronization, networks, Wi-Fi, locale, registry, Tapi (telephone API). You can also uninstall an application.
  • Microsoft.WindowsMobile.Forms namespace. It contains the CameraCapture. Launches the Camera Capture dialog box, which allows the user to capture still images and video clips. You can control the desired mode (picture or video), resolution, destination file, quality, video time limit, video type (like standard or for MMS). When the user finishes capturing, your program is then able to access the created picture/video file.
    If you need an Outlook contact, you can call the familiar ChooseContactDialog so that the user may select one. You can configure the attributes and the behaviour of the dialog box. You can also filter the contacts shown.
    If you need a picture file, you can call the familiar SelectPictureDialog so that the user may select one. Again you can configure the dialog box. E.g. filter picture types, the directory, whether the user may capture a camera picture.
  • Microsoft.WindowsMobile.Telephony. It contains the Phone class with which you can make a standard telephone call.
  • Microsoft.WindowsMobile.PocketOutlook. This is the most interesting namespace! It provides classes that allow you to create and access PIM data items (Appointments, Tasks, and Contacts), and MAPI messaging items (e-mail and SMS messages), on Pocket PCs and Smartphones. As the root object, OutlookSession serves as the entry point into the Pocket Outlook object model.
    Through this object, you can get the Appointments collection, Contacts collection, Tasks collection, EmailAccounts collection and SmsAccounts collection. As you can see you can very easily edit Appointments, contacts, tasks, along with all their properties, and you can also track the event when one such item changes. With such a powerful capability, you can even create your own Contact chooser dialog.
    As for messaging, there are the EmailAccount and SmsAccount: Each account provides access to the Folders (received, sent etc.) and Messages each folder contains. One message store (which serves as a local archive for storing messages) is present for each account, and each account is associated with one message transport. For example, an email account can have ActiveSync or POP3 as a message transport.
    You can conveniently call the MessagingApplication class to call the “compose form” for a specified account (email or sms) for the user to compose a message with preconfigured options. Furthermore, you can use the MessageInterceptor class to handle the arrival event of a sms or email Message that satisfies the interception rule condition. You can use the EnableApplicationLauncher method to specify an application to be launched upon interception.
  • Microsoft. WindowsMobile.Status. This namespace provides access to system properties. You can get and set their values, filter them, monitor them, and define programmatic actions to take (such as launching an application when a Changed evenet occurs) according to your criteria. First there is the RegistryState class with which you can monitor the state of a registry key. Secondly there is the SystemState class with which you can monitor a specific system state. There are numerous SystemState derived classes, each for an individual state:
    Active application, ActiveSync’s status, calendar/appointments info, tasks info, contacts info, camera present, car kit present, cradle present, headset present, keyboard present, speakerphone state, bluetooth connections count & description, cellular connections, modem connections, network connections, virtual private network connections, display orientation, media player content (playing song, album etc.), messaging accounts’ information (mms, email, activesync, sms), owner’s information, phone’s state (calling, on hold, conference call, missed calls, incoming call’s info, Gprs coverage, Sim’s state, roaming, signal strength, battery state & strength), current date & time etc.

I’d say that my most favourite namespaces are the Outlook and the Status ones. Imagine you can control your application to track system states such as the song playing in Windows Media player at the moment (useful to display messages in a custom Today application eh?). Imagine you can create your own form to edit Contacts in your way: a farfetched example would be to use the WM6’s GPS to get the coordinates of one of your contacts and add it to the contact’s notes. Then you can use the Google Maps web services to see their exact location! Waiting for your ideas…


Leave a comment