Ejemplo n.º 1
0
        public void OnPost(Message message)
        {
            switch (message.Kind)
            {
            case MessageKind.Add:
                Context.Add(message.Clause);
                Expert.OnPost(this, message);
                break;

            case MessageKind.Remove:
                Context.Remove(message.Clause);
                Expert.OnPost(this, message);
                break;

            case MessageKind.Modify:
                Clause replacedClause = Context.Modify(message.Clause);
                if (replacedClause != null)
                {
                    Expert.OnPost(this, new Message(MessageKind.Remove, null, null, replacedClause));
                }
                Expert.OnPost(this, new Message(MessageKind.Add, null, null, message.Clause));
                break;

            case MessageKind.Callback:
                MessageCallback callback = (MessageCallback)message.Clause.Object;
                callback(this, Expert, message);
                break;

            default:
                Expert.OnPost(this, message);
                break;
            }
            //Expert.OnPost(this, message);
        }
Ejemplo n.º 2
0
 public void OnPost(Process process, Message message)
 {
     foreach (Trigger trigger in MatchTrigger(message))
     {
         trigger.Callback(process, this, message);
     }
     if (Parent != null)
     {
         Parent.OnPost(process, message);
     }
 }