Overview of the Windows application framework
To help you get started, this section provides an overview of the Windows application framework, specifically, how the Windows application is architected, its major components, and how they are related to each other.
Before getting into the details about the Windows application framework, it is worth pointing out that both the ready-to-deploy Windows application and the Windows Mobile application are built based on the core ArcGIS for Windows Mobile SDK, and the architectures of these two application frameworks and their development experience are very similar. However, there are some differences between them because they are built with two different development environments: Windows Presentation Foundation (WPF) for the Windows application, and WinForms for the Windows Mobile application. The differences are addressed herein and high-lighted in the topics where appropriate.
Architecture
The Windows application framework exposes a set of classes for accessing various functional areas inside the ArcGIS Mobile for Windows application. The following diagram shows the key classes and the relationships between them at a coarse-grained level. The application class, MobileApplication, provides access to the project, application settings, Map control, GPS manager, and UI page. A mobile project consists of one or more tasks and extensions, along with the map data. The project is created using the Mobile Project Center (MPC), which allows you to set both the map data and tasks, and include any tasks or extensions written to customize the application.
As mentioned earlier, the ArcGIS Mobile application is a task-driven or workflow-driven application. Each task or extension has one or more pages for its workflow. From each page, you have access to the navigation bar, which contains a page menu and navigation buttons.
The Windows Application framework is available with ESRI.ArcGIS.Mobile.Client.dll in the bin folder of your mobile installation.
MobileApplication
Within the application framework, the MobileApplication class represents the ready-to-deploy Windows application. It is the primary hook into the mobile application; you can access its exposed properties, member variables, and functions via its static instance Current when the application is running.
Key members of the MobileApplication class include:
- CurrentPage—The current page displayed in the application.
- MenuItems and GpsMenuItems —Accesses the application global menu (on the top-left corner of the title bar) and the GPS menu (on the top-right corner of the title bar).
- GlobalProjectExtensions and GlobalTasks—Accesses tasks and extensions. These tasks and extensions exist for all projects.
- ApplicationExtensions—Accesses the application extensions.
- GPSConnectionManager—Manages the GPS connection, connect, and disconnect, and changes its settings. Accesses the location information from the GPS unit.
- Settings and SettingsPage—Accesses the application settings and settings page.
- Project—Accesses the current project opened in the application.
- Map—Accesses the shared WPF map control.
A task or project extension can involve one or more pages to perform its workflow. For example, in the Collect Features task, the application guides you through a series of pages, including the select feature type page and edit feature page, which contains geometry editing/collection and attributes editing. To navigate from one page to another, the MobileApplication class provides a Transition() method to close the current page and load the new page. The current page can be accessed from the CurrentPage property.
Task and ProjectExtension
The ArcGIS Mobile for Windows application has the following six built-in tasks:
- View Map Task
- Collect Features Task
- Search Task
- View Work List Task
- Manage Edits Task
- SynchronizeTask
All of these tasks have classes that are derived from the Task class, which is, in turn, derived from the Project Extension class. Technically, Task is a special type of ProjectExtension. While a task is listed in the navigation bar menu on the View Map page, a project extension typically is used to customize or extend the application or existing tasks.
A Task has a Name, Description, Note, and an ImageSource for its icon. The way to specify a task icon is different in the Windows application framework and Mobile Application framework. Refer to the samples and assembly reference for details. The Task class has an Execute() function that is called when the task button is tapped from the task list page and starts the task workflow.
To customize an existing task, you can customize the pages in its workflow, for example, add a MenuItem to the navigation bar page menu; or you can insert a function or page at extensible points during its workflow, for example, add a geometry validation function after the feature collection is finished. See the Using Windows application framework section for more details about these extensible points in existing tasks.
MobileApplicationPage
MobileApplicationPage is an important class in the Windows application, since all pages are derived from it, and it acts as the template for the pages in the application. MobileApplicationPage is a WPF user control that defines the page title, note, and icon on the title bar; the menu and buttons on the navigation bar; and the window content between the title bar and navigation bar.
In the middle of the navigation bar, is the page menu, which can be accessed from the MenuItems property to add or remove an item to or from the menu. You may notice that MenuItems is a collection of Object, instead of a MenuItem, this is because with a WPF, you have the flexibility to add different controls other than just a standard MenuItem MenuItem. See the Using Windows Application Framework > Menus topics for more details.
The buttons on the navigation bar are for navigating from the current page to another. BackCommand is a PageNavigationCommand associated with the Back or Cancel button on the left end of the navigation bar. When the Back or Cancel button is invoked, the application transits to the PreviousPage. With the BackCommands collection, you can add more buttons to the left of the page menu, or use the OkCommand and ForwardCommands to add buttons to the right of the page menu.
The application provides a help page for each page; HelpSource property defines a URI pointing to the HTML help page, which is located under the <installdir>\Help\ContextHelp\ArcGISMobile folder.
The MobileApplicationPage is comparable to Page in the Windows Mobile Application framework. The former is a WPF control; the later is a Winform control.
Development and deployment of Task or ProjectExtension
A task or project extension assembly is essentially a .NET class library. This assembly is loaded when the application opens a project that contains this task or project extension. To develop a task or project extension assembly, you can use an ArcGIS Mobile project or item template. See the walkthrough tutorials for more details.
To have the Windows application load your tasks or project extension when you open a project, you need to incorporate the task\extension into a mobile project and ensure that the assembly DLL is placed in the correct folder location for deployment with the project. See the Deploying extensions topic for more details.