C#

www.altova.com Imprimir este apartado Página anterior Subir un nivel Página siguiente

Inicio >  Referencia del programador > The UModel API > API Usage Examples >

C#

To help you get started, your UModel package contains an example C# project, which is located at C:\Users\<username>\Documents\Altova\UModel2019\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();
MessageBox.Show(String.Format("Hello from UModel API version {0}.{1}", um.APIMajorVersion, um.APIMinorVersion));

 

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

umapi_cs_example3

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.


© 2019 Altova GmbH