Ejemplo n.º 1
0
        //============================================================
        //	ICOMPARABLE IMPLEMENTATION
        //============================================================
        #region CompareTo(object obj)
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            //------------------------------------------------------------
            //	If target is a null reference, instance is greater
            //------------------------------------------------------------
            if (obj == null)
            {
                return(1);
            }

            //------------------------------------------------------------
            //	Determine comparison result using property state of objects
            //------------------------------------------------------------
            XmlRpcMessageSentEventArgs value = obj as XmlRpcMessageSentEventArgs;

            if (value != null)
            {
                int result = 0;
                result = result | this.Message.CompareTo(value.Message);
                result = result | this.Response.CompareTo(value.Response);
                result = result | Uri.Compare(this.Host, value.Host, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
        protected virtual void OnMessageSent(XmlRpcMessageSentEventArgs e)
        {
            EventHandler <XmlRpcMessageSentEventArgs> handler = null;

            handler = this.SendCompleted;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            XmlRpcMessageSentEventArgs value = obj as XmlRpcMessageSentEventArgs;

            if (value != null)
            {
                int result = 0;
                result = result | this.Message.CompareTo(value.Message);
                result = result | this.Response.CompareTo(value.Response);
                result = result | Uri.Compare(this.Host, value.Host, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
Ejemplo n.º 4
0
        protected virtual void OnMessageSent(XmlRpcMessageSentEventArgs e)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            EventHandler<XmlRpcMessageSentEventArgs> handler    = null;

            //------------------------------------------------------------
            //	Raise event on registered handler(s)
            //------------------------------------------------------------
            handler = this.SendCompleted;

            if (handler != null)
            {
                handler(this, e);
            }
        }