Example #1
0
        private void Receive()
        {
            Message message = null;

            while (!_requestStop)
            {
                message = _transceiver.Receive();
                if (message != null)
                {
                    switch (message.Code)
                    {
                    case (Int32)SystemMessageCode.TaskOverEvent:
                    {
                        Terminate();
                        TaskOverEventArgs args = message.GetContent <TaskOverEventArgs>();
                        OnTaskOver(args);
                    }
                    break;

                    case (Int32)SystemMessageCode.ActivatorErrorEvent:
                    {
                        Terminate();
                        ActivatorErrorEventArgs args = message.GetContent <ActivatorErrorEventArgs>();
                        OnActivatorError(args);
                    }
                    break;

                    default:
                        ReceiveCallback?.Invoke(message);
                        break;
                    }
                }
            }
        }
Example #2
0
 /// <summary>
 /// 触发任务激活器错误事件。
 /// </summary>
 /// <param name="args">事件参数。</param>
 private void OnActivatorError(ActivatorErrorEventArgs args)
 {
     ActivatorError?.Invoke(this, args);
 }