Configuring Tasklets
You can develop tasklets to include configuration settings that can be set in the UserRole.xml file. This is convenient because you do not need to access the tasklet code to change the settings. For example, making text strings available from the UserRole.xml file is especially useful to translators. To accommodate these configuration settings, the UserRole.xml file includes an <appSettings> element and a <labels> element. In addition, it is possible implement custom configurations with user-defined elements.
Configuring Text on a Tasklet
A tasklet can have numerous text resources that appear on the user interface. For example, the text resources can include field labels, column headings, and validation error messages. You can customize these text resources using the <labels> element in the UserRole.xml file.
Tasklet Code for using Labels in the UserRole
The tasklet must contain a statement to get the label value from the configuration object called this.Configuration.Labels, as shown in the following example.
myTaskletView.MyColumn.Text = this.Configuration.Labels.GetValue(“myLabelText”, “default text”)
Where:
-
myLabelTextspecifies a unique key for the method.
Note |
|---|
|
You need this unique key to customize the label in the UserRole.xml file. |
-
default-textspecifies the text to use if the label is not specified in the UserRole.xml file. -
For more information, see How to: Change Text on the Tasklet.
Configuring Tasklets Using the appSettings Element in the UserRole
You typically use the <appSettings> element for simple tasklet configurations using key-value pairs. A key-value pair is a set of data items that contains a unique identifier, called a key, and a value that is the actual data for the key.
Tasklet Code for using AppSettings
The tasklet must contain a statement that retrieves the setting from the configuration object called this.Configuration.AppSettings. The following example is a statement for a Boolean setting:
bool editMode = this.Configuration.AppSettings.GetValue<bool>(“editMode”, true)
Where:
-
editModespecifies a unique key for the method.
Note |
|---|
|
You need this unique key to configure the appSetting for the tasklet in the UserRole.xml file. |
-
truesets the default value for the setting to true.
For more information, see How to: Configure a Tasklet Using appSettings.
Configuring Tasklets Using Custom Configuration Elements
You can develop tasklets with configurations that can be set in the UserRole.xml file using a custom configuration element. A custom configuration is typically a more complex configuration than the key-value pair configuration of the <appSettings> element. Custom configuration is typically used when a tasklet has collections and complex data configurations. An example of custom configuration is a tasklet that searches a database for information and then displays the information on the tasklet user interface. This tasklet can include configuration settings in the UserRole.xml for specifying SQL statements that retrieve data from specific fields of the database. To see an example of this, refer to How to: Configure a Tasklet Using Custom Configuration Elements.
See Also
Tasks
How to: Change Text on the TaskletHow to: Configure a Tasklet Using appSettings
How to: Configure a Tasklet Using Custom Configuration Elements
Concepts
Mapping Business Activities and Tasks Using OrchestrationGuidelines for Using Orchestration to Build a Mobile Application
Defining Orchestrations in the UserRole
Note