Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Mobile CoDe.NET: Exploring the .NET Compact Framework : Page 4

"Windows CE or Mobile Web?" The .NET world can steer you in two very opposite directions: .NET Compact Framework or ASP.NET Mobile Controls.

Working with the Emulator
Figure 1: The Smart Device Extensions in Visual Studio .NET 2003 feature powerful emulators that allow you to test .NET Compact Framework applications for the Pocket PC 2002 or Windows CE .NET 4.1. These "virtual devices" can be configured to emulate a wide range of configurations depending on the needs of your specific projects.
Running and testing a .NET Compact Framework application is a bit different than it is for standard Windows projects. In fact, it's a bit like Web development: just like ASP.NET applications (i.e. Web Forms) need to be tested in their run-time environment—the Web browser—.NET Compact Framework applications need to be tested in their own run-time environment: a "smart" Windows Powered device, or an emulated version of one. I already mentioned the emulators included with the SDE. These are, in fact, a single emulator engine running Virtual PC technology from Connectix packaged with multiple OS images. Each image contains a full instance of the mobile OS and can run in Virtual PC emulation on top of an x86 processor. There are two default images you can use, one for each of the two platforms you can target with the SDE: Pocket PC 2002 and Windows CE.NET 4.1. With newer versions of mobile OS specs based on Windows CE.NET 4.2 on the way—such as the new Windows Mobile 2003 (see the Mobility World News sidebar) and others—you can expect Microsoft to provide additional SDE support and emulator images in Visual Studio .NET updates in the coming year. And with Microsoft's acquisition of the Connectix Virtual PC technology earlier this year, you can also expect to see it creep into many other products in the near future. To see the emulator in action, simply use the Connect to Device option from the Device toolbar. It is also available under the Tools menu in the Visual Studio .NET 2003 IDE. The SDE then launches the emulator and loads the default OS image for Pocket PC 2002 (see Figure 1). Feel free to click around using your mouse; you'll soon realize all the basic Pocket PC 2002 features are there, from Pocket Word to Solitaire. It's a good idea to leave the emulator loaded and connected while building and testing SDE applications. This way you'll save yourself the time it takes to launch the emulator every time you run your application. But for now, close the emulator since we'll look at configuration options.

You'll notice there are two options presented to you in the Shut Down dialog window that appears when you close the emulator: you can select Save Emulator state to preserve all the settings you have configured, applications you loaded and files you transferred (just like a real device which maintains a persisted state), or you can select Turn off emulator, in which case all your changes made in terms of device configuration and files copied are lost and the emulator reverts back to the default "vanilla" package. Since not all Pocket PCs are identical, you might want to configure this device. Not all Pocket PCs feature the same amount of memory or support the same color depth. Fortunately, you can tweak a few options to make the emulator's behavior closer to the actual device you'll be deploying to in production. Select the Device Options button on the Device toolbar to access these configuration options (see Figure 2). You are presented with three tab pages of options. The first allows you to change the screen size and color depth. Since all Pocket PC 2000/2002 devices support a fixed 240x320 screen resolution, I advice against changing that. These settings are typically reserved for generic Windows CE projects where the screen resolution is variable from device to device (e.g. 240x320, 320x240, 640x240, 640x480, 800x600, etc.)

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date