Пример #1
0
        protected override InterceptionAction InterceptCore(Message messageData)
        {
            SelectedModelObjectChanged modelObjectChanged = messageData.Get <SelectedModelObjectChanged>();
            object lastSelected = Interlocked.Exchange(ref lastModelObject, modelObjectChanged.SelectedObject);

            if (lastSelected == modelObjectChanged.SelectedObject)
            {
                //do not bounce back and forth
                return(InterceptionAction.Continue);
            }
            switch (modelObjectChanged.SelectionSource)
            {
            case SelectionSource.Graph:
                SelectTreeObjectRequested.Decorate(messageData.Get <SelectedModelObjectChanged>());
                break;

            case SelectionSource.Tree:
                SelectGraphObjectRequested.Decorate(messageData.Get <SelectedModelObjectChanged>());
                break;

            case SelectionSource.Internal:
            default:
                SelectTreeObjectRequested.Decorate(messageData.Get <SelectedModelObjectChanged>());
                SelectGraphObjectRequested.Decorate(messageData.Get <SelectedModelObjectChanged>());
                break;
            }
            return(InterceptionAction.Continue);
        }
 public static SelectTreeObjectRequested Decorate(SelectedModelObjectChanged decoratedMessage,
                                                  IEnumerable <Message> additionalPredecessors = null)
 {
     return(new(decoratedMessage, additionalPredecessors));
 }