コード例 #1
0
        public void Handler()
        {
            try
            {
                byte[] bytmsg = new byte[1024];
                int    bytes  = clientSocket.Receive(bytmsg);
                string strMsg = Encoding.UTF8.GetString(bytmsg, 0, bytes);

                if (strMsg == "stop")
                {
                    return;
                }

                MsgRecordModel msgModel = UnboxMsg(strMsg);

                if (string.IsNullOrEmpty(msgModel.ObjectID))
                {
                    return;
                }

                if (string.IsNullOrEmpty(msgModel.Content))
                {
                    IFindMsgRecord           findMsgRecord = ObjectContainerFactory.CurrentContainer.Resolver <IFindMsgRecord>();
                    ParameterizedThreadStart threadStart   = new ParameterizedThreadStart(findMsgRecord.findMsg);
                    Thread thread = new Thread(threadStart);
                    thread.Start(msgModel.ObjectID);
                }
                else if (!string.IsNullOrEmpty(msgModel.Content))
                {
                    IHandleSendMsg           handleSendMsg = ObjectContainerFactory.CurrentContainer.Resolver <IHandleSendMsg>();
                    ParameterizedThreadStart threadStart   = new ParameterizedThreadStart(handleSendMsg.Handler);
                    Thread thread = new Thread(threadStart);
                    thread.Start(msgModel);
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #2
0
        public void Start()
        {
            IFindMsgRecord findMsgRecord = ObjectContainerFactory.CurrentContainer.Resolver <IFindMsgRecord>();

            findMsgRecord.findMsg();
        }