Ejecutar Funciones Add-In [Guía de Usuario de Enterprise Architect] |
Top |
Otra funcionalidad que puede proporcionar para soportar usuarios de su tecnología es ejecutar funciones Add-In desde una página de Centro de Aprendizaje. Usted define cada función utilizando un atributo en el elemento de Estereotipos del Centro de Aprendizaje, el atributo teniendo el formato : "Assembly::FunctionName()"
Assembly es el nombre del Add-In y FunctionName es el nombre de la función pública para ejecutar, dentro del Add-In. Escriba el texto que debe aparecer en la página de Centro de Aprendizaje en el campo Valor Inicial del atributo. Ejemplo Esta función está escrita bajo VB.Net:
Public Function ShowMyDiagram(ByRef Repository As EA.Repository, ByVal args As Object) As String Dim ret As String ret = Repository.SQLQuery("select ea_guid from t_diagram where diagram_type='Custom' and styleex like '*;MDGDgm=MyDiagrams::MyCustomDiagram;*'") If ret Is Nothing Then ShowMyDiagram = False Exit Function End If
Dim oXML As MSXML2.DOMDocument = New MSXML2.DOMDocument oXML.loadXML(ret)
Dim NodeList As MSXML2.IXMLDOMNodeList = oXML.selectNodes("//ea_guid") If NodeList.length = 0 Then ShowMyDiagram = False Exit Function End If
Dim Node As MSXML2.IXMLDOMNode Dim diag As EA.Diagram If NodeList.length >= 1 Then Node = NodeList.item(0) diag = Repository.GetDiagramByGuid(Node.text) Repository.OpenDiagram(diag.DiagramID) Repository.ShowInProjectView(diag) End If
ShowMyDiagram = True End Function
Aprender más |