Ejemplo n.º 1
0
        /// <summary>
        /// Raises the Disconnected event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void OnConnectionClosed(object sender, AddressBookItemConnectionManagerEventArgs e)
        {
            try
            {
                e.Manager.ConnectionEstablishContext -= new AddressBookItemConnectionManagerContextEventHandler(OnConnectionEstablishContext);
                e.Manager.BeforeConnectionOpened     -= new AddressBookItemConnectionManagerCancelEventHandler(OnBeforeConnectionOpened);
                e.Manager.ConnectionResolvingAddress -= new AddressBookItemConnectionManagerResolvingAddressEventHandler(OnConnectionResolvingAddress);
                e.Manager.BeforeConnectionClosed     -= new AddressBookItemConnectionManagerCancelEventHandler(OnBeforeConnectionClosed);
                e.Manager.ConnectionOpened           -= new AddressBookItemConnectionManagerEventHandler(OnConnectionOpened);
                e.Manager.ConnectionClosed           -= new AddressBookItemConnectionManagerEventHandler(OnConnectionClosed);
                e.Manager.ConnectionException        -= new AddressBookItemConnectionManagerExceptionEventHandler(OnConnectionException);

                this.UnbindContextFromItem(e.Manager.AddressBookItem);

                lock (_sessionManagers)
                    _sessionManagers.Remove(e.Manager);

                if (this.ConnectionClosed != null)
                {
                    this.ConnectionClosed(sender, e);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Raises the Connected event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected virtual void OnConnectionOpened(object sender, AddressBookItemConnectionManagerEventArgs e)
 {
     try
     {
         if (this.ConnectionOpened != null)
         {
             this.ConnectionOpened(sender, e);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
     }
 }
		/// <summary>
		/// Raises the Disconnected event
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		protected virtual void OnConnectionClosed(object sender, AddressBookItemConnectionManagerEventArgs e)
		{
			try
			{
				if (this.ConnectionClosed != null)
					this.ConnectionClosed(sender, e);
			}
			catch(Exception ex)
			{
				Debug.WriteLine(ex);
			}
		}
		/// <summary>
		/// Raises the Disconnected event
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		protected virtual void OnConnectionClosed(object sender, AddressBookItemConnectionManagerEventArgs e)
		{
			try
			{
				e.Manager.ConnectionEstablishContext -= new AddressBookItemConnectionManagerContextEventHandler(OnConnectionEstablishContext);
				e.Manager.BeforeConnectionOpened -= new AddressBookItemConnectionManagerCancelEventHandler(OnBeforeConnectionOpened);
				e.Manager.ConnectionResolvingAddress -= new AddressBookItemConnectionManagerResolvingAddressEventHandler(OnConnectionResolvingAddress);
				e.Manager.BeforeConnectionClosed -= new AddressBookItemConnectionManagerCancelEventHandler(OnBeforeConnectionClosed);
				e.Manager.ConnectionOpened -= new AddressBookItemConnectionManagerEventHandler(OnConnectionOpened);
				e.Manager.ConnectionClosed -= new AddressBookItemConnectionManagerEventHandler(OnConnectionClosed);
				e.Manager.ConnectionException -= new AddressBookItemConnectionManagerExceptionEventHandler(OnConnectionException);
				
				this.UnbindContextFromItem(e.Manager.AddressBookItem);

				lock(_sessionManagers)
					_sessionManagers.Remove(e.Manager);				

				if (this.ConnectionClosed != null)
					this.ConnectionClosed(sender, e);
			}
			catch(Exception ex)
			{
				Debug.WriteLine(ex);
			}
		}