|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using BPASmartClient.MessageCommunication.MsgControl;
- using System;
-
- namespace BPASmartClient.MessageCommunication
- {
- /// <summary>
- /// 该类实现客户端构件间消息的传递,底层使用整编的构件消息API
- /// 创建人:奉友福
- /// 创建时间:2022-04-18
- /// Class_InnerMessageBus.GetInstance.ListenMessage(this, MessageName.xxname, "xxnameHandler");
- /// Class_InnerMessageBus.GetInstance.PostMessage(this, MessageName.xxname, "12321");
- /// public void xxnameHandler(object sender, InnerMessageEventArgs e) { }
- /// </summary>
- public class Class_InnerMessageBus
- {
- public static Class_InnerMessageBus _MessageBus = null;
- static InnerMessageBus Bus = null;
- public static Class_InnerMessageBus GetInstance
- {
- if (_MessageBus == null)
- {
- _MessageBus = new Class_InnerMessageBus();
- Bus = new InnerMessageBus();
- }
- return _MessageBus;
- }
-
- /// <summary>
- /// 监听消息方法
- /// </summary>
- /// <param name="sender">订阅消息构件</param>
- /// <param name="str_MessageString">消息名称</param>
- /// <param name="str_MessageName">接收消息后回调处理函数 注意:该函数必须为Public</param>
- public void ListenMessage(object sender,string str_MessageString,string str_MessageName)
- {
- Bus.ListenMessage(sender,str_MessageString,str_MessageName);
- }
-
- /// <summary>
- /// 消息发送函数
- /// </summary>
- /// <param name="sender">发送消息构件</param>
- /// <param name="str_Msg">消息名称</param>
- /// <param name="obj_Data">消息体</param>
- public void PostMessage(object sender,string str_Msg,object obj_Data)
- {
- Bus.PostMessage(sender,str_Msg,obj_Data);
- }
-
- /// <summary>
- /// 移除消息方法
- /// </summary>
- /// <param name="str_MessageString">消息名称</param>
- /// <param name="str_处理方法名称">接收消息后回调处理函数</param>
- public void RemoveMessage(string str_MessageString,string str_MessageName)
- {
- Bus.ListenMessage_trunOff(str_MessageString,str_MessageName);
- }
-
- public int GetdRountCount()
- {
- return Bus.__Debug_RoutTable.Count;
- }
- }
- }
|