Developing Mobile Application Solutions and Tasklets

Mobile Device SDK enables you to build modularized mobile business applications that you can tailor to specific roles in your company. When you use the framework components in Visual Studio 2008, you can create mobile applications from reusable components, which are called tasklets. Tasklets can be combined in flexible ways with orchestrations to fit the needs of different users.

To create a conventional mobile business application, you develop a separate Windows application for each role and then deploy the applications to a mobile device.

With Mobile Device SDK, you can divide a mobile business application into tasklets and develop each tasklet as a separate .NET type. You can then use XML to piece tasklets together into different configurations, which are called orchestrations, and reuse tasklets in other flows within the same application or across applications. This enables you to create personalized, role-based applications that you can install on a per-device or per-role basis. This topic provides a brief overview of how to create tasklets to develop mobile applications, how to use a tasklet in an orchestration, and how to use a service in a tasklet.

Creating Tasklets

With Mobile Device SDK, you use tasklets and orchestrations to build mobile business applications. You define the tasklets that make up a mobile business application in Visual Studio. Since a tasklet is a .NET type, which lives in its own assembly, you must create a tasklet project for each tasklet that you need in your application.

Bb986783.Local_-1293526462_magtaskletproject(en-us,MAG.15).gif

To separate the business logic from the user interface, the tasklet project contains the following files:

  • Interface file (ITaskletView.cs).

  • User interface file (TaskletView.cs).

  • Class declaration file (Tasklet.cs) .

Each tasklet performs a specific action, which typically represents a task of a larger flow that is performed by mobile users. For example, for all the steps that are involved in placing an order, you would develop each step as a separate tasklet:

  • Choosing the items to order.

  • Entering shipping information.

  • Sending the order.

Tasklet User Interface

All tasklets use a common user interface (UI) to display information on mobile devices. Mobile Device SDK includes a template that provides you with the standard Windows Mobile layout, including the title bar and soft key menu. When you create a new tasklet, you only have to select the provided template when you create the tasklet project. For more information, see How to: Create a Tasklet Project. As a developer, you only have to be concerned with the content and layout specific to the tasklet. When a tasklet is displayed in the UI, it is called a tasklet page. The following illustration shows a tasklet page UI.

Bb986783.Local_1524224324_magtaskletpage(en-us,MAG.15).gif

By default, the tasklet main menu is populated with the orchestrated actions of the displayed tasklet. If you need to add menu items to a specific tasklet page that contains business logic, you must add these from the tasklet code. For more information, see Designing Main Menus and Context Menus.

Tasklet Data Handling

Tasklets can be programmed to perform various actions for handling data. A tasklet can display data from a Microsoft SQL Server Compact Edition database on the device, accept input from another tasklet, and output data to a request document. In Mobile Device SDK, you manage data by writing code on a tasklet and defining the orchestration in the UserRole.xml file.

For example, when you select a customer from a tasklet page, the tasklet sends an ID for the selected customer to another tasklet. The information that is displayed in the second tasklet is retrieved from a local database by looking up the ID of the selected customer. The customer ID that is selected in the first tasklet must be transferred to the second tasklet. You do this by coding input and output parameters on the tasklet and then specifying the mappings between the output and input parameters of the tasklets in the UserRole.xml file. For more information, see Displaying Data on Tasklets, and Transferring Data Between Tasklets.

Orchestrating Tasklets

Orchestration controls the flow of an interaction among tasklets and determines how mobile users navigate through the application. The orchestration is developed in XML and is stored in the UserRole.xml file. For more information, see Mobile Orchestration. Because the input to and output from tasklets is managed in the orchestration, no additional tasklet coding is required to be able to use them in different mobile applications. This allows you to reuse tasklets in other flows within the same application or across applications. Individual tasklets can store a set of instance configuration data in the UserRole.xml file so that the actual behavior of the tasklet can change depending on the setup.

Using a Tasklet in an Orchestration

Tasklets can be used in more than one orchestration and opened from various tasklets. With each instance, the tasklet can be configured differently for the orchestration in which it opens. To use a tasklet in an orchestration, the tasklet must be defined in the UserRole.xml file. Defining a tasklet includes specifying the:

  • Tasklet assembly name.

  • Actions for navigating to other tasklets.

  • Input and output parameter mappings.

  • Custom configurations.

There are two places that you can define a tasklet for use in an orchestration:

  • Locally on the <orchestration /> element.

  • Globally in the <userRole /> element.

The first tasklet element in the startup orchestration is the tasklet that is displayed when the application starts. For more information about using tasklets in an orchestration, see Defining Tasklets.

Using Services with Tasklets

Mobile Device SDK provides you with services that are designed for mobile business applications. To add a service to your application, call the service from the tasklet in the class declaration file. You can also define your own services that can be used in the same way. For more information, see Working with Services.

Customizing Tasklets

You can customize a service by developing tasklets with configuration settings in the app.config file. The <appSettings /> and <labels /> elements allow you to add and modify the text resources that appear in the UI, such as field labels, column headings, and validation error messages. In addition, it is possible to implement custom configurations with user-defined elements. Custom configurations are more complex than configurations that use an <appSettings /> element. Custom configurations are typically used when a tasklet uses collections and complex data configurations. For more information, see Configuring Mobile Applications in the Microsoft Dynamics Mobile app.config File and Customizing Tasklets.

See Also

Community Additions

ADD
Show: