Ejemplo n.º 1
0
 /// <summary>
 /// This protected virtual method raises the
 /// <see cref="IRequestComposition{TTarget}.CompositionRequested"/>
 /// event.
 /// </summary>
 /// <param name="participant">Optional parameter for a new
 /// <see cref="RequestCompositionEventArgs{TTarget}"/>: notice that if this is not null,
 /// the <paramref name="request"/> must be set..</param>
 /// <param name="request">Optional parameter for a new
 /// <see cref="RequestCompositionEventArgs{TTarget}"/>.</param>
 protected virtual void RaiseCompositionRequested(
     IComposerParticipant <ContainerConfiguration> participant = null,
     RequestCompositionEventArgs <ContainerConfiguration> .ParticipantRequest request
     = RequestCompositionEventArgs <ContainerConfiguration> .ParticipantRequest.None)
 => CompositionRequested?.Invoke(
     this,
     participant != null
                                                 ? new RequestCompositionEventArgs <ContainerConfiguration>(participant, request)
                                                 : new RequestCompositionEventArgs <ContainerConfiguration>());
Ejemplo n.º 2
0
 /// <summary>
 /// Raises this <see cref="CompositionRequested"/> event with the given
 /// <paramref name="participantEvent"/>. Note that this method is invoked by
 /// <see cref="HandleParticipantCompositionRequested"/>, which will invoke this
 /// with the actual event raised by a participant added here; and such an
 /// event also has the optional callback from the participant.
 /// </summary>
 /// <param name="participantEvent">An event raised by the participant here;
 /// or, any new event to raise now.</param>
 protected virtual void RaiseCompositionRequested(RequestCompositionEventArgs <TTarget> participantEvent)
 {
     lock (Participants) {
         if (isDisposed)
         {
             return;
         }
     }
     CompositionRequested?.Invoke(this, participantEvent);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// This method is overridden here to implement <see cref="AllowRecomposition"/>;
 /// and if false and <see cref="HasComposed"/> is true, this will not invoke base.
 /// </summary>
 protected override void HandleCompositionRequested(
     object sender,
     RequestCompositionEventArgs <TContainer> eventArgs)
 {
     lock (SyncLock) {
         if (!allowRecomposition &&
             hasComposed)
         {
             return;
         }
     }
     base.HandleCompositionRequested(sender, eventArgs);
 }
Ejemplo n.º 4
0
 private void requestComposition(RequestCompositionEventArgs <TTarget> eventArgs)
 => CompositionRequested?.Invoke(this, eventArgs);
Ejemplo n.º 5
0
 /// <summary>
 /// This handler is added to all <see cref="IRequestComposition{TTarget}"/>
 /// participants here, and will invoke <see cref="RaiseCompositionRequested"/>
 /// to raise this actual event here.
 /// </summary>
 /// <param name="sender">Event sender.</param>
 /// <param name="participantEvent">Sender's event.</param>
 protected virtual void HandleParticipantCompositionRequested(
     object sender,
     RequestCompositionEventArgs <TTarget> participantEvent)
 => RaiseCompositionRequested(participantEvent);
Ejemplo n.º 6
0
 private void handleCompositionRequested(object sender, RequestCompositionEventArgs <TTarget> eventArgs)
 => CompositionRequested?.Invoke(this, eventArgs);