Writing Cross-Platform Mobile Applications Using Crossfire
Pages: 1, 2
While you are not able to use the controls provided in the Windows Forms (only AppForge controls can be used), you can use the MainMenu control (in the Windows Forms) to create a menu (see Figure 8).
Figure 8. Using the MainMenu control in the Windows Form
When deployed on a Palm device, the menu looks like that shown in Figure 9.
Figure 9. The menu on the deployed application
Testing the Application
There are three ways to test an application:
F5and test the application on a Windows form. This is the most elementary form of testing and is useful for functional testing, but not ideal for testing the user interface.
- Install a device emulator and test the application on the emulator (see Figure 10). You can install emulators of platforms you are targeting and deploy the applications onto them. This is the most efficient way to test your application.
- Connect a real device to your computer and deploy the application onto the device. This should be done at the final stage of your application where you want to test the real-world usage of your application.
Figure 10. Configuring Crossfire to use an emulator for testing
For this article, I have tested my application on a palmOne Zire 72. As Crossfire applications require the Booster in order to work, you need to first of all install the Booster on the device. You can install it via the AppForge menu (see Figure 11).
Figure 11. Installing the Booster on the device
Once the Booster is installed, you can now deploy the application to the actual device (see Figure 12). The icon next to the platform name indicates that the device is designed for that particular platform, but you can still deploy it to the other platforms (although it is not guaranteed to work).
Figure 12. Deploying the application to a device
If you are deploying a Palm application for the first time, you need to supply a Creator ID (to learn more about the Creator ID, visit the URL shown in the dialog window, as shown in Figure 13. For this example, I just enter four random characters.
Figure 13. Setting a Creator ID for your application
To copy the application onto the device, perform a HotSync on your device. The application (DeliveryApp) now appears in the device (see Figure 14).
Figure 14. The DeliveryApp application deployed on the Palm Zire 72
Crossfire also supports building installation files for the various platforms (see Figure 15). For example, Crossfire builds .prc files for the Palm platform.
Figure 15. Building installation files for the various platforms
Learn Using the Sample Applications
Crossfire ships with six sample applications illustrating several techniques in using Crossfire running on multiple device platforms. Here are the six (descriptions are from the documentation):
- Animals (AFDatabase): The Animals AFDatabase sample demonstrates how to use the AppForge Database Model to gain generic access to the native database structures on various devices.
- Animals (PDB): This application demonstrates the basic functionality of the AppForge PDB Library. Use this Database Tutorial to learn how to add database functionality into your own Crossfire applications.
- Launch Pad: The Launch Pad sample provides a simple user interface to retrieve files from the file system on a device, and to launch applications. When testing the application in Windows, it looks for the folder C:\Program Files\AppForge. It then recursively scans that directory and all sub-directories for any file with the extension .exe. It lists all of those applications in the grid. When the user selects an application in the list and presses run, the selected application is launched.
- PIM Scheduler: The PIM Scheduler sample provides a simple user interface to view and modify the PIM (Personal Information Manager) data that is native to a given device. This example only interacts with the Scheduler (or Calendar), but the same techniques can be used for Contacts, Memo, and ToDo. To run this application in Windows, you must have Microsoft Outlook installed. This application will read and write to the same database that is used by Outlook.
- Proof of Delivery: The Proof of Delivery application confirms a delivery with a barcode scan and a signature capture. This information is written to a PDB, along with a time stamp, for storage.
- Stock Quote: The StockQuote sample provides a simple user interface to retrieve information about a publicly traded stock. It also allows a user to maintain a list of stocks in a portfolio. Current price information about a particular stock is retrieved from the Internet using a public site. The sample illustrates two different means of accessing this web site: through the AppForge InetHTTP control that specifically targets HTTP communication, and through the more general AppForge Socket control that allows full TCP/IP access.
I think Crossfire has a lot of potential. With many device platforms on the market, developers are having a hard time trying to adapt their applications to run on the different platforms. Having a single code base able to run on multiple platforms is definitely a cost-saving proposition. Moreover, AppForge has cleverly leveraged on developer's familiarity with the .NET language (VB.NET, in this case) and spared developers the need to learn a more cryptic language such as C++. If you have not tried Crossfire yet, get a 30-day evaluation from www.appforge.com.
Wei-Meng Lee (Microsoft MVP) http://weimenglee.blogspot.com is a technologist and founder of Developer Learning Solutions http://www.developerlearningsolutions.com, a technology company specializing in hands-on training on the latest Microsoft technologies.
Return to ONDotnet.com