Hallo,
jetzt habe ich doch noch einmal eine Frage:
Den Menupunkt habe ich erstellt. Jetzt will ich dazu eine eigene Action definieren. Ich erzeuge in dem Addin eine Action-Klasse
z.B:
Imports System
Imports Eplan.EplApi.ApplicationFramework
Public Class Action1
Implements IEplAction
Public Function Execute(ByVal ctx As ActionCallingContext) As Boolean Implements IEplAction.Execute
System.Windows.Forms.MessageBox.Show("Action1 wurde aufgerufen!")
Return True
End Function
Public Function OnRegister(ByRef Name As String, ByRef Ordinal As Integer) As Boolean Implements IEplAction.OnRegister
Name = "Action1"
Ordinal = 20
Return True
End Function
Public Sub GetActionProperties(ByRef actionProperties As ActionProperties) Implements IEplAction.getActionProperties
actionProperties.Description = "Beschreibung von Action1"
End Sub
End Class
Dann füge ich folgendes unter OnInit ein:
Public Function OnInit() As Boolean Implements IEplAddIn.OnInit
Dim strAction As String = "Action1"
Dim oAMnr As New ActionManager()
Dim oAction As Action = oAMnr.FindAction(strAction)
If Not (oAction Is Nothing) Then
Dim ctx As New ActionCallingContext()
Dim bRet As Boolean = oAction.Execute(ctx)
If bRet Then
System.Windows.Forms.MessageBox.Show(("The Action " + strAction + " ended successfully!"))
Else
System.Windows.Forms.MessageBox.Show(("The Action " + strAction + " ended with errors!"))
End If
End If
Return True
End Function
Beim Starten findet er aber die "Action1" nicht (oAction ist Nothing), als ob sie nicht registriert wäre.
Was mache ich da falsch!
------------------
Gruß weinel
[Diese Nachricht wurde von weinel am 10. Dez. 2008 editiert.]
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP