Up Previous Next Title Page Contents

4.1.1 Visual Debugging with C#

As explained in Section 2.6, the visual debugging employs the MetaEdit+ API to access the models during the application execution. To make this possible, a few additions on the code generator side are required. First we need the following three additions to ensure that we have a working connection to the API and the required information to make the animation calls:
1)Master init: initializes the variable holding a port on the MetaEditAPI SOAP service
2)AbstractWatchApplication constructor: makes an MEOop reference for this graph
3)AbstractWatchApplication addStateOop: makes an MEOop reference for this state object

The MEOop mentioned above is a data type for a variable holding a reference to a model instance in MetaEdit+. For more information about API-specific data types and the API in general, please refer to the Section 8 in ‘MetaEdit+ Workbench User’s Guide’.

To make the actual animation calls to MetaEdit+, a further set of three additions are needed:
1)AbstractWatchApplication handleEvent: handles the event of moving to a new state, calls animate
2)AbstractWatchApplication animate: calls Master animate with the graph and state MEOop
3)Master animate: calls port.animate

These are the modification required for the generated C# code. However, the Autobuild process itself also requires a few modifications. To be able to establish the connection with MetaEdit+ API, two things are needed: a Web Service Description Language (WSDL) file that defines the interface for the available API commands and a running API server at MetaEdit+’s end. Both of these needs are fulfilled by the ‘_prebuild for C#: API’ subgenerator by internally executing a few MetaEdit+ start-up commands. It will first use saveWSDL: to write out the WSDL file and ensure that the API server is running by executing stopAPI and startAPI.

Finally, the build process and C# project file must be changed to link in the SOAP framework that will interface the C# code with the MetaEdit+ API. The vs.bat file is augmented with commands that take care of building the SOAP interface for C# from the generated WSDL file. Alternatively, if the SvcUtil.exe required for this build is not present, the batch file will use a minimum interface implementation using specially generated miniapi.cs and miniapi.config files. Building the SOAP interface methods will result in a set of new files that must be included into the C# project file definition by the ‘_create Visual studio csproj-API file’ subgenerator.

Up Previous Next Title Page Contents