hello,
in 2012 i have a ribbon with commands being loaded from a separated dll.
in 2013 i can't get it to work anymore.
2012 code, for 2013 i changed acad.exe to accore.dll
my ribbon shows up fine, all local commands work like they should, only the commands being loaded from a separated dll don't.
in 2012 all works fine.
Public Class AdskCommandHandler
Implements System.Windows.Input.ICommand
<DllImport("acad.exe")> _
Private Shared Sub acedPostCommandPrompt()
End Sub
Public Function CanExecute(ByVal parameter As Object) As Boolean Implements System.Windows.Input.ICommand.CanExecute
Return True
End Function
Public Event CanExecuteChanged As EventHandler Implements System.Windows.Input.ICommand.CanExecuteChanged
Public Sub Execute(ByVal parameter As Object) Implements System.Windows.Input.ICommand.Execute
Dim ribBtn As RibbonButton = TryCast(parameter, RibbonButton)
If ribBtn IsNot Nothing Then
Dim sCmd As String = String.Empty
Dim sSubCmd As String = String.Empty
Dim bLoadAssy As Boolean = False
If ribBtn.CommandParameter.ToString.IndexOf("|").CompareTo(-1) Then
Dim cmdParams() As String = ribBtn.CommandParameter.ToString.Split("|")
sCmd = cmdParams(0)
sSubCmd = cmdParams(1)
bLoadAssy = True
Else
sSubCmd = ribBtn.CommandParameter
End If
If bLoadAssy Then LoadAssembly(sCmd)
acApp.DocumentManager.MdiActiveDocument.SendStringToExecute(sSubCmd, True, False, True)
End If
End Sub
Private Shared Sub LoadAssembly(ByRef AssemblyName As String)
Dim app_Path As String = My.Application.Info.DirectoryPath & "\Tools\"
Dim oLoader As ExtensionLoader = Nothing
If Not ExtensionLoader.IsLoaded(app_Path & AssemblyName) Then
ExtensionLoader.Load(app_Path & AssemblyName)
acedPostCommandPrompt()
End If
End Sub
End Class
button that doesn't work, CommandParameter has the value of the dll and the command
the dll exists in the tools directory.
Dim ribbuttonbig3 As RibbonButton = New RibbonButton
ribbuttonbig3.IsToolTipEnabled = True
ribbuttonbig3.ToolTip = "save document metadata to sql"
ribbuttonbig3.Orientation = Windows.Controls.Orientation.Vertical
ribbuttonbig3.LargeImage = LoadImage(My.Resources.VSHDPD)
ribbuttonbig3.Size = RibbonItemSize.Large
ribbuttonbig3.Text = "Savetodpd"
ribbuttonbig3.CommandParameter = "DPD.dll|savetodpd "
ribbuttonbig3.ShowText = True
ribbuttonbig3.Image = LoadImage(My.Resources.VSHDPD16)
ribbuttonbig3.CommandHandler = New AdskCommandHandler()
any idea's?