Open Test Framework - Screen Mapping

From emotive
Jump to: navigation, search

Introduction

The HMI extension (Human Machine Interface) provides access for interacting with the user through the display of graphical screens. To achieve this goal, there are two ways to operate with screens:

  1. Basic Screen - A set of basic dialogs providing by the operating systems
  2. Custom Screens - Customizable screens that allow arbitrary flexibility

Custom screens only define an interface to a screen. The screen itself is externally created. The layout and functionality of this screen is not defined in the OTX. The interface to the screen is the OTX Screen Signature. A Screen Signature defines all IN-, OUT- and INOUT-Parameters of a screen. The OTX Runtime have to map the Screen Signature Parameters to the proper screen controls. The OTF supports two kinds of Custom Screens:

  1. Generic Screen
  2. Screen Mapping

Screen Mapping

In principal the Screen Mapping bounds the properties of controls found in a form of an Windows Forms Library (.NET assembly *.dll or *.exe) to OTX Screen Signature Parameters via Data Binding. In opposite to the Generic Screen, which is completely generic, easy to use but limited, the Screen Mapping is not limited related to the layout or the used controls.

To apply the screen mapping, the following steps have to be performed:

  1. Create Windows Forms Library
  2. Create a Screen Mapping file via the Screen Mapping Editor
  3. Select the Screen Mapping file in the runtime settings of the project

Create Windows Forms Library

For the Screen Mapping the user have to create an executable application (*.exe) or an assembly (*.dll) with one or more Windows Forms. This job can be done graphically with the Windows Forms Designer and Windows Presentation Foundation of Microsoft Visual Studio or with free Forms Designer of SharpDevelop. All controls found in that form can be bound to Screen Signature Parameters via the Screen Mapping Editor, see below. The form can contain arbitrary program logic or can be just a form with controls and without internal logic.

Create mapping file via Screen Mapping Editor

The "Screen Mapping Editor" dialog box and the "Signature/Screen-Mapping" dialog box

To create a Screen Mapping file, please proceed as follows:

  1. Open Project Settings "HMI" tab
  2. Click on the "New" button.
  3. In the "1. Step*" section, click "Add*" button.
  4. Select a screen signature in the "1. Step**" section and select the Windows Forms Library (.NET assembly *.dll or *.exe) in the "2. Step**" section.
  5. If there is no library has been added before, click "Add" button in the "2. Step**" section, find and select an library (*.dll or *.exe) and click "Open" button.
  6. If the loaded application is a WPF form, you have to select "WPF Window" in the "Screen Type" drop-down list.
  7. Click "OK**" button.
  8. After that, click "Add*" button in the "Step 2*" section.
  9. In the new row, click on the drop-down list in the first cell and select a screen parameter.
  10. Continue to select a value for the application control, the property and the event.
  11. Click "OK*" button.
  12. Enter the name for the new screen mapping file and click "OK" button.

To edit a screen mapping file, select the screen mapping file and click the "Edit" button or just double-click on the screen mapping file.

To delete a screen mapping file, select the screen mapping file and click the "Delete" button.

Select the mapping file in project settings

To use the screen mapping file, please select it in the "Runtime Environment" page of project settings or in the "Runtime Environment" tab of the Ribbon.

Data Bound Component

Via the Screen Mapping Editor only simple Controls can be managed. Simple means, that the property which should be bound, should be

If this is not the case, the DataBoundComponent should be used. The DataBoundComponent is a Windows Forms Control from emotive, which can inserted into any form and can be used as a transmitter of arbitrary data types between the OTX-Runtime and the Windows Forms application.

Exclamation.png Important: The DataBoundComponent is located in the Emotive.Otf.Runtime assembly. Before the component can be used a reference to that assembly shall be added to project.

The DataBoundComponent supports a property

public object Data (get/set) 

and an event

public event EventHandler DataChanged

Both can be bound to OTX Screen Signature Parameters via Data Binding. The property contains the value and the event notifies about changes in OTX.

Assembly Screen Mapping

In principal, the Assembly Screen Mapping bounds the properties of controls found in a form of a Windows Forms Library (.NET assembly *.dll or *.exe) to OTX Screen Signature Parameters via Data Binding. A Screen Signature can be created by the reflection of such assembly.

To apply the screen mapping, the following steps have to be performed:

  1. Create Windows Forms Library
  2. Create a Screen Mapping file from Assembly via the Assembly Screen Mapping Editor.
  3. Select the Screen Mapping file in the runtime settings of the project

Create Windows Forms Library

Users first have to create an assembly (*.dll) with one or more Windows Forms for the Screen Mapping. This job can be done graphically with the Windows Forms Designer and Windows Presentation Foundation of Microsoft Visual Studio or with free Forms Designer of SharpDevelop. All controls found in that form can be bound to Screen Signature Parameters via the Screen Mapping Editor, see below. The form can contain arbitrary program logic or can be just a form with controls and without internal logic.

Create a Screen Mapping file from Assembly via the OTX Mapping Editor

Image01: The "OTX Mapping Editor" dialog box
Image02: The "OTX Mapping Editor" dialog box after some mapping are created

To add Assembly Screen Mapping file, please proceed as follows:

  1. Open Project Settings "OTX-Mapping" tab
  2. Click on "New Assembly Screen Mapping" button
  3. A screen Assembly Screen Mapping Editor with 2 panels appears (see 'Image 1'):
    1. Panel 1: Select NameSpace of App-ID: This panel contains all the classes loaded from the assemblies registered in the current project.
    2. Panel 2: Select OTX Document, click "Assign" button and select methods: This panel contains all the available OTX documents in the current project, all the existing Screen Signatures in each document will be displayed.
  4. There are 2 cases when creating screen mapping:
    1. Creating screen mapping between some classes in an assembly and an OTX document: Select the classes to create mapping in the 'Panel 1' (select many classes by using CTRL key or SHIFT key), and continue to select the OTX Document in the 'Panel 2', then click on the Arrow ("AddMapping.PNG") button to add mapping between the selected classes and the OTX document. The new Screen Signatures corresponding to the mapped classes will be created in the OTX document (*).
    2. Creating screen mapping between a class in an assembly and an existing Screen Signature: Select the class to create mapping in the 'Panel1' and select an existing Screen Signature, then click on the Arrow ("AddMapping.PNG") button to add mapping between the selected class and the Screen Signature.
  5. To delete mappings, please select the screens with mappings to be deleted (select many screens by using CTRL key or SHIFT key) and click the "X" button (See "Image02"). Please note that if we delete mappings of the new screens created from add mappings (*), the newly created screens are also deleted.
  6. Implement mapping parameters between Screen Signature Project and Screen Signature Assembly. You just choise in Combobox to mapping. Each elements name and type will be mapped to the related OTX name and datatype.
  7. The user can select zero or more Screen Signature, The user have to select one or more "ScreenSignatureParameters"... .
  8. After completing, Click "OK" button.
  9. Enter the name for the new screen mapping file and click "OK" button.

To edit a Assembly screen mapping file, select the screen mapping file and click the "Edit" button or just double-click on the screen mapping file.

To delete a screen mapping file, select the screen mapping file and click the "Delete" button.

Select the mapping file in project settings

To use the screen mapping file, please select it in the "Runtime Environment" page of project settings or in the "Runtime Environment" tab of the Ribbon.

Datatypes Mapping

  • SimpleType
  • ByteField
  • List
  • Map
  • Structure

List, Map and Structure can only contain one of the listed datatypes in any depth.

Runtime Implementation