Welcome!

.NET Authors: Lori MacVittie, Yeshim Deniz, Ivan Antsipau, Liz McMillan, Michael Bushong

Related Topics: .NET

.NET: Article

Windows Mobile Version 5.0 Revealed

Improved productivity, integrated multimedia, and diverse customization experiences

There has never been an operating system release more important to .NET developers than the release of Windows Mobile Version 5.0. With this release, Microsoft is poised to take your productivity in writing mobile applications higher than it has ever gone before. Rich multimedia capabilities, integrated messaging, and world-class telephony support are just a few of the benefits you will realize when you develop applications for the Windows Mobile 5.0 platform.

From the perspective of the .NET software developer, perhaps the most important piece of Windows Mobile 5.0 is its brand new Managed API. All of the code for this new API is found in the Microsoft.WindowsMobile namespace. You can access this API from Visual Studio by adding references to the following assemblies:

  • Microsoft.WindowsMobile.Configuration
  • Microsoft.WindowsMobile.Forms
  • Microsoft.WindowsMobile.PocketOutlook
  • Microsoft.WindowsMobile.Status
  • Microsoft.WindowsMobile.Telephony
The Windows Mobile 5.0 Managed API is compatible with .NET Compact Framework 1.0, as well as with .NET Compact Framework 2.0, although you must use Visual Studio 2005 to target Windows Mobile 5.0 and to use the new managed APIs.

Telephony

Of the four Windows Mobile-based devices I [Derek] have owned over the past few years, three of them have been telephony-enabled devices. The first two of these were Pocket PC Phone Edition devices, so named because they were essentially Pocket PCs that just happened to support making and receiving telephone calls.

My most recent acquisition is a Windows Mobile 2003 Second Edition-based Smartphone. The Smartphone is an amazingly capable device that allows me to send and receive MSN Messenger messages, take pictures, and run software written using the .NET Compact Framework, in addition to the traditional telephony functions of placing and receiving telephone calls.

Before Windows Mobile 5.0, however, Windows Mobile Software for Pocket PC Phone Edition or Smartphone did not support direct access to telephony functionality via a managed API. So prior to Windows Mobile 5.0, if one wanted to create a .NET Compact Framework application that, for example, dialed a given telephone number, one would typically have had to access a native API for this purpose via .NET's p/Invoke functionality.

Windows Mobile 5.0 addresses this by providing a namespace called Microsoft.WindowsMobile.Telephony as a part of its base functionality. At the time of writing, this namespace consists of a single class called Phone, which exposes a single method, called Talk. Talk takes a String parameter representing the telephone number to be dialed, plus an optional Boolean parameter specifying whether or not the user should be prompted prior to dialing.

For example, the following line of C# code will dial the number for operator assistance in most major U.S. cities. Prior to dialing, however, a confirmation dialog will be displayed to the user.


new Phone().Talk("555-1212", true);

Outlook Mobile

The ability to store information about contacts and to communicate with them is central to the functionality of both major device types (Smartphones and Personal Digital Assistants - PDAs) currently targeted by the .NET Compact Framework. On the Windows desktop, Microsoft Outlook is the application of choice for storing contact information and for communicating via e-mail. Under Windows Mobile, this functionality is performed by Outlook Mobile, with added functionality for communication via the Short Message Service (SMS), a kind of instant messaging tailor-made for use with mobile devices.

Prior to Windows Mobile 5.0, there was no managed interface for Outlook Mobile. To be sure, alternative approaches for accessing contacts under Windows Mobile have been developed. Developers could native code, p/Invoke, or - under Visual Studio 2005 - use COM Interop to tap into the rich messaging and contact management functionality provided by Outlook Mobile. Third-party vendors (see Resources at the end of this article) have also developed and sold Outlook Mobile access libraries for the .NET Compact Framework.

With the release of Windows Mobile 5.0, developers for the first time have a managed API baked directly into the operating system to facilitate all Personal Information Management (PIM) functionality available in the Windows Mobile operating system.

The Pocket Outlook Object Model

The core managed APIs for interacting with Outlook Mobile on Windows Mobile 5.0 are all contained in the Microsoft.WindowsMobile.PocketOutlook namespace (the name is a throwback to the old name for Outlook Mobile, Pocket Outlook). In general, there is one unique class for dealing with each kind of entity in Outlook Mobile.

To briefly summarize the kinds of classes in as few words as possible, consider the path that a message will typically take from Outlook Mobile to a recipient aw well as its path in the opposite direction. The trip begins (or ends) with either an e-mail or an SMS account, because these are the two protocols supported by Outlook Mobile. For this reason, there are EmailAccount and SmsAccount classes in the PocketOutlook namespace.

To create an actual message, there are EmailMessage and SmsMessage classes, as well as classes for working with such messages' associated entities. For example, there are classes for things such as recipients and attachments. A brief example of sending an e-mail using some of these classes is shown in Listing 1.

Listing 1 begins by creating an Outlook Session. This is a central class in working with Outlook Mobile's managed API, and you will generally always instantiate this class whenever you work with Outlook Mobile.

We then instantiate an instance of EmailMessage to represent the message we wish to send, and an instance of Recipient to represent the person to whom we wish to send our message. We set the text of the message's body, associate the recipient with the message, then use the account named "PersonalAccount" (which we got from the Outlook Session) to send our e-mail.

Besides messages, Outlook Mobile also facilitates the tracking of appointments and tasks. There are classes for both of these things, as well as a host of supporting classes for details such as their recurrence schedules.

Finally, many of the classes described above also have collection classes for dealing with their instances as a group. TaskCollection, ContactCollection, and Appointment-Collection would be good examples of such classes.

Intercepting Messages

A recent client was very concerned about their potential loss of intellectual property if one of their organization's devices were ever lost or stolen. They wanted to be able to completely wipe (perform a "cold reset" upon) a device that had gone beyond their physical control simply by sending it an SMS message with a special secret code in its body.

The class that allows a developer to build this kind of functionality in Windows Mobile 5.0 is known as MessageInterceptor and lives in the Microsoft.WindowsMobile.PocketOutlook.MessageInterception namespace. This namespace is all about writing code that waits to receive a message, and then performing some kind of work.

The workflow to achieve this is fairly simple. First, one must instantiate a MessageInterceptor object. There are two main points of interest on this object. First, its MessageCondition property allows a developer to specify the kind of message to which such an object should respond. The interceptor can be set to respond to a message with a Body, Sender, or Subject that matches - or explicitly doesn't match - a given value.

The other interesting feature of this class is its EnableApplication-Launcher method. By calling this method, you can register your application to be launched when a specified message is received. This allows you to intercept messages without having to keep your applications running in the background.

Managed Configuration Manager

Carriers and corporate support groups will want to interact with the Configuration Manager in order to set up a device with different characteristics. The potential areas of configuration include user settings and device settings like connectivity parameters, security, and the ability to uninstall an application. These settings are contained in XML files that need to be passed into the Configuration Manager. The explanation of this topic would require more than an article, so we'll just point out that the ConfigurationManager class (in the Microsoft.WindowsMobile.ConfigurationManager namespace) is your managed entry point to this functionality.

Using Windows Mobile 5.0 UI in My Applications

As we've mentioned earlier, Window Mobile 5.0 has the first managed API for dealing with Outlook Mobile. This API is extended into the UI tier of Windows Mobile 5.0, and joined by some new dialogs for enhanced multimedia functionality. These APIs are found in System.WindowsMobile.Forms, and include three new dialogs: ChooseContactDialog, SelectPictureDialog, and Camera-CaptureDialog.

To set the stage for this discussion, let's assume that you manage a group of volunteer authors while on the road traveling between your client's city and your home, and it's time to start planning the next issue of your magazine. (This should sound familiar to Derek!) You open up your application on your Windows Mobile 5.0-based device, go to the Start New Issue screen, and start entering data.

One of the enhancements that consumers will notice immediately with Window Mobile 5.0 is that of Outlook Mobile. With the managed interface to this functionality, developers will obviously build PIM and business applications that extend the notion of Contacts. Also, since this application stores the authors as Contacts, we'll use the ChooseContactDialog class to select the authors for this issue. The ChooseContactDialog class does several different things with Contacts, so we'll set up the properties to only select the Contact and then call ShowDialog to get the window started. (See Listing 2 and Figure 1.)

Later, the magazine editor might want to send the author's picture to the printing company. As you'll find out, Windows Mobile 5.0 has an application for selecting and viewing images - and we can use that too. The SelectPictureDialog class provides intuitive functionality like setting the directory to look in, controlling the folder navigation, the title to have on the selection screen, and the chosen image. (See Listing 3.)

Finally, let's say that the magazine editor is at a conference and recruits a new author. The editor knows that at some point that we'll need a headshot. Instead of having to ask later, the editor decides to take advantage of our application and use the integrated camera. By building a screen that calls the CameraCaptureDialog class the application will interact with the device's built-in camera and provides an image file of the author. This is a huge improvement over having to P/Invoke into the OEM's camera API DLL, if they provided one.

Filling in the Gaps of .NET Compact Framework 1.0

Derek and Jon have both written and talked about the missing areas in the .NET Compact Framework. These gaps became the subject of many whitepapers on the MSDN Mobility site. The Microsoft.WindowsMobile.Status solves the majority of these by providing several classes that manage access to system properties. Thus, a developer can now easily retrieve the current ActiveSync status, the display orientation, power state and battery strength, phone information, calendar and task information, messaging and connectivity information, and more. The vastness of the list is impressive. Throw in a few enumerations, and it's as easy as:


If SystemState.ActiveSyncStatus =
ActiveSyncStatus.Synchronizing Then
'Wait for new files
End If

Another way to interact with these properties is to have the SystemState class deliver a notification about a monitored property. For example:


Dim oStatus As New SystemState(System Property.PhoneGprsCoverage)
AddHandler(oStatus.Changed, addressof me.GprsCoverageChange)

The SystemState class also exposes an EnableApplicationLauncher method similar to that exposed by the MessageInterceptor class described above. The difference is, however, that the events that can trigger an application's launch using this method are much more diverse than simply the receipt of a given e-mail or SMS message. This is functionality that many desktop Windows developers would envy!

There are more topics for discussion in the Status namespace. However with these three options, I believe that the SystemState class will be of great interest to those of us who have already been working with the .NET Compact Framework.

Conclusion

As you have seen, Windows Mobile 5.0 will deliver a development experience that is superior to anything available on competing mobility platforms. The availability of managed APIs and a development tool as powerful as Visual Studio 2005 represents the highest level of developer productivity currently available. The integration of multimedia facilities, such as the CameraCaptureDialog described above, will facilitate the creation of rich multimedia applications. And finally, the wide range of application and customization experiences that Windows Mobile 5.0 will make available will allow Microsoft partners and customers to differentiate their offerings in ways previously unimagined. Stay tuned to the MSDN Mobile and Embedded Developer Center for information on the tools to build Windows Mobile 2005 applications.

Resources

Outlook Mobile-related Links
For those of you who need to support Outlook Mobile integration using .NET Compact Framework 2.0, but prior to Windows Mobile 5.0, check out Steven Pratschner's blog for a sample using COM Interop to achieve this.
  • Steven Pratschner's Blog: http://blogs.msdn.com/stevenpr

    For the many of you who will need to support Outlook Mobile integration prior to .NET Compact Framework 2.0, check out this product.

  • PocketOutlook In the Hand: www.inthehand.com/index.php?page=6&show=1,2
  • More Stories By Derek Ferguson

    Derek Ferguson, founding editor and editor-in-chief of .Net Developer's Journal, is a noted technology expert and former Microsoft MVP.

    More Stories By Jon Box

    Jon Box is an Architect Evangelist in Developer & Platform Evangelism with the Microsoft Corporation. He coauthored Building Solutions with the Microsoft .NET Compact Framework, published by Addison-Wesley, and blogs at http://blogs.msdn.com/jonbox/default.aspx.

    Comments (0)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


    @ThingsExpo Stories
    All major researchers estimate there will be tens of billions devices – computers, smartphones, tablets, and sensors – connected to the Internet by 2020. This number will continue to grow at a rapid pace for the next several decades. With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo in Silicon Valley. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be!
    Noted IoT expert and researcher Joseph di Paolantonio (pictured below) has joined the @ThingsExpo faculty. Joseph, who describes himself as an “Independent Thinker” from DataArchon, will speak on the topic of “Smart Grids & Managing Big Utilities.” Over his career, Joseph di Paolantonio has worked in the energy, renewables, aerospace, telecommunications, and information technology industries. His expertise is in data analysis, system engineering, Bayesian statistics, data warehouses, business intelligence, data mining, predictive methods, and very large databases (VLDB). Prior to DataArchon, he served as a VP and Principal Analyst with Constellation Group. He is a member of the Boulder (Colo.) Brain Trust, an organization with a mission “to benefit the Business Intelligence and data management industry by providing pro bono exchange of information between vendors and independent analysts on new trends and technologies and to provide vendors with constructive feedback on their of...
    Software AG helps organizations transform into Digital Enterprises, so they can differentiate from competitors and better engage customers, partners and employees. Using the Software AG Suite, companies can close the gap between business and IT to create digital systems of differentiation that drive front-line agility. We offer four on-ramps to the Digital Enterprise: alignment through collaborative process analysis; transformation through portfolio management; agility through process automation and integration; and visibility through intelligent business operations and big data.
    There will be 50 billion Internet connected devices by 2020. Today, every manufacturer has a propriety protocol and an app. How do we securely integrate these "things" into our lives and businesses in a way that we can easily control and manage? Even better, how do we integrate these "things" so that they control and manage each other so our lives become more convenient or our businesses become more profitable and/or safe? We have heard that the best interface is no interface. In his session at Internet of @ThingsExpo, Chris Matthieu, Co-Founder & CTO at Octoblu, Inc., will discuss how these devices generate enough data to learn our behaviors and simplify/improve our lives. What if we could connect everything to everything? I'm not only talking about connecting things to things but also systems, cloud services, and people. Add in a little machine learning and artificial intelligence and now we have something interesting...
    Last week, while in San Francisco, I used the Uber app and service four times. All four experiences were great, although one of the drivers stopped for 30 seconds and then left as I was walking up to the car. He must have realized I was a blogger. None the less, the next car was just a minute away and I suffered no pain. In this article, my colleague, Ved Sen, Global Head, Advisory Services Social, Mobile and Sensors at Cognizant shares his experiences and insights.
    We are reaching the end of the beginning with WebRTC and real systems using this technology have begun to appear. One challenge that faces every WebRTC deployment (in some form or another) is identity management. For example, if you have an existing service – possibly built on a variety of different PaaS/SaaS offerings – and you want to add real-time communications you are faced with a challenge relating to user management, authentication, authorization, and validation. Service providers will want to use their existing identities, but these will have credentials already that are (hopefully) irreversibly encoded. In his session at Internet of @ThingsExpo, Peter Dunkley, Technical Director at Acision, will look at how this identity problem can be solved and discuss ways to use existing web identities for real-time communication.
    Can call centers hang up the phones for good? Intuitive Solutions did. WebRTC enabled this contact center provider to eliminate antiquated telephony and desktop phone infrastructure with a pure web-based solution, allowing them to expand beyond brick-and-mortar confines to a home-based agent model. It also ensured scalability and better service for customers, including MUY! Companies, one of the country's largest franchise restaurant companies with 232 Pizza Hut locations. This is one example of WebRTC adoption today, but the potential is limitless when powered by IoT. Attendees will learn real-world benefits of WebRTC and explore future possibilities, as WebRTC and IoT intersect to improve customer service.
    From telemedicine to smart cars, digital homes and industrial monitoring, the explosive growth of IoT has created exciting new business opportunities for real time calls and messaging. In his session at Internet of @ThingsExpo, Ivelin Ivanov, CEO and Co-Founder of Telestax, will share some of the new revenue sources that IoT created for Restcomm – the open source telephony platform from Telestax. Ivelin Ivanov is a technology entrepreneur who founded Mobicents, an Open Source VoIP Platform, to help create, deploy, and manage applications integrating voice, video and data. He is the co-founder of TeleStax, an Open Source Cloud Communications company that helps the shift from legacy IN/SS7 telco networks to IP-based cloud comms. An early investor in multiple start-ups, he still finds time to code for his companies and contribute to open source projects.
    The Internet of Things (IoT) promises to create new business models as significant as those that were inspired by the Internet and the smartphone 20 and 10 years ago. What business, social and practical implications will this phenomenon bring? That's the subject of "Monetizing the Internet of Things: Perspectives from the Front Lines," an e-book released today and available free of charge from Aria Systems, the leading innovator in recurring revenue management.
    The Internet of Things will put IT to its ultimate test by creating infinite new opportunities to digitize products and services, generate and analyze new data to improve customer satisfaction, and discover new ways to gain a competitive advantage across nearly every industry. In order to help corporate business units to capitalize on the rapidly evolving IoT opportunities, IT must stand up to a new set of challenges.
    There’s Big Data, then there’s really Big Data from the Internet of Things. IoT is evolving to include many data possibilities like new types of event, log and network data. The volumes are enormous, generating tens of billions of logs per day, which raise data challenges. Early IoT deployments are relying heavily on both the cloud and managed service providers to navigate these challenges. In her session at 6th Big Data Expo®, Hannah Smalltree, Director at Treasure Data, to discuss how IoT, Big Data and deployments are processing massive data volumes from wearables, utilities and other machines.
    P2P RTC will impact the landscape of communications, shifting from traditional telephony style communications models to OTT (Over-The-Top) cloud assisted & PaaS (Platform as a Service) communication services. The P2P shift will impact many areas of our lives, from mobile communication, human interactive web services, RTC and telephony infrastructure, user federation, security and privacy implications, business costs, and scalability. In his session at Internet of @ThingsExpo, Erik Lagerway, Co-founder of Hookflash, will walk through the shifting landscape of traditional telephone and voice services to the modern P2P RTC era of OTT cloud assisted services.
    While great strides have been made relative to the video aspects of remote collaboration, audio technology has basically stagnated. Typically all audio is mixed to a single monaural stream and emanates from a single point, such as a speakerphone or a speaker associated with a video monitor. This leads to confusion and lack of understanding among participants especially regarding who is actually speaking. Spatial teleconferencing introduces the concept of acoustic spatial separation between conference participants in three dimensional space. This has been shown to significantly improve comprehension and conference efficiency.
    The Internet of Things is tied together with a thin strand that is known as time. Coincidentally, at the core of nearly all data analytics is a timestamp. When working with time series data there are a few core principles that everyone should consider, especially across datasets where time is the common boundary. In his session at Internet of @ThingsExpo, Jim Scott, Director of Enterprise Strategy & Architecture at MapR Technologies, will discuss single-value, geo-spatial, and log time series data. By focusing on enterprise applications and the data center, he will use OpenTSDB as an example to explain some of these concepts including when to use different storage models.
    SYS-CON Events announced today that Gridstore™, the leader in software-defined storage (SDS) purpose-built for Windows Servers and Hyper-V, will exhibit at SYS-CON's 15th International Cloud Expo®, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Gridstore™ is the leader in software-defined storage purpose built for virtualization that is designed to accelerate applications in virtualized environments. Using its patented Server-Side Virtual Controller™ Technology (SVCT) to eliminate the I/O blender effect and accelerate applications Gridstore delivers vmOptimized™ Storage that self-optimizes to each application or VM across both virtual and physical environments. Leveraging a grid architecture, Gridstore delivers the first end-to-end storage QoS to ensure the most important App or VM performance is never compromised. The storage grid, that uses Gridstore’s performance optimized nodes or capacity optimized nodes, starts with as few a...
    The Transparent Cloud-computing Consortium (abbreviation: T-Cloud Consortium) will conduct research activities into changes in the computing model as a result of collaboration between "device" and "cloud" and the creation of new value and markets through organic data processing High speed and high quality networks, and dramatic improvements in computer processing capabilities, have greatly changed the nature of applications and made the storing and processing of data on the network commonplace. These technological reforms have not only changed computers and smartphones, but are also changing the data processing model for all information devices. In particular, in the area known as M2M (Machine-To-Machine), there are great expectations that information with a new type of value can be produced using a variety of devices and sensors saving/sharing data via the network and through large-scale cloud-type data processing. This consortium believes that attaching a huge number of devic...
    Innodisk is a service-driven provider of industrial embedded flash and DRAM storage products and technologies, with a focus on the enterprise, industrial, aerospace, and defense industries. Innodisk is dedicated to serving their customers and business partners. Quality is vitally important when it comes to industrial embedded flash and DRAM storage products. That’s why Innodisk manufactures all of their products in their own purpose-built memory production facility. In fact, they designed and built their production center to maximize manufacturing efficiency and guarantee the highest quality of our products.
    All major researchers estimate there will be tens of billions devices - computers, smartphones, tablets, and sensors - connected to the Internet by 2020. This number will continue to grow at a rapid pace for the next several decades. Over the summer Gartner released its much anticipated annual Hype Cycle report and the big news is that Internet of Things has now replaced Big Data as the most hyped technology. Indeed, we're hearing more and more about this fascinating new technological paradigm. Every other IT news item seems to be about IoT and its implications on the future of digital business.
    Can call centers hang up the phones for good? Intuitive Solutions did. WebRTC enabled this contact center provider to eliminate antiquated telephony and desktop phone infrastructure with a pure web-based solution, allowing them to expand beyond brick-and-mortar confines to a home-based agent model. Download Slide Deck: ▸ Here
    BSQUARE is a global leader of embedded software solutions. We enable smart connected systems at the device level and beyond that millions use every day and provide actionable data solutions for the growing Internet of Things (IoT) market. We empower our world-class customers with our products, services and solutions to achieve innovation and success. For more information, visit www.bsquare.com.