/// <summary>
        /// Method RaiseEvent.
        /// </summary>
        /// <param name="eventHandler">Instance of EventHandler.</param>
        /// <param name="e">The <see cref="WcfClientBaseEventArgs"/> instance containing the event data.</param>
        private void RaiseEvent(EventHandler <WcfClientBaseEventArgs> eventHandler, WcfClientBaseEventArgs e)
        {
            // Copy a reference to the delegate field now into a temporary field for thread safety
            EventHandler <WcfClientBaseEventArgs> temp = Interlocked.CompareExchange(ref eventHandler, null, null);

            if (temp != null)
            {
                temp(null, e);
            }
        }
예제 #2
0
        /// <summary>
        /// Raises the event.
        /// </summary>
        /// <param name="eventHandler">The event handler.</param>
        /// <param name="name">The name.</param>
        /// <param name="address">The address.</param>
        /// <param name="listenUri">The listen URI.</param>
        /// <param name="e">The <see cref="WcfClientBaseEventArgs" /> instance containing the event data.</param>
        /// <param name="username">The user name.</param>
        /// <param name="password">The password.</param>
        private void RaiseEvent(EventHandler <WcfClientBaseEventArgs> eventHandler, string name, EndpointAddress address, Uri listenUri, WcfClientBaseEventArgs e, string username, string password)
        {
            // Copy a reference to the delegate field now into a temporary field for thread safety
            EventHandler <WcfClientBaseEventArgs> temp = Interlocked.CompareExchange(ref eventHandler, null, null);

            if (temp != null)
            {
                temp(this, new WcfClientBaseEventArgs(name, address, listenUri, e.ChannelMessage, e.Message, e.MessageId, e.IsOneWay, username, password));
            }
        }