/// <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); } }
/// <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); } }
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); }
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; } }
/// <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> 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; } }