This walkthrough is for developers who wish to create and deploy a simple ArcGIS Mobile application for the Smartphone environment. It demonstrates how to create the application using the ArcGIS Mobile Map Control, the ArcGIS Mobile API and parts of ADO.NET.
You can find this sample in: <ArcGIS_install_location>\DeveloperKit\Samples\Server\NET\Mobile_Applications\Walkthrough_SP05CSharp.zip
The application will display map data that has been extracted from an ArcGIS Map Service using a Map Control, provide basic navigation tools such as zoom and pan, and include an identify function to show feature attributes. Once you complete this walkthrough, you can then extend the application you build with additional functionality.
There are some important concepts you should understand before following this example. As a prerequisite, please read through the Mobile SDK conceptual documentation found under the heading Developing Mobile Applications using the Mobile ADF to gain an understanding of the mobile framework and architecture. You should also have a good understanding of Visual Studio .NET 2005 and how to create a Smartphone application.
The ArcGIS Server Mobile SDK provides serveral Visual Studio components to help you develop mobile applications. The primary components that you will work with in this scenario are the Map Cache and the Map. The Map Cache component requests data stored in a folder called the Storage Path. Th map cache you will use has previously been extracted from a map web service that was published with mobile capabilities. You do not need to create a mobile web service to complete this walkthrough. The Map component will display the contents of the map cache that has been created for you without having to connect to a server. Additional components are used to navigate the map itself and identify attribute information for given features. For more information on the components used in this walkthrough please refer to the ArcGIS Server Developer Help.
In order to walk through this scenario you will need the following installed on your machine:
This example is written in C# and will be deployed to the Windows Mobile 5.0 Smartphone emulator installed with Visual Studio. You should also reference the ArcGIS Mobile ADF object model diagram while proceeding through this example. You can find the OMD in ArcGIS Developer Help.
In this example you will create a simple application within the Windows Mobile 5.0 Smartphone emulator that allows you to open a mobile map cache and display the layers in a map control. You will then add additional controls that will let you navigate the map and identify features within the layers. The first step is to create the new project.

The ArcGIS Mobile controls are added to the Visual studio toolbox when you install the ArcGIS Mobile ADF. They are located in the ArcGIS Mobile Controls tab within the toolbox. To use the controls within your application you must drag and drop them from the Toolbox to your windows form.
Within the following section, you will add a Map and MapCache component to the application and configure them via properties.
When the Map component is added to the form, a MapCache component will be added to your project automatically. Your form should now contain a Map, called Map1, and a MapCache component called mapCache1. Additionally two new references have been added to your project, one to the Mobile ADF windows assembly and the other to the .NET System.Web.Services assembly.
You now need to configure the components via their properties.
You now need to add code to create the map cache on disk and retrieve data from the server while the application is running.
using ESRI.ArcGIS.Mobile;
private void Form1_Load(object sender, EventArgs e)
{
if (!mapCache1.IsValid)
{
MessageBox.Show("Map Cache is not valid!");
return;
}
try
{
mapCache1.Open();
}
catch
{
MessageBox.Show("Cannot open map cache");
}
}
You can add map navigation features such as zoom and pan via the Key Navigation MapAction. This provides a set of ready made navigation functions driven by the Smartphone keys and cursor.

Add the Key Navigation MapAction to the project.
Unlike PocketPC or Windows applications, Smartphone application forms do not present an Ok or X in the top right corner to close the form. You will need to add code to properly close your application. For this walkthrough you will close the application by pressing soft key 1.
private void menuItem1_Click(object sender, EventArgs e)
{
this.Close();
}

Compile the application. On the Build menu, choose Build Solution. This will display the Repair Native Dll's dialog prompting you to add the Mobile ADF unmanaged library to the solution. Click OK to add the dll. This dialog is displayed if the unmanaged dll is missing or has a broken link and you build or run your application.
You will use the Windows Mobile 5 Smartphone emulator to test the application but before you can it must be started and then virtually cradled.

NOTE: Before running the application, you need to copy the map cache data from the samples' data directory to the emulators' \Temp folder. From the Tools menu in ActiveSync, click Explore Device and navigate to \Temp and paste the Redlands folder from <ArcGIS_Server_Install_Location>\DeveloperKit\SamplesNET\Server\data\mobile\MapCaches\Redlands.
You may now compile and run the application. Select the Windows Mobile 5 Smartphone emulator as the target device. At this stage the form should display layers from the map service in the map control.
The Smartphone emulator does not have a file explorer to locate and run the executable when deployed, for this exercise you can run the application via the debugger.
Application Hint: Rather than using the debugger to run the application you can setup a shortcut from the excutable to the Windows start menu on the device. Explore the device using Activesync to setup the shortcut.
Experiment with the application. Zoom and pan the map via the Key Navigation keys.

The application may be deployed to a Smartphone device using either of the methods described in the Deploying mobile adf applications topic.