Click or drag to resize

How to use your own HMI implementations

Via the OTX-Runtime API it is possible to use a customer specific HMI implementation. Doing this, the user can display its own Graphical User Interface (GUI), with an own layout, an own design and an own behavior.

The following table lists all related OTX elements with its counterpart in the API:

OTX

API

ConfirmDialog

ConfirmDialogOccurred Event

InputDialog

InputDialogOccurred Event

ChoiceDialog

ChoiceDialogOccurred Event

ShowDocumentDialog

ShowDocumentDialogOccurred Event

OpenScreen

OpenScreenOccurred Event

HighlightScreen

HighlightScreenOccurred Event

To use this event the OpenScreenOccurred event shall be be also registered.

CloseScreen

CloseScreenOccurred Event

To use this event the OpenScreenOccurred event shall be be also registered.

ScreenIsOpen

ScreenIsOpenOccurred Event

To use this event the OpenScreenOccurred event shall be be also registered.

In/Out-Parameter Handling

ParameterValueChanged Event

To reflect changes of ScreenInOutParameter

ScreenClosedEventSource

RaiseScreenClosedEvent Method

To signal that the own screen is closed (add an event to the ScreenCloseEventSource)

Example
Simple example to use an own implementation for ConfirmDialog activity.
C#
this.rtManager.ConfirmDialogOccurred += new OpenTestSystem.Otx.Runtime.Api.Event.ConfirmDialogOccurredHandler(rtManager_ConfirmDialogOccurred);

void rtManager_ConfirmDialogOccurred(string title, string message, MessageTypes messageType, out ConfirmationTypes result)
{
    result = ConfirmationTypes.YES;
    MessageBoxIcon icon;
    MessageBoxButtons button;
    switch (messageType)
    {
        case MessageTypes.INFO:
            icon = MessageBoxIcon.Information;
            button = MessageBoxButtons.OK;
            break;
        case MessageTypes.WARNING:
            icon = MessageBoxIcon.Warning;
            button = MessageBoxButtons.OK;
            break;
        case MessageTypes.ERROR:
            icon = MessageBoxIcon.Error;
            button = MessageBoxButtons.OK;
            break;
        case MessageTypes.YESNO_QUESTION:
            icon = MessageBoxIcon.Question;
            button = MessageBoxButtons.YesNo;
            break;
        case MessageTypes.YESNOCANCEL_QUESTION:
            icon = MessageBoxIcon.Question;
            button = MessageBoxButtons.YesNoCancel;
            break;
        default:
            icon = MessageBoxIcon.Information;
            button = MessageBoxButtons.OK;
            break;
    }

    switch (MessageBox.Show("Self generated ConfirmDialog:\n\n" + message, title, button, icon))
    {
        case System.Windows.Forms.DialogResult.OK:
        case System.Windows.Forms.DialogResult.Yes:
            result = ConfirmationTypes.YES;
            break;
        case System.Windows.Forms.DialogResult.No:
            result = ConfirmationTypes.NO;
            break;
        case System.Windows.Forms.DialogResult.Cancel:
            result = ConfirmationTypes.CANCEL;
            break;
    }

    this.AddOutputRow(string.Format("ConfirmDialogOccurred({0}, {1}, {2}, out {3})", title, message, Enum.GetName(typeof(Types.MessageTypes), messageType), Enum.GetName(typeof(Types.ConfirmationTypes), result)));
}
Simple example for In/Out-Parameter handling.
C#
rtManager.ParameterValueChanged += new OpenTestSystem.Otx.Runtime.Api.Event.ParameterValueChangedHandler(rtManager_ParameterValueChanged);

void rtManager_ParameterValueChanged(IParameter parameter, OpenTestSystem.Otx.Runtime.Api.Otx.IProcedure procedure)
{
    this.AddOutputRow("ParameterValueChanged(" + procedure.Name + ", " + parameter.Name + ", " + (parameter is InOutParameter ? (parameter as InOutParameter).Value.ToString() : (parameter as OutParameter).Value.ToString()) + ")");
    this.UpdateGridviewParameter(procedure);
}