I've been following Yongan Fu's "Learning MicroStation Addins Step by Step" instructions for creating a MS Addin. Got the C# version running with no problems.
Also trying to do it in VB .NET but am having trouble with the commands being validated by UstnXOM Validate addin utility. Everything appears to be correct but it can not find the functions defined in the command xml file.
Here is my main vb code:
Imports System.Windows.Forms
Namespace vbAddins
<Bentley.MicroStation.AddInAttribute(KeyinTree:="vbAddins.commands.xml", MdlTaskId:="VBADDINS")> _
Friend NotInheritable Class MyAddin
Inherits Bentley.MicroStation.AddIn
Private Sub New(mdlDesc As System.IntPtr)
MyBase.New(mdlDesc)
End Sub
Protected Overrides Function Run(commandLine As String()) As Integer
MsgBox("VB GO")
Return 0
End Function
End Class
End Namespace
Here is the code for the command:
Imports Bentley.MicroStation.InteropServices
Imports Bentley.Interop.MicroStationDGN
Namespace vbAddins
Class CreateElement
Public Shared Sub PopUpMessage()
MsgBox("Inside Command")
End Sub
End Class
End Namespace
Here's my xml file: (named: commands.xml)
<?xml version="1.0" encoding="utf-8" ?>
<KeyinTree xmlns="http://www.bentley.com/schemas/1.0/MicroStation/AddIn/KeyinTree.xsd">
<RootKeyinTable ID="root">
<Keyword SubtableRef="CreateElement" CommandClass="MacroCommand" CommandWord="vbAddins" >
<Options Required ="true"/>
</Keyword>
</RootKeyinTable>
<SubKeyinTables>
<KeyinTable ID="CreateElement">
<Keyword SubtableRef="Commands" CommandWord="CreateElement">
<Options Required ="true"/>
</Keyword>
</KeyinTable>
<KeyinTable ID="Commands">
<Keyword CommandWord="PopUpMessage"> </Keyword>
</KeyinTable>
</SubKeyinTables>
<KeyinHandlers>
<KeyinHandler Keyin="vbAddins CreateElement PopUpMessage" Function="vbAddins.CreateElement.PopUpMessage"/>
</KeyinHandlers>
</KeyinTree>
Here's the output from the validator:
Validating VBADDINS AddIn: vbAddins.vbAddins.MyAddin
vbAddins.commands.xml is well-formed and schema valid against KeyinTree.xsd
static method vbAddins.CreateElement.PopUpMessage not found for keyin "vbAddins CreateElement PopUpMessage"