/// <summary>
        /// Initializes a new instance of the <see cref="Subscription"/> class.
        /// </summary>
        /// <param name="messageKey">The message key.</param>
        /// <param name="action">The delegate action to create a WeakAction from.</param>
        /// <param name="actionType">The parameter type of the action.</param>
        public Subscription(string messageKey, Delegate action, Type actionType)
        {
            if (action == null)
                throw new ArgumentNullException("action");
            if (actionType == null)
                throw new ArgumentNullException("actionType");

            _token = new SubscriptionToken();
            _messageKey = messageKey;
            _weakAction = new WeakAction(action.Target, action.Method, actionType);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Subscription"/> class.
        /// </summary>
        /// <param name="action">The delegate action to create a WeakAction from.</param>
        /// <param name="actionType">The parameter type of the action.</param>
        public Subscription(Delegate action, Type actionType)
        {
            if (action == null)
                throw new ArgumentNullException("action");
            if (actionType == null)
                throw new ArgumentNullException("actionType");

            _token = new SubscriptionToken();
            _messageKey = actionType.AssemblyQualifiedName;
            _weakAction = new WeakAction(action.Target, action.Method, actionType);
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Subscription"/> class.
        /// </summary>
        /// <param name="messageKey">The message key.</param>
        /// <param name="action">The delegate action to create a WeakAction from.</param>
        /// <param name="actionType">The parameter type of the action.</param>
        public Subscription(string messageKey, Delegate action, Type actionType)
        {
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (actionType == null)
            {
                throw new ArgumentNullException("actionType");
            }

            _token      = new SubscriptionToken();
            _messageKey = messageKey;
            _weakAction = new WeakAction(action.Target, action.Method, actionType);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Subscription"/> class.
        /// </summary>
        /// <param name="action">The delegate action to create a WeakAction from.</param>
        /// <param name="actionType">The parameter type of the action.</param>
        public Subscription(Delegate action, Type actionType)
        {
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (actionType == null)
            {
                throw new ArgumentNullException("actionType");
            }

            _token      = new SubscriptionToken();
            _messageKey = actionType.AssemblyQualifiedName;
            _weakAction = new WeakAction(action.Target, action.Method, actionType);
        }