Using ArcGIS Mobile project templates

Complexity: Beginner Data Requirement: Installed with software

To help you get started with the ArcGIS Mobile application framework, a few project templates and item templates (C# only) are included. These templates will be installed by the ArcGIS Mobile setup and configured to work seamlessly with Visual Studio 2008.

To verify that the templates have been installed correctly, launch Visual Studio IDE and go to File > New > Project. You should see the following options. Note that there is a new project type, ArcGIS Mobile, added under the Visual C# category, and on the right panel, there are two project templates available, one for task and the other for project extension.

Tutorial 1—Creating an ArcGIS Mobile task using template

The following steps demonstrate the best practice for creating a task project using the ArcGIS Mobile Task template.

Steps:
  1. Choose ArcGIS Mobile Task from the right panel.
  2. Make sure to check the Create directory for solution check box.
  3. Provide a name and location for your project. In this example, it is named MyCustomTask.

  4. Click OK to proceed.

    The template creates three projects for you. Notice that the project name you provide at step 3 is used as the solution name for all three projects but with different suffixes. MyCustomTask_Win contains all necessary files for a task on the Windows platform, MyCustomTask_WM contains files for the Windows Mobile platform, and MyCustomTask_ProjectCenter contains all files for Mobile Project Center.

  5. Rename the name space for the projects.

    This example uses one Mobile Project Center project to describe two assemblies (Windows and Windows Mobile). Therefore, you need to create both assemblies (Windows and Windows Mobile) using the same name space, class name, and output assembly name. Even if you are building a task/extension for one platform, it is suggested that you follow the same guideline.

    Click the plus sign (+) next to MyCustomTask_WM to expand it. Double-click Task1.cs . It opens in Editor. Right-click CustomArcGISMobileTask. On the Rename dialog box, rename it MyCustomTask (the name you specified at step 3) in the New name text box.

  6. Make sure you check all name spaces on the Preview Changes dialog box. Click Apply.

  7. If you see the following dialog box, click Yes.

  8. Notice that all name spaces in the current solution have been changed to MyCustomTask.
  9. Change the default class name to MyCustomTask by opening Task1.cs in the MyCustomTask_WM project and renaming it.

  10. Open MyCustomTask_Win.cs in MyCustomTask_Win project. Rename the MyCustomTask_Win class to MyCustomTask.
  11. Open the source code for MyCustomTask_ProjectCenter.xaml. Rename the MyCustomTask_ProjectCenter class name to MyCustomTask.
  12. In the MyCustomTask_ProjectCenter.xaml.cs file, update m_displayName as necessary.

  13. In the MyCustomTask_ProjectCenter.xaml.cs file, change the URI for the Icon property.

  14. In the same file, make sure you update the ReadXml code block with the new class name.

  15. Change the output assembly name for all three projects. For Windows and Windows Mobile projects, the output assembly name must be the same.

    Open the Properties dialog box for the MyCustomTask_WM project. In the Assembly name text box, type MyCustomTask. Do the same thing for the MyCustomTask_Win and MyCustomTask_ProjectCenter projects.

  16. Update MyCapability.xaml.cs with any additional changes that you desire.

    Refer to the comments, especially those with // TODO notes.

    NoteNote:

    The Task project template creates projects for you to start with when you build a new Task project. If you are building the task for one platform only, you can delete the other projects in the solution.

    Also note that the Task template provides an empty page that you will be navigated to when the task is executed. You should modify as necessary to fit your business logic.

    To get hands-on experience creating a Mobile Project Center assembly that works with an existing sample, unzip and open this Project Center project.

    This ZIP file contains a Mobile Project Center project that works with the HelloWorldTask sample and allows you to customize the name and description for the task in Mobile Project Center.

    The below screen capture shows the sample when it's loaded by Mobile Project Center:

Tutorial 2—Creating an ArcGIS Mobile project extension using template

Steps:
  1. Create a new project extension.

    Choose ArcGIS Mobile Project Extension from the New Project dialog box and provide a name/location for your project. Click OK.

  2. Click OK.

    The template creates three projects for you, one for Windows, one for Windows Mobile, and the third one for Mobile Project Center. If you are developing for one platform only, you can safely delete the other ones.

Follow the same best practice as provided above for creating a new task project using template.

If you are interested in adding a new task or project extension to an existing project, learn how to use ArcGIS Mobile item templates.

Get more details on deployment.


9/20/2011