internal ApplicationContext( Loader.ActiveEventTypes instanceEvents, Loader.ActiveEventTypes staticEvents, ContextTicket ticket) { _ticket = ticket; _typesInstanceActiveEvents = instanceEvents; InitializeApplicationContext(staticEvents); }
/* * Creates a new application context. * This must be done through the Loader class, hence the constructor is internal. */ internal ApplicationContext(ActiveEventTypes instanceHandlerTypes, ActiveEventTypes staticHandlerTypes, ContextTicket ticket) { _ticket = ticket; // Each type that can handle instance Active Events neds to be stored, such that we can later register instance listeners, // according to their type. _instanceHandlerTypes = instanceHandlerTypes; // However, the static event handlers, are processed when we create our application context, and not stored for later. // Which means, you can register instance listeners on the ApplicationContext object, but if you register new assemblies through // your Loader singletone instance, these will not affect existing ApplicationContext instances. // While registering listener instances for a single ApplicationContext instance, will only affect that single context, and not // any other contexts. InitializeApplicationContext(staticHandlerTypes); }
/// <summary> /// Changes the ticket for the context. /// </summary> /// <param name="ticket">New ticket</param> public void UpdateTicket(ContextTicket ticket) { _ticket = ticket; }
/// <summary> /// Creates a new ApplicationContext. /// /// This is the only way to actually create an ApplicationContext, which again is used for raising Active Events. /// </summary> /// <returns>The newly created context</returns> /// <param name="ticket">The ticket to use for the context created, if any</param> public ApplicationContext CreateApplicationContext(ContextTicket ticket = null) { return(new ApplicationContext(_instanceActiveEvents, _staticActiveEvents, ticket)); }