コード例 #1
0
ファイル: EventSubscription.cs プロジェクト: Citringo/Prism
        ///<summary>
        /// Creates a new instance of <see cref="EventSubscription"/>.
        ///</summary>
        ///<param name="actionReference">A reference to a delegate of type <see cref="System.Action"/>.</param>
        ///<exception cref="ArgumentNullException">When <paramref name="actionReference"/> or <see paramref="filterReference"/> are <see langword="null" />.</exception>
        ///<exception cref="ArgumentException">When the target of <paramref name="actionReference"/> is not of type <see cref="System.Action"/>.</exception>
        public EventSubscription(IDelegateReference actionReference)
        {
            if (actionReference == null)
                throw new ArgumentNullException(nameof(actionReference));
            if (!(actionReference.Target is Action))
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.InvalidDelegateRerefenceTypeException, typeof(Action).FullName), nameof(actionReference));

            _actionReference = actionReference;
        }
コード例 #2
0
 public BackgroundMsgSubscription(IDelegateReference actionReference, IDelegateReference filterReference)
     : base(actionReference, filterReference)
 {
 }
コード例 #3
0
 ///<summary>
 /// Creates a new instance of <see cref="BackgroundEventSubscription{TPayload}"/>.
 ///</summary>
 ///<param name="actionReference">A reference to a delegate of type <see cref="System.Action{TPayload}"/>.</param>
 ///<param name="filterReference">A reference to a delegate of type <see cref="Predicate{TPayload}"/>.</param>
 ///<param name="dispatcher">The dispatcher to use when executing the <paramref name="actionReference"/> delegate.</param>
 ///<exception cref="ArgumentNullException">When <paramref name="actionReference"/> or <see paramref="filterReference"/> are <see langword="null" />.</exception>
 ///<exception cref="ArgumentException">When the target of <paramref name="actionReference"/> is not of type <see cref="System.Action{TPayload}"/>,
 ///or the target of <paramref name="filterReference"/> is not of type <see cref="Predicate{TPayload}"/>.</exception>
 public DispatcherEventSubscription(IDelegateReference actionReference, IDelegateReference filterReference, Dispatcher dispatcher)
     : base(actionReference, filterReference)
 {
     this.dispatcher = dispatcher;
 }
コード例 #4
0
 /// <summary>
 /// Creates a new instance of <see cref="BackgroundEventSubscription"/>.
 /// </summary>
 /// <param name="actionReference">A reference to a delegate of type <see cref="System.Action"/>.</param>
 /// <exception cref="ArgumentNullException">When <paramref name="actionReference"/> or <see paramref="filterReference"/> are <see langword="null" />.</exception>
 /// <exception cref="ArgumentException">When the target of <paramref name="actionReference"/> is not of type <see cref="System.Action"/>.</exception>
 public BackgroundEventSubscription(IDelegateReference actionReference)
     : base(actionReference)
 {
 }
コード例 #5
0
 ///<summary>
 /// Creates a new instance of <see cref="Common.PubSubEvents.BackgroundEventSubscription"/>.
 ///</summary>
 ///<param name="actionReference">A reference to a delegate of type <see cref="System.Action{TPayload}"/>.</param>
 ///<param name="context">The synchronization context to use for UI thread dispatching.</param>
 ///<exception cref="ArgumentNullException">When <paramref name="actionReference"/> or <see paramref="filterReference"/> are <see langword="null" />.</exception>
 ///<exception cref="ArgumentException">When the target of <paramref name="actionReference"/> is not of type <see cref="System.Action{TPayload}"/>.</exception>
 public DispatcherEventSubscription(IDelegateReference actionReference, SynchronizationContext context)
     : base(actionReference)
 {
     this._syncContext = context;
 }
 public BackgroundDispatcherSubscription(IDelegateReference actionReference) :
     base(actionReference)
 {
 }
コード例 #7
0
 /// <summary>
 /// Creates a new instance of <see cref="BackgroundEventSubscription"/>.
 /// </summary>
 /// <param name="actionReference">A reference to a delegate of type <see cref="System.Action"/>.</param>
 /// <exception cref="ArgumentNullException">When <paramref name="actionReference"/> or <see paramref="filterReference"/> are <see langword="null" />.</exception>
 /// <exception cref="ArgumentException">When the target of <paramref name="actionReference"/> is not of type <see cref="System.Action"/>.</exception>
 public BackgroundEventSubscription(IDelegateReference actionReference)
     : base(actionReference)
 {
 }
コード例 #8
0
 ///<summary>
 /// Constructor padrão.
 ///</summary>
 ///<param name="actionReference">Referência para um delegate do tipo <see cref="System.Action{TPayload}"/>.</param>
 ///<param name="filterReference">Referência para um delegate do tipo <see cref="Predicate{TPayload}"/>.</param>
 ///<param name="allowCallReentrance">Identifica se a instancia irá permitir reentrada de chamada.</param>
 ///<param name="dispatcher">Despachante que será usado na instancia.</param>
 ///<param name="name">Nome da assinatura.</param>
 public DispatcherEventSubscription(IDelegateReference actionReference, IDelegateReference filterReference, bool allowCallReentrance, Threading.IDispatcher dispatcher, string name = null) : base(actionReference, filterReference, allowCallReentrance, name)
 {
     dispatcher.Require("dispatcher").NotNull();
     _dispatcher = dispatcher;
 }
コード例 #9
0
 public DispatcherEventSubscription(IDelegateReference actionReference, IDelegateReference filterReference, SynchronizationContext syncContext)
     : base(actionReference, filterReference)
 {
     this.syncContext = syncContext;
 }
コード例 #10
0
 ///<summary>
 /// Creates a new instance of <see cref="BackgroundEventSubscription"/>.
 ///</summary>
 ///<param name="actionReference">A reference to a delegate of type <see cref="System.Action{TPayload}"/>.</param>
 ///<param name="context">The synchronization context to use for UI thread dispatching.</param>
 ///<exception cref="ArgumentNullException">When <paramref name="actionReference"/> or <see paramref="filterReference"/> are <see langword="null" />.</exception>
 ///<exception cref="ArgumentException">When the target of <paramref name="actionReference"/> is not of type <see cref="System.Action{TPayload}"/>.</exception>
 public DispatcherEventSubscription(IDelegateReference actionReference, SynchronizationContext context)
     : base(actionReference)
 {
     syncContext = context;
 }
コード例 #11
0
 ///<summary>
 /// Creates a new instance of <see cref="BackgroundEventSubscription{TPayload}"/>.
 ///</summary>
 ///<param name="actionReference">A reference to a delegate of type <see cref="System.Action{TPayload}"/>.</param>
 ///<param name="filterReference">A reference to a delegate of type <see cref="Predicate{TPayload}"/>.</param>
 ///<param name="dispatcher">The dispatcher to use when executing the <paramref name="actionReference"/> delegate.</param>
 ///<exception cref="ArgumentNullException">When <paramref name="actionReference"/> or <see paramref="filterReference"/> are <see langword="null" />.</exception>
 ///<exception cref="ArgumentException">When the target of <paramref name="actionReference"/> is not of type <see cref="System.Action{TPayload}"/>,
 ///or the target of <paramref name="filterReference"/> is not of type <see cref="Predicate{TPayload}"/>.</exception>
 public WinFormEventSubscription(IDelegateReference actionReference, IDelegateReference filterReference, IDispatcherFacade dispatcher)
     : base(actionReference, filterReference)
 {
     this.dispatcher = dispatcher;
 }
コード例 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CiEventSubscription{TPayload}"/> class.
 /// </summary>
 /// <param name="actionReference">The action reference.</param>
 /// <param name="filterReference">The filter reference.</param>
 public CiEventSubscription(IDelegateReference actionReference, IDelegateReference filterReference)
     : base(actionReference, filterReference)
 {
 }
コード例 #13
0
 public DispatcherEventSubscription(IDelegateReference actionReference)
     : base(actionReference)
 {
     UIDispatcher = Dispatcher.CurrentDispatcher;
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CiDispatcherEventSubscription{TPayload}"/> class.
 /// </summary>
 /// <param name="actionReference">The action reference.</param>
 /// <param name="filterReference">The filter reference.</param>
 /// <param name="context">The context.</param>
 public CiDispatcherEventSubscription(IDelegateReference actionReference, IDelegateReference filterReference, SynchronizationContext context)
     : base(actionReference, filterReference, context)
 {
     _syncContext = context;
 }
コード例 #15
0
 public ContextDispatcherSubscription(IDelegateReference actionReference,
                                      SynchronizationContext context)
     : base(actionReference)
 {
     m_context = context;
 }
コード例 #16
0
 ///<summary>
 /// Creates a new instance of <see cref="BackgroundEventSubscription{TPayload}"/>.
 ///</summary>
 ///<param name="actionReference">A reference to a delegate of type <see cref="System.Action{TPayload}"/>.</param>
 ///<param name="filterReference">A reference to a delegate of type <see cref="Predicate{TPayload}"/>.</param>
 ///<param name="dispatcher">The dispatcher to use when executing the <paramref name="actionReference"/> delegate.</param>
 ///<exception cref="ArgumentNullException">When <paramref name="actionReference"/> or <see paramref="filterReference"/> are <see langword="null" />.</exception>
 ///<exception cref="ArgumentException">When the target of <paramref name="actionReference"/> is not of type <see cref="System.Action{TPayload}"/>,
 ///or the target of <paramref name="filterReference"/> is not of type <see cref="Predicate{TPayload}"/>.</exception>
 public CompositeEventSubscription(IDelegateReference actionReference, IDelegateReference filterReference, SynchronizationContext context)
     : base(actionReference, filterReference)
 {
     _context = context;
 }