示例#1
0
        /// <summary>
        /// Attached the EventCartridge to the context
        /// </summary>
        /// <param name="context">context to attach to</param>
        /// <returns>true if successful, false otherwise</returns>
        public bool AttachToContext(IContext context)
        {
            IInternalEventContext internalEventContext = context as IInternalEventContext;

            if (internalEventContext == null)
            {
                return(false);
            }
            else
            {
                internalEventContext.AttachEventCartridge(this);
                return(true);
            }
        }
示例#2
0
        /// <summary>  Chaining constructor accepts a Context argument.
        /// It will relay get() operations into this Context
        /// in the even the 'local' get() returns null.
        ///
        /// </summary>
        /// <param name="inner">context to be chained
        ///
        /// </param>
        public AbstractContext(IContext inner)
        {
            innerContext = inner;

            /*
             *  now, do a 'forward pull' of event cartridge so
             *  it's accessible, bringing to the top level.
             */

            IInternalEventContext internalEventContext = innerContext as IInternalEventContext;

            if (internalEventContext != null)
            {
                AttachEventCartridge(internalEventContext.EventCartridge);
            }
        }
示例#3
0
        public bool AttachToContext(IContext context)
        {
            bool result;

            if (context is IInternalEventContext)
            {
                IInternalEventContext internalEventContext = (IInternalEventContext)context;
                internalEventContext.AttachEventCartridge(this);
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
示例#4
0
 public InternalContextAdapterImpl(IContext c)
 {
     this.context = c;
     if (!(c is IInternalHousekeepingContext))
     {
         this.icb = new InternalContextBase();
     }
     else
     {
         this.icb = (IInternalHousekeepingContext)this.context;
     }
     if (c is IInternalEventContext)
     {
         this.iec = (IInternalEventContext)this.context;
     }
 }
示例#5
0
        /// <summary>  CTOR takes a Context and wraps it, delegating all 'data' calls
        /// to it.
        ///
        /// For support of internal contexts, it will create an InternalContextBase
        /// if need be.
        /// </summary>
        public InternalContextAdapterImpl(IContext c)
        {
            context = c;

            if (c is IInternalHousekeepingContext)
            {
                internalHousekeepingContext = (IInternalHousekeepingContext)context;
            }
            else
            {
                internalHousekeepingContext = new InternalContextBase();
            }

            IInternalEventContext internalEventContext = context as IInternalEventContext;

            if (internalEventContext != null)
            {
                this.internalEventContext = internalEventContext;
            }
        }
示例#6
0
        /// <summary>  Attached the EventCartridge to the context
        ///
        /// Final because not something one should mess with lightly :)
        ///
        /// </summary>
        /// <param name="context">context to attach to
        /// </param>
        /// <returns> true if successful, false otherwise
        /// </returns>
        public bool AttachToContext(IContext context)
        {
            if (context is IInternalEventContext)
            {
                IInternalEventContext iec = (IInternalEventContext)context;

                iec.AttachEventCartridge(this);

                /**
                 * while it's tempting to call setContext on each handler from here,
                 * this needs to be done before each method call.  This is
                 * because the specific context will change as inner contexts
                 * are linked in through macros, foreach, or directly by the user.
                 */

                return(true);
            }
            else
            {
                return(false);
            }
        }
		/// <summary>  CTOR takes a Context and wraps it, delegating all 'data' calls
		/// to it.
		///
		/// For support of internal contexts, it will create an InternalContextBase
		/// if need be.
		/// </summary>
		public InternalContextAdapterImpl(IContext c)
		{
			context = c;

			if (c is IInternalHousekeepingContext)
			{
				internalHousekeepingContext = (IInternalHousekeepingContext) context;
			}
			else
			{
				internalHousekeepingContext = new InternalContextBase();
			}

			IInternalEventContext internalEventContext = context as IInternalEventContext;
			if (internalEventContext != null)
			{
				this.internalEventContext = internalEventContext;
			}
		}
		/// <summary>  CTOR takes a Context and wraps it, delegating all 'data' calls
		/// to it.
		///
		/// For support of internal contexts, it will create an InternalContextBase
		/// if need be.
		/// </summary>
		public InternalContextAdapterImpl(IContext c)
		{
			context = c;

			if (!(c is IInternalHousekeepingContext))
			{
				icb = new InternalContextBase();
			}
			else
			{
				icb = (IInternalHousekeepingContext) context;
			}

			if (c is IInternalEventContext)
			{
				iec = (IInternalEventContext) context;
			}
		}