In the March 6 edition of Mobile & Wireless UPDATE, I introduced the Microsoft .NET Compact Framework. This week, I want to show you how to get started using Smart Device Extensions (SDE) to develop a Compact Framework application.
SDE is the visual design environment in which you use Visual Studio .NET 2003 to create Compact Framework applications. You can use only the Visual Basic .NET and C# languages to develop SDE applications. Support for the other .NET languages--for example, Visual C++ (VC++) and Visual J++ (VJ++)--will be available in future Visual Studio .NET releases.
To create a new SDE application project in Visual Studio .NET, you select New Project, then choose Smart Device Extension project type in the New Project dialog box. Visual Studio .NET then creates the project and displays a default Windows form. The default form looks similar to a typical Windows form but with a reduced form factor for mobile devices. You can now begin to add additional forms and controls that will add up to the features and functionality that you want your application to have. Features might include logon screen, menus, data lists or data grids, and so on. Advanced features might include barcode scanning, mobile printing, Web services, Microsoft SQL Server 2000 Windows CD Edition CE (SQLCE) data manipulation, and so on.
Remember, Compact Framework applications are local applications that run on the device. You can't assume that consistent connectivity will exist when the application is used in the field. Therefore, you should create a mechanism to synchronize data to the device, store it in a SQL Server CE database or an XML document on the file system, then access the data locally from your application.
Testing your application is an important part of developing and deploying Compact Framework applications. Visual Studio .NET now has a built-in Pocket PC 2002 device emulator that lets you easily test your application's features and functionality. This emulator almost exactly simulates the runtime environment, so you can test Compact Framework applications with the knowledge that they'll run on the target Pocket PC platform without significant problems.
When you run your application, you can choose to run it in the emulator or on an actual Pocket PC device. Visual Studio .NET detects the components that the device or emulator needs to run the application, then loads all the necessary components, including the Compact Framework Common Language Runtime (CLR) and relevant Compact Framework class libraries. I recommend using a real Pocket PC device that has a Wi-Fi connection to the development machine. Loading the application to the device over Wi-Fi is much faster than using the emulator or a serial-cable connection. A Wi-Fi connection is also beneficial when you're debugging the application within Visual Studio .NET.
Visual Studio .NET 2003 and SDE offer an impressive debugging environment. As with any Visual Studio .NET application, you can insert break points and step through the running code. When you develop Compact Framework applications, you can debug the application while it's running directly on the device or on the device over Wi-Fi. Therefore, the development of the application is much easier than it would be in other development environments.
In the next Mobile & Wireless UPDATE, I'll give an overview of best practices to follow when you use the Compact Framework. Until then, I wanted to mention that CTIA Wireless 2003 and the Microsoft Mobility Developers Conference are occurring in New Orleans. In the next couple of UPDATEs, I'll also provide some summary information about developments at both events.