Ejemplo n.º 1
0
 /// <summary>
 /// Initializes an instance of the GenuineEventArgs class.
 /// </summary>
 /// <param name="genuineEventType">Event type.</param>
 /// <param name="sourceException">Source exception.</param>
 /// <param name="hostInformation">Information about remote host.</param>
 /// <param name="additionalInfo">Additional information related to the event or a null reference.</param>
 public GenuineEventArgs(GenuineEventType genuineEventType, Exception sourceException, HostInformation hostInformation, object additionalInfo)
 {
     this.EventType       = genuineEventType;
     this.SourceException = sourceException;
     this.HostInformation = hostInformation;
     this.AdditionalInfo  = additionalInfo;
 }
        /// <summary>
        /// Sets the state of the connection.
        /// </summary>
        /// <param name="genuineEventType">The state of the connection.</param>
        /// <param name="reason">The exception.</param>
        /// <param name="additionalInfo">The additional info.</param>
        public void SignalState(GenuineEventType genuineEventType, Exception reason, object additionalInfo)
        {
            lock (this._connectionStateSignallerLock)
            {
                if (this._connectionStateSignaller == null)
                {
                    this._connectionStateSignaller = new ConnectionStateSignaller(this.Remote, this.ITransportContext.IGenuineEventProvider);
                }

                this._connectionStateSignaller.SetState(genuineEventType, reason, additionalInfo);
            }
        }
        /// <summary>
        /// Sets the state of the persistent connection to the specific remote host.
        /// </summary>
        /// <param name="genuineEventType">The state of the connection.</param>
        /// <param name="reason">The exception.</param>
        /// <param name="additionalInfo">The additional info.</param>
        public void SetState(GenuineEventType genuineEventType, Exception reason, object additionalInfo)
        {
            lock (this)
            {
                if (this._currentState == genuineEventType)
                    return ;

                this._currentState = genuineEventType;
            }

            this._iGenuineEventProvider.Fire(new GenuineEventArgs(genuineEventType, reason, this._remote, additionalInfo));
        }
        /// <summary>
        /// Sets the state of the persistent connection to the specific remote host.
        /// </summary>
        /// <param name="genuineEventType">The state of the connection.</param>
        /// <param name="reason">The exception.</param>
        /// <param name="additionalInfo">The additional info.</param>
        public void SetState(GenuineEventType genuineEventType, Exception reason, object additionalInfo)
        {
            lock (this)
            {
                if (this._currentState == genuineEventType)
                {
                    return;
                }

                this._currentState = genuineEventType;
            }

            this._iGenuineEventProvider.Fire(new GenuineEventArgs(genuineEventType, reason, this._remote, additionalInfo));
        }
 /// <summary>
 /// Constructs an instance of the ConnectionSignaller class.
 /// </summary>
 /// <param name="remote">The remote host.</param>
 /// <param name="iGenuineEventProvider">The event provider.</param>
 public ConnectionStateSignaller(HostInformation remote, IGenuineEventProvider iGenuineEventProvider)
 {
     this._remote = remote;
     this._iGenuineEventProvider = iGenuineEventProvider;
     this._currentState = GenuineEventType.GeneralConnectionIndeterminate;
 }
        /// <summary>
        /// Sets the state of the connection.
        /// </summary>
        /// <param name="genuineEventType">The state of the connection.</param>
        /// <param name="reason">The exception.</param>
        /// <param name="additionalInfo">The additional info.</param>
        public void SignalState(GenuineEventType genuineEventType, Exception reason, object additionalInfo)
        {
            lock (this._connectionStateSignallerLock)
            {
                if (this._connectionStateSignaller == null)
                    this._connectionStateSignaller = new ConnectionStateSignaller(this.Remote, this.ITransportContext.IGenuineEventProvider);

                this._connectionStateSignaller.SetState(genuineEventType, reason, additionalInfo);
            }
        }