dnn中模块间的通讯机制

来源:互联网 发布:提问的软件 编辑:程序博客网 时间:2024/04/30 08:48

 

1.发送页面:

继承DotNetNuke.Entities.Modules.Communications.IModuleCommunicator
public event ModuleCommunicationEventHandler ModuleCommunication;

 ModuleCommunicationEventArgs oArgs = new ModuleCommunicationEventArgs();
oArgs.Text = rootId;    //传递值
oArgs.Sender = "Sender";
oArgs.Target = "me";  //传递标志
if (ModuleCommunication != null)
    ModuleCommunication(this, oArgs);
2.接收页面:
继承 DotNetNuke.Entities.Modules.Communications.IModuleListener
 public void OnModuleCommunication(object s, ModuleCommunicationEventArgs e)
{
    if (e.Target == "me")
    {
        //接收变化
       Response.Write(e.Text);
     }
}

原创粉丝点击