Initialization
 
In VB.NET, you can create and assign an ActionListener class as follows.
Create a class implementing the listener in question. It should define all the inherited methods, even if you want to only execute code for a few of the listener methods. Those other methods should be implemented with an empty body.
The class should also implement the interface IpfcActionListener, which has no methods.
The class should also implement ICIPClientObject. This method defines the object type to the CIP code in the server. This method returns a String which is the name of the listener type interface, for example, IpfcSessionActionListener.
Private Class ModelEventListener
Implements IpfcModelEventActionListener
Implements ICIPClientObject
Implements IpfcActionListener

Public Function GetClientInterfaceName() As String _
Implements ICIPClientObject.GetClientInterfaceName
GetClientInterfaceName = "IpfcModelEventActionListener"
End Function
'======================================================================
'Function : OnAfterModelCopy
'Purpose : This method is executed after successfully
' copying a model.
'======================================================================
Public Sub OnAfterModelCopy(ByVal _FromMdl As
pfcls.IpfcModelDescriptor, ByVal _ToMdl As
pfcls.IpfcModelDescriptor) Implements
pfcls.IpfcModelEventActionListener.OnAfterModelCopy
'Method Body
End Sub
'======================================================================
'Function : OnAfterModelRename
'Purpose : This method is executed after successfully
' renaming a model.
'======================================================================
Public Sub OnAfterModelRename(ByVal _FromMdl As
pfcls.IpfcModelDescriptor, ByVal _ToMdl As
pfcls.IpfcModelDescriptor) Implements
pfcls.IpfcModelEventActionListener.OnAfterModelRename

'Method Body

End Sub

Public Sub OnAfterModelCopyAll(ByVal _FromMdl As
pfcls.IpfcModelDescriptor, ByVal _ToMdl As
pfcls.IpfcModelDescriptor) Implements
pfcls.IpfcModelEventActionListener.OnAfterModelCopyAll

End Sub

Public Sub OnAfterModelDelete(ByVal _Descr As
pfcls.IpfcModelDescriptor) Implements
pfcls.IpfcModelEventActionListener.OnAfterModelDelete

End Sub

Public Sub OnAfterModelErase(ByVal _Descr As
pfcls.IpfcModelDescriptor) Implements
pfcls.IpfcModelEventActionListener.OnAfterModelErase

End Sub

End Class
Was this helpful?