Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Getting Started with Windows Mobile Development : Page 5

Although the Compact Framework is roughly one-third the size of the regular .NET Framework, it provides all of the requisite functionality to create powerful mobile applications.


advertisement
Running and Debugging the Code
Using Visual Studio, you have two choices for setting the target device for deployment. The first is to set the active Target Device field in the Properties page for your main Project and the second option is to use the Device Toolbar's drop-down list to select the target device or emulator. If your code compiles, deployment to the emulator/target device begins. Visual Studio transfers the requisite CABs to the target and runs them to install the DLLs your application needs. If you are using an emulator, deploying these CABs is a slow process. To prevent having to wait each time you compile and deploy your application, you can save the state of the emulator by either choosing "Save State" from the File menu or by closing the form and answering "Yes" to the resulting dialog box.

If you set breakpoints in your code, you can stop program execution on the emulator/target device and step through the code, just as you would when developing a desktop application. However, there are a few limitations: Edit and Continue is not supported, and there are no DataSet visualizers, so you can't look at the state of the data at any given point. You can use QuickWatch to display the object and drill down into the object hierarchy to look at the column and row collections. Packaging the Code for Distribution
After you finish your code and are satisfied with its functionality, you are ready to create a distribution CAB. You'll find a special project available from the "Other Projects/Setup and Deployment" page in the New Projects wizard. You need to take a couple of steps to package your application as a CAB file for deployment:

  1. Add the Smart Device CAB project to your solution.
  2. Right-click the project and choose Add Project Output.
  3. Choose Primary Output from the list of file types.
When you add the primary output to the CAB project, Visual Studio determines the required dependencies for you and adds them to your project automatically. If your project requires any additional files, you can add them manually. You also need to add a reference to the compact database you created. After adding the dependencies, you can finish the deployment project:
  1. Right-click the file system portion (left pane) of the project screen and choose Add Special Folder.
  2. Choose Windows Folder from the list presented.
  3. Click the application folder.
  4. Select all your application DLLs from the middle pane and move them to the Windows folder you just created.
This completes the creation of the deployment project. Build the project just like any other project and the output will be your package application CAB.


You can also add program icons and registry entries using the CAB project—you can find a more detailed explanation here. One typical deployment requirement is to package multiple CABs into one package that includes your application CAB, the .NET Compact Framework CAB, the SQLme CAB, and any others your program requires. That way, because all the requisite CABs are included, your program installation can proceed without error. Any necessary programs get installed automatically prior to your application's installation. Unfortunately, doing that requires a great deal of effort to package correctly; however, there is a relatively painless solution: Pocket PC Installer.

 
Figure 8. Pocket PC Installer: You can drag and drop additional files to be installed with your application to your deployment project.
This inexpensive, wizard-driven program is well worth the investment. It includes options for most installer features, including license agreements and background images. You create the install by simply dragging and dropping files on the file listing screen (see Figure 8). The major benefit of this program is that after compiling your installation files, you create two executable files: a PC executable that you can copy to your PC and from there to a connected device and a second PPC executable to copy directly to the device.

Unlimited Potential
Compact Framework development has the potential for explosive growth. Conservative estimates indicate that there are over two billion cell phones worldwide. Many citizens of third-world countries can't afford and will never own a desktop computer, but will use their cell phones to access the Internet. By employing the ideas and techniques in this article you can become proficient in developing for mobile markets and take advantage of this growth opportunity.



John Baird is the founder of Quay, Inc., a professional consulting firm that specializes in software development using Microsoft technologies. John has 28 years of experience designing, coding, and implementing software solutions. He co-founded the Northern Delaware .NET Users group, is heavily involved in local .NET communities, and travels extensively presenting to user groups, code camps, and special interest groups.
Comment and Contribute

 

 

 

 

 


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

 

 

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