Udostępnij za pośrednictwem


DexRuntimeGetClientType()

The DexRuntimeGetClientType() function returns information about the runtime engine that is processing the application.

Syntax

DexRuntimeGetClientType()

Parameters

• None

Return value

An integer value indicating the client type.

Value

Description

1

The runtime engine for the desktop client.

2

The runtime engine for the web client.

0

The runtime engine that does not directly present a user interface, such as the Process Server.

Comments

This function is typically used when writing code that can be performed only for a specific client type.

Examples

The following C# example retrieves whether the code is being run on the desktop client or the web client. If it is running on the desktop client, the code launches the file in the location indicated by the value of the textBoxFile control. If the file indicated cannot be launched, an error dialog is displayed.

bool result;

if (Dynamics.Forms.SyVisualStudioHelper.Functions.DexRuntimeGetClientType
.Invoke() == 1)
{
    // Desktop client
    result = Dynamics.Forms.SyVisualStudioHelper.Functions.DexFileLaunch
    .Invoke(textBoxFile.Text, 1);

    if (result == false)
    {
        Dynamics.Forms.SyVisualStudioHelper.Functions.DexError
        .Invoke("Could not open file");
    }
}
else
{
    // Web client
    Dynamics.Forms.SyVisualStudioHelper.Functions.DexError
    .Invoke("Action not available");
}

The following Visual Basic example retrieves whether the code is being run on the desktop client or the web client. If it is running on the desktop client, the code launches the file in the location indicated by the value of the textBoxFile control. If the file indicated cannot be launched, an error dialog is displayed.

Dim result As Boolean

If (Dynamics.Forms.SyVisualStudioHelper.Functions.DexRuntimeGetClientType _
.Invoke() = 1) Then

    'Desktop client
    result = Dynamics.Forms.SyVisualStudioHelper.Functions.DexFileLaunch _
    .Invoke(TextBoxFile.Text, 1)

    If result = False Then
        Dynamics.Forms.SyVisualStudioHelper.Functions.DexError _
        .Invoke("Could not open file")
    End If
Else
    'Web client
    Dynamics.Forms.SyVisualStudioHelper.Functions.DexError _
    .Invoke("Action not available")
End If