C# Class Sym.EventsManager.MsgEvent

消息订阅-发布的操作类
ファイルを表示 Open project: GISMaster/MsgEvent

Public Methods

Method Description
Receive ( string msgType, EventHandler func, object receiver = null, bool isOnce = false ) : void

订阅消息

RemoveListener ( string msgType, EventHandler func, object receiver = null ) : void

移除消息的订阅

Send ( MsgEventArgs args, object sender = null ) : void

发送消息

Send ( string msgType, object data, object sender = null ) : void

发送消息

Method Details

Receive() public static method

订阅消息
public static Receive ( string msgType, EventHandler func, object receiver = null, bool isOnce = false ) : void
msgType string 信道ID
func EventHandler 用于处理接收到消息的方法
receiver object 订阅者对象,默认为null
isOnce bool 是否接收方法只处理一次,默认为false
return void

RemoveListener() public static method

移除消息的订阅
public static RemoveListener ( string msgType, EventHandler func, object receiver = null ) : void
msgType string 信道ID
func EventHandler 需要移除的接收消息处理方法
receiver object 订阅者对象,默认为null
return void

Send() public static method

发送消息
public static Send ( MsgEventArgs args, object sender = null ) : void
args MsgEventArgs 消息体对象
sender object 发送者对象
return void

Send() public static method

发送消息
public static Send ( string msgType, object data, object sender = null ) : void
msgType string 信道ID
data object 消息数据
sender object 发送者对象
return void