Sample: Managed Dialog System Application

The Managed Customer sample ManagedCustomer.sln is broadly the original Customer sample that was supplied with Dialog System. The key difference with this sample is that it is compiled to managed code and run under .NET. The existing Dialog System run-time calls remain but are automatically converted to Platform Invoke calls into the native code. In other words, the user interface and screensets are all still running as native code. The following diagram illustrates this.

This sample is using the Platform Invoke technique, which enables managed code to call unmanaged functions implemented in dynamic link libraries (.dlls). Platform invoke is similar to an API call.

The sample has just one project, a managed code project, comprising:

Customer.cbl

Customer.cbl contains the original code for the business logic and for interaction with the Dialog System screenset.

The only change to Customer.cbl is to ensure that the managed code calls the native Dialog System run-time system correctly. The code must supply all the parameters that Dialog System might need (or at least signify that we are not passing all the parameters). The original Customer sample uses only two parameters, so the code here needs to add a third parameter as 'omitted'.

  Call-Dialog-System SECTION.
      CALL dialog-system USING ds-control-block,
                               customer-data-block
                               omitted