Welcome!

Mobile IoT Authors: Shelly Palmer, Elizabeth White, Yeshim Deniz, Liz McMillan, Ed Featherston

Related Topics: Mobile IoT

Mobile IoT: Article

Getting Started with the .NET Compact Framework

Getting Started with the .NET Compact Framework

The .NET Compact Framework is a managed execution environment (a runtime engine) that runs on devices that use the Windows CE operating system - Pocket PC and Windows CE .NET devices. The runtime components also include a large collection of base class libraries that you use in your .NET applications to do everything from displaying UI on the screen to working with files to accessing network resources such as XML Web services. It's a slimmed-down version of the full .NET Framework that you might use to develop applications for servers and desktop PCs.

It does a similar job to Java 2, Micro Edition (J2ME), but the .NET Compact Framework is firmly targeted at higher-end PDAs and PDA- phone hybrids. It's too big to go on the kind of small phones that J2ME CLDC MIDP works on. It's definitely in the same space as J2ME in its CDC (Personal Java) configurations, though.

What Does It Run On?
The .NET Compact Framework currently runs on Windows CE devices only. You can use it with Pocket PC 2000 and Pocket PC 2002 devices, or custom handheld devices using the Windows CE .NET operating system. A version from Microsoft for their Smartphone is expected, although no announcements have been made.

However, it's not necessarily for Microsoft devices only. The specification of the CLR (Common Language Runtime - the runtime engine) is a published standard, so anyone can build one. Recent speculation has suggested that Palm will be supporting it in Palm OS 6.

How Do I Build Applications?
You write applications using Visual Basic .NET or C# using Microsoft Visual Studio .NET 2003. You'll need a PC running Windows 2000 or Windows XP, plus around 4GB of free disk space to run Visual Studio .NET. You can order a DVD containing a 60-day trial version of Visual Studio .NET at http://msdn.microsoft.com/vstudio/productinfo/trial/default.asp. You just have to pay the postage. This IDE provides you with everything you need, including Pocket PC 2002 and Windows CE .NET emulators, so you don't even need a real device.

Visual Studio .NET 2003 will be released in February or March 2003. Don't get the 2002 version - it doesn't support the .NET Compact Framework.

Building an Application
To get started, open Visual Studio .NET 2003 and click on File ->New Project. In the New Project window (see Figure 1), select either Visual Basic or Visual C# projects in the left pane according to your preference, then click the Smart Device Application icon in the right pane. Enter the name you want to give this project (for example, "MyFirstSmartDeviceApplication") and click OK.

Another window appears, this time asking you what kind of project you want, and which platform it should run on. Choose the Pocket PC platform, and the Windows Application project type. Click OK and Visual Studio .NET creates the project for you.

Using the GUI Designer
Now you're working in a familiar Visual Studio .NET drag-and-drop visual designer. You build your user interface by dragging controls from the Toolbox onto the Form. For this simple application, click on the Toolbox tab on the left edge of the screen so that it slides into view, then drag a label onto the Form (see Figure 2).

You can set properties of the control you just dragged on in the Properties window in the lower right corner of the screen. Set the Text property to a suitable value, such as "Hello, World" or perhaps something more original. Play with some of the other properties - click on the Form to select it, then change the Backcolor property, or set the Text of the Form to display a suitable heading on the Form.

One tip for Pocket PC applications: if you want to get the little "OK" icon on the taskbar at the head of your Form, set the MinimizeBox property of the Form to False. The OK icon is actually the "Quit" option for a Pocket PC application. If you don't do this, you just get an "X" icon, which actually means "minimize." (I know - "X" means minimize, whereas on a PC it means quit? Just don't ask - the Pocket PC user interface has been honed through several Microsoft failures in earlier versions, and users seem comfortable with it. This whole subject deserves its own article.)

Testing Your Application
When you're finished, click the Build menu, option Build Solution. If it builds successfully, click the Debug menu, option Start. You'll be asked where to deploy your application. If you have a real Pocket PC device connected to your desktop by a synchronization cradle, or by InfraRed or 802.11b, then you can select Pocket PC Device. Otherwise, choose the built-in Pocket PC 2002 emulator.

If the target device does not have the .NET Compact Framework runtime installed, Visual Studio .NET downloads it and installs it, along with your application. The emulator runs a true Pocket PC operating system in a virtual machine hosted by your desktop PC. The first time you use it, the .NET Compact Framework runtime must be installed into it, as shown in Figure 3.

New Pocket PC devices that come out in 2003 will have the .NET Compact Framework preinstalled, but on older devices you have to install it manually.

If everything has gone well, you'll see your application displayed on the screen of the emulator (see Figure 4).

Summary
You've created your first application. The .NET Compact Framework class libraries are extensive and allow you to create all kinds of sophisticated applications to run on handheld devices. There is an implementation of Windows Forms, which supports the majority of the controls that you can use in desktop applications with the full .NET Framework. There are also classes to allow you to write XML Web services client apps, and to work with SQL Server CE databases on the device, or fetch data from back-end SQL servers over HTTP or via wireless or wireline LAN.

It's an impressive product that allows the .NET developer to easily transfer skills learned with desktop applications to applications on smart devices. Have a go and see what you can do - I think you'll be impressed!

More Stories By Andy Wigley

Andy Wigley is a principal technologist at Content Master Ltd, focusing on mobility. He is the coauthor of Building ASP.NET Applications for Mobile Devices and .NET Compact Framework Developer's Core Reference, both published by Microsoft Press.

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
When growing capacity and power in the data center, the architectural trade-offs between server scale-up vs. scale-out continue to be debated. Both approaches are valid: scale-out adds multiple, smaller servers running in a distributed computing model, while scale-up adds fewer, more powerful servers that are capable of running larger workloads. It’s worth noting that there are additional, unique advantages that scale-up architectures offer. One big advantage is large memory and compute capacity...
We build IoT infrastructure products - when you have to integrate different devices, different systems and cloud you have to build an application to do that but we eliminate the need to build an application. Our products can integrate any device, any system, any cloud regardless of protocol," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA
With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend 21st Cloud Expo October 31 - November 2, 2017, at the Santa Clara Convention Center, CA, and June 12-14, 2018, at the Javits Center in New York City, NY, and learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
The Internet giants are fully embracing AI. All the services they offer to their customers are aimed at drawing a map of the world with the data they get. The AIs from these companies are used to build disruptive approaches that cannot be used by established enterprises, which are threatened by these disruptions. However, most leaders underestimate the effect this will have on their businesses. In his session at 21st Cloud Expo, Rene Buest, Director Market Research & Technology Evangelism at Ara...
In his session at @ThingsExpo, Eric Lachapelle, CEO of the Professional Evaluation and Certification Board (PECB), provided an overview of various initiatives to certify the security of connected devices and future trends in ensuring public trust of IoT. Eric Lachapelle is the Chief Executive Officer of the Professional Evaluation and Certification Board (PECB), an international certification body. His role is to help companies and individuals to achieve professional, accredited and worldwide re...
SYS-CON Events announced today that Enzu will exhibit at SYS-CON's 21st Int\ernational Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Enzu’s mission is to be the leading provider of enterprise cloud solutions worldwide. Enzu enables online businesses to use its IT infrastructure to their competitive advantage. By offering a suite of proven hosting and management services, Enzu wants companies to focus on the core of their ...
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
SYS-CON Events announced today that Cloud Academy named "Bronze Sponsor" of 21st International Cloud Expo which will take place October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara, CA. Cloud Academy is the industry’s most innovative, vendor-neutral cloud technology training platform. Cloud Academy provides continuous learning solutions for individuals and enterprise teams for Amazon Web Services, Microsoft Azure, Google Cloud Platform, and the most popular cloud com...
Amazon started as an online bookseller 20 years ago. Since then, it has evolved into a technology juggernaut that has disrupted multiple markets and industries and touches many aspects of our lives. It is a relentless technology and business model innovator driving disruption throughout numerous ecosystems. Amazon’s AWS revenues alone are approaching $16B a year making it one of the largest IT companies in the world. With dominant offerings in Cloud, IoT, eCommerce, Big Data, AI, Digital Assista...
No hype cycles or predictions of zillions of things here. IoT is big. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, Associate Partner at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He discussed the evaluation of communication standards and IoT messaging protocols, data analytics considerations, edge-to-cloud tec...
"When we talk about cloud without compromise what we're talking about is that when people think about 'I need the flexibility of the cloud' - it's the ability to create applications and run them in a cloud environment that's far more flexible,” explained Matthew Finnie, CTO of Interoute, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
SYS-CON Events announced today that MobiDev, a client-oriented software development company, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MobiDev is a software company that develops and delivers turn-key mobile apps, websites, web services, and complex software systems for startups and enterprises. Since 2009 it has grown from a small group of passionate engineers and business...
SYS-CON Events announced today that GrapeUp, the leading provider of rapid product development at the speed of business, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Grape Up is a software company, specialized in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market acr...
SYS-CON Events announced today that Ayehu will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara California. Ayehu provides IT Process Automation & Orchestration solutions for IT and Security professionals to identify and resolve critical incidents and enable rapid containment, eradication, and recovery from cyber security breaches. Ayehu provides customers greater control over IT infras...
With the introduction of IoT and Smart Living in every aspect of our lives, one question has become relevant: What are the security implications? To answer this, first we have to look and explore the security models of the technologies that IoT is founded upon. In his session at @ThingsExpo, Nevi Kaja, a Research Engineer at Ford Motor Company, discussed some of the security challenges of the IoT infrastructure and related how these aspects impact Smart Living. The material was delivered interac...
Artificial intelligence, machine learning, neural networks. We’re in the midst of a wave of excitement around AI such as hasn’t been seen for a few decades. But those previous periods of inflated expectations led to troughs of disappointment. Will this time be different? Most likely. Applications of AI such as predictive analytics are already decreasing costs and improving reliability of industrial machinery. Furthermore, the funding and research going into AI now comes from a wide range of com...
In his session at Cloud Expo, Alan Winters, an entertainment executive/TV producer turned serial entrepreneur, presented a success story of an entrepreneur who has both suffered through and benefited from offshore development across multiple businesses: The smart choice, or how to select the right offshore development partner Warning signs, or how to minimize chances of making the wrong choice Collaboration, or how to establish the most effective work processes Budget control, or how to ma...
IoT solutions exploit operational data generated by Internet-connected smart “things” for the purpose of gaining operational insight and producing “better outcomes” (for example, create new business models, eliminate unscheduled maintenance, etc.). The explosive proliferation of IoT solutions will result in an exponential growth in the volume of IoT data, precipitating significant Information Governance issues: who owns the IoT data, what are the rights/duties of IoT solutions adopters towards t...
SYS-CON Events announced today that CA Technologies has been named "Platinum Sponsor" of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business - from apparel to energy - is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.