/// <summary> /// Copies the cancellation status from <paramref name="sourceEvent"/> to <paramref name="targetEvent"/> and vice-versa. /// </summary> /// <param name="sourceEvent">Already triggered event.</param> /// <param name="targetEvent">Target event where the resulting cancellation should be copied to and from after publishing.</param> protected void WrapCancellableEvent(ICancellableEvent sourceEvent, ICancellableEvent targetEvent) { targetEvent.Cancelled = sourceEvent.Cancelled; this.eventAggregator.Publish(targetEvent); sourceEvent.Cancelled = targetEvent.Cancelled; }
void Distribute(ICancellableEvent e, IEnumerable <object> targets) { foreach (var component in targets.OfType <IComponent>()) { if (!e.Propagating) { break; } component.Receive(e, this); } }
void Distribute(ICancellableEvent e, IList <Selection> hits) { foreach (var hit in hits) { if (!e.Propagating) { break; } var component = hit.Target as IComponent; component?.Receive(e, this); } }
public MessageHandlerResult HandleMessage(Message request) { IClient client = clientRepository.GetByID(request.clientId); ICancellableEvent subscribingEvent = PublishSubscribingEvent(request, client); if (subscribingEvent.Cancel) { Message subscriptionFailedResponse = GetSubscriptionFailedResponse(request, subscribingEvent.CancellationReason); return(new MessageHandlerResult { Message = subscriptionFailedResponse, CanTreatAsLongPoll = false }); } client.SubscribeTo(request.subscription); PublishSubscribedEvent(request, client); return(new MessageHandlerResult { Message = GetSubscriptionSucceededResponse(request), CanTreatAsLongPoll = false }); }
protected object EmitCancellableReturnsObject(ICancellableEvent @event) { Emit(@event); return(@event.IsCancelled ? new object() : null); }
protected bool EmitCancellableReturnsBool(ICancellableEvent @event) { Emit(@event); return([email protected]); }