Esempio n. 1
0
        /// <summary>
        /// 发送消息
        /// 这里需要将消息和日志的级别处理区分开
        /// 日志记录级别来源于消息
        /// 消息提示可以通过内置界面和可扩展的自定义界面来显示,显示也区分级别,目前消息提示是框架中的功能
        /// </summary>
        public virtual void Send(MessageObject Msg)
        {
            if (Msg.Type > Protein.Enzyme.Layout.Configuration.ProteinConfig.GetInstance().MsgConfig.MessageLevel)
            {
                return;
            }
            if (this.Pcslist.Count == 0)
            {
                IProcessor pcs = new Processors.ProcessInnerExceptionLog(MachineLog.GetLogger());
                pcs.ProcessMessage(Msg);
            }
            ///
            int count = this.Pcslist.Count;

            for (int i = 0; i < count; i++)
            {
                if (i < this.Pcslist.Count)
                {
                    if (this.Pcslist[i] != null)
                    {
                        this.Pcslist[i].ProcessMessage(Msg);
                    }
                }
            }
            //foreach (IProcessor pcs in this.Pcslist)
            //{
            //    if (pcs != null)
            //    {
            //        pcs.ProcessMessage(Msg);
            //    }
            //}
        }
Esempio n. 2
0
        /// <summary>
        /// 初始化消息处理机构 添加支撑类库内置的日志系统消息处理器
        /// </summary>
        protected static void SetMessageBus()
        {
            //IMessageBus msgbus = MessageFactory.GetMegBus();
            // 异常处理  调试处理
            IProcessor error = new ProcessExceptionLog(MachineLog.GetLogger());

            msgbus.AddProcessor(error);
            //调试处理
            IProcessor dbug = new ProcessDebugLog(MachineLog.GetLogger());

            msgbus.AddProcessor(dbug);
            ////Pt调试处理
            //IProcessor ptdbug = new ProcessPtDebug(MachineLog.GetLogger());
            //msgbus.AddProcessor(ptdbug);
            ////警告提示处理
            //IProcessor remind = new ProcessWarning();
            //msgbus.AddProcessor(remind);
            //系统内部消息处理
            IProcessor sysinfo = new ProcessSysInfo(MachineLog.GetLogger());

            msgbus.AddProcessor(sysinfo);
            //历史记录
            IProcessor history = MessageHistoryContainer.GetInstance();

            msgbus.AddProcessor(history);
            ////普通提示消息处理
            //IProcessor noteinfo = new ProcessNote();
            //msgbus.AddProcessor(noteinfo);
        }