Exemplo n.º 1
0
        /// <summary>
        /// Raises the RealizeContext event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void OnConnectionEstablishContext(object sender, AddressBookItemConnectionManagerContextEventArgs e)
        {
            try
            {
                // first check and see if we've already got a context bound to this item
                IAddressBookItemContext context = this.LookupContextForItem(e.Manager.AddressBookItem);

                // if we have a pre-bound context put it in the event args!
                if (context != null)
                {
                    e.Context = context;
                }

                // if there are any event handler's to fire this event to
                if (this.ConnectionEstablishContext != null)
                {
                    // raise the event
                    this.ConnectionEstablishContext(sender, e);

                    // if a context was returned to us, bind the item to the context
                    if (e.Context != null)
                    {
                        this.BindContextToItem(e.Manager.AddressBookItem, e.Context);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Raises the RealizeContext event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected virtual void OnConnectionEstablishContext(object sender, AddressBookItemConnectionManagerContextEventArgs e)
 {
     try
     {
         if (this.ConnectionEstablishContext != null)
         {
             this.ConnectionEstablishContext(sender, e);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Allow the client to realize the context for this address book item (aka, manifest the item visually and store some state information in our context for later reference)
        /// </summary>
        private void InternalEstablishContext()
        {
            /*
             * Raise the realize context event, and save the context supplied to us by the client
             * */
            AddressBookItemConnectionManagerContextEventArgs e = new AddressBookItemConnectionManagerContextEventArgs(this);

            this.OnConnectionEstablishContext(this, e);

            // save the supplied context
            _itemContext = e.Context;

            // if the context is supplied, then set the context's item property reference to the address book item we are managing
            if (_itemContext != null)
            {
                _itemContext.AddressBookItem = _item;
            }
        }
		/// <summary>
		/// Raises the RealizeContext event
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		protected virtual void OnConnectionEstablishContext(object sender, AddressBookItemConnectionManagerContextEventArgs e)
		{
			try
			{
				if (this.ConnectionEstablishContext != null)
					this.ConnectionEstablishContext(sender, e);
			}
			catch(Exception ex)
			{
				Debug.WriteLine(ex);
			}
		}
		/// <summary>
		/// Allow the client to realize the context for this address book item (aka, manifest the item visually and store some state information in our context for later reference)
		/// </summary>
		private void InternalEstablishContext()
		{	
			/*
			 * Raise the realize context event, and save the context supplied to us by the client
			 * */
			AddressBookItemConnectionManagerContextEventArgs e = new AddressBookItemConnectionManagerContextEventArgs(this);			
			this.OnConnectionEstablishContext(this, e);
			
			// save the supplied context
			_itemContext = e.Context;
			
			// if the context is supplied, then set the context's item property reference to the address book item we are managing
			if (_itemContext != null)
				_itemContext.AddressBookItem = _item;
		}
		/// <summary>
		/// Raises the RealizeContext event
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		protected virtual void OnConnectionEstablishContext(object sender, AddressBookItemConnectionManagerContextEventArgs e)
		{
			try
			{		
				// first check and see if we've already got a context bound to this item
				IAddressBookItemContext context = this.LookupContextForItem(e.Manager.AddressBookItem);
				
				// if we have a pre-bound context put it in the event args!
				if (context != null)
					e.Context = context;

				// if there are any event handler's to fire this event to
				if (this.ConnectionEstablishContext != null)
				{
					// raise the event
					this.ConnectionEstablishContext(sender, e);
				
					// if a context was returned to us, bind the item to the context
					if (e.Context != null)
						this.BindContextToItem(e.Manager.AddressBookItem, e.Context);					
				}
			}
			catch(Exception ex)
			{
				Debug.WriteLine(ex);
			}
		}