Using the application framework to customize a Windows Mobile application

Overview

The application framework provides the capability to customize a mobile application. With the framework, you can create a task or an extension to customize the application. You can extend existing functions within the application or embed new functionality with your own business logic. This topic describes the architecture of the framework design.

NoteNote:

The application framework is made available in ESRI.ArcGIS.Mobile.Client.dll. It is dependent on ArcGIS Mobile core framework (which is available in ESRI.ArcGIS.Mobile.dll).

ArcGIS for Windows Mobile provides application framework for both Windows (tablet) and Windows Mobile applications. Both are available through ESRI.ArcGIS.Mobile.Client.dll but are located in different folders. When you start developing tasks or extensions, make sure you choose the right assembly for your target platform. By default, the application framework assembly for Windows Mobile platform is located at <install folder>\ArcGIS SDKs\Windows Mobile\CompactFramework\ESRI.ArcGIS.Mobile.Client.dll, and the application framework assembly for Windows platform is located at install folder>\ArcGIS SDKs\Windows Mobile\bin\ESRI.ArcGIS.Mobile.Client.dll.

If you're new to the mobile application, familiarize yourself with the basics of the application. The task-centric, workflow-driven design is the key to understanding the architecture of the application framework. The application framework exposes numerous areas where you can access various functions inside the mobile application, and there can be more than one way to build your customization.

The following diagram shows the basic architecture of the application framework and the relationships between key classes:

The following sections provide more details on the key concepts of the framework shown above.

Mobile application

At the highest level, the application framework contains a MobileApplication class that represents the mobile application itself. The MobileApplication class exposes a GpsConnectionManager, allowing you to hook up a Global Positioning System (GPS) management module. It's assumed that each device will have some type of GPS receiver.

Through the Project property, MobileApplication also provides access to the current mobile project that is opened in the application. It's common to get lists of project extensions, tasks, and other project-related information for a mobile project through this property. For more details on Project, see the following section.

Access Project and GpsConnectionManager from MobileApplication

To navigate the user from one page to the next within a task or workflow, the MobileApplication class provides two useful methods: Transition() and ShowDialog(). Transition() can be used when you need to show a new page to the user while some other process is going on behind the scenes (for example, a new page that shows the user a list of features that are within a 5 mile distance from a certain point the user defines). ShowDialog() can be used when you need the user to provide input or make choices on the page and close it before they can do anything else (for example, a login dialog box that requires the user to provide a user name and password). The Transition method takes a page that inherits from the Page class, which provides the default visual elements such as the title bar and left and right soft menus. The ShowDialog method takes a Windows form by default. To have the same look and feel for your dialog box as other pages, you can also inherit the Page class.

With both the Transition() and ShowDialog() methods, the MobileApplication class takes care of how to show the new page, how to hide the previous page, and how to make the transition seamless without any flickering on the screen. In addition, since Transition() takes a form that inherits the Page class, the form, by default, contains a left soft menu and right soft menu. The left soft menu will show Back unless you change it, and when clicked, will automatically navigate the user back to the previous page. This does not require you, as a developer, to write any of code. If the previous page is the SelectTaskPage, the left soft menu will show Tasks and navigate the user back to the SelectTaskPage when clicked.

Project

As mentioned above, field tasks and associated data are organized by mobile projects in the mobile application. Through Mobile Project Center, you can create, edit, or delete projects. You can specify data sources for your mobile project (operational service and/or basemap data); customized names and descriptions for built-in tasks; whether or not each field from each layer is editable, viewable, or searchable; and GPS-quality filters for layers for which the user can collect data. Mobile Project Center also allows you to add additional tasks or extensions from third-party assemblies.

When you open a mobile project, the application loads the project's configuration file. With the framework, you get access to the project by the MobileApplication.Project property. From the Project class, you can get a list of available project extensions through the ProjectExtensions property or a list of tasks through the Tasks property. You can also get the full extent or spatial reference used in the mobile project or be notified through the FeaturesChanged event when features get changed.

Project also fires up a CreatingFeatureActionItems event when FeatureActionItems are being created on certain pages. This typically happens when you have a list of features on a page, and you tap it to show available actions that you can apply to the activated feature. By handling this event, you get a chance to modify the ActionItems collection.

There are a few built-in pages and tasks for the application, such as SelectTaskPage, SettingsPage, ViewMapTask, and WorklistTask. SelectTaskPage contains a full list of tasks available for this mobile project. It serves as the home page for the project.

Project class

Task

The mobile application is a task-based, workflow-oriented application that provide a well-guided user experience for field workers. Consequently, field workflows are conceptualized into different tasks. The capability to view geospatial information on the map is available in ViewMaptask. The most commonly required field data collection and feature inspection workflow is available in CollectFeaturesTask with all necessary guidance for the user to collect and update geospatial information in the field. Each of these built-in tasks, or any task you develop, is represented by the Task class within the application framework.

The following are the built-in tasks provided by the mobile application:

All these tasks inherit from the Task class, which further inherits the ProjectExtension class. In this sense, Task is actually a special type of ProjectExtension. One unique characteristic about the Task class is that the task is listed on SelectTaskPage, while a normal ProjectExtension is not.

The application framework provides access to each of the above tasks as shown in the following diagram:

Task class diagram

A task has a name, description, and optionally, a customized icon. If you don't specify a custom icon, the mobile application will use a default icon. The icon needs to be 36 by 36 pixels in dimension.

Task list in Windows Mobile application.

Task class

Creating a new task and listing it on the SelectTaskPage is only part of the story. Typically, a task consists of a few pages that your field workers need to go through to get their job done. Therefore, as a developer, you need to create separate pages with which your field crew can interact, and guide them through the whole process in order to complete the task. To navigate the user from one page to another, use the MobileApplication.Transition() or MobileApplication.ShowDialog() method.

Project extension

To modify an existing task, you can use a project extension to deploy your customized workflow or pages.

Page

In the mobile application, you can think of a page as a customized form that carries certain user interface (UI) elements and behaviors. Each task can have multiple pages linked to form a workflow. As a developer you can provide a new task with your own pages, a new task with existing pages, an existing task with new pages, or an existing task with customized existing pages. To create your own pages, the application framework provides the Page class, and many pages inside the mobile application inherit the Page class to keep a consistent look and feel. By inheriting the Page class, you have a title bar and default left and right soft menus on your form. This makes it easy for your UI to be consistent with other pages in the application. Moreover, you can use the MobileApplication.Transition() method to navigate the user from one page to another, and let the user go back to the previous page if need be. This page navigation approach requires the least amount of development effort and can reduce development time.

Page class

1/7/2015