C# API Examples
To help you get started, your UModel package contains an example C# project, which is located at C:\Users\<username>\Documents\Altova\UModel2025\UModelExamples\API.
Importantly, this example project includes a reference to the UModel Type Library, see How to Reference the UModel Type Library. A reference to the UModel Type Library is required in each project where you need the UModel API. This makes it possible to instantiate the main application object from your code as follows:
UModelLib.Application um = new UModelLib.Application(); |
Si tiene un sistema operativo de 64 bits pero está usando una versión de UModel para 32 bits, agregue la plataforma x86 al gestor de configuraciones de la solución y compile la muestra usando esta configuración. Para acceder al gestor de configuraciones, ejecute el comando de menú Compilar | Administrador de configuración.
The example application displays a Windows form with buttons that invoke basic UModel operations:
•Start UModel
•Open Bank_MultiLanguage.ump
•Open All Diagrams
•Generate documentation for the currently active document
•Shows how to listen to UModel events (OnDocumentOpened Event On/Off)
•Shutdown UModel
The code essentially consists of a series of handlers for the buttons in the user interface shown above. Note that you may need to adjust the path to the UModel examples folder which is referenced from the code.