Search IModuleListener - Zero Results
Search IMC - Zero Results
Search InterModuleCommunication - Zero results
Search Inter Module Communication - Zero Results....
Can someone post a
working sample in latest version of DNN? I am using 5.6 and although there are some sketch reports out there saying this is working, I cannot seem to get the listener to fire based on other samples.
View.ascx
<%@ Register src="Sender.ascx" tagname="Sender" tagprefix="uc2" %>
<%@ Register src="Listener.ascx" tagname="Listener" tagprefix="uc1" %>
Sender: <br />
<uc2:Sender ID="Sender1" runat="server" />
Listener: <br />
<uc1:Listener ID="Listener1" runat="server" />
Sender.ascx.vb
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Entities.Modules.Communications
Public Class Sender
Inherits PortalModuleBase
Implements IModuleCommunicator
Public Event ModuleCommunication(ByVal sender As Object, ByVal e As Entities.Modules.Communications.ModuleCommunicationEventArgs) Implements Entities.Modules.Communications.IModuleCommunicator.ModuleCommunication
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim mcArgs As ModuleCommunicationEventArgs _
= New ModuleCommunicationEventArgs()
mcArgs.Sender = "SampleCommunicatorModule - VB"
mcArgs.Target = "Arbitrary Text"
mcArgs.Text = "Your Payload Text"
mcArgs.Type = "Your Custom Type"
Dim xmlDoc As System.Xml.XmlDocument = New System.Xml.XmlDocument()
xmlDoc.Load(Server.MapPath("DesktopModules/MyModule2/doc.xml"))
mcArgs.Value = xmlDoc
RaiseEvent ModuleCommunication(Me, mcArgs)
End Sub
End Class
Listener.ascx.vb
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Entities.Modules.Communications
Public Class Listener
Inherits PortalModuleBase
Implements IModuleListener
Sub OnModuleCommunication(ByVal s As Object, _
ByVal e As ModuleCommunicationEventArgs) _
Implements IModuleListener.OnModuleCommunication
If e.Target = "Pizza Inspectors" Then
If e.Text.ToLower.Contains("garlic") Then
Label1.Text = "Garlic Detected In Pizza!"
End If
End If
End Sub
End Class