public void Unsubscribe() { if (Application != null) { Application.AppEvent -= OnAppEvent; eventsHandler = null; } }
private void CreateDispatchers(IApplicationEventsHandler handler) { ApplicationEventDispatcher = new ApplicationEventDispatcher(handler); B1FormDataEventDispatcher = new B1FormDataEventDispatcher(); B1MenuEventDispatcher = new B1MenuEventDispatcher(); B1ItemEventDispatcher = new B1ItemEventDispatcher(); B1RightClickEventDispatcher = new B1RightClickEventDispatcher(); B1LayoutKeyEventDispatcher = new B1LayoutKeyEventDispatcher(); }
/// <summary> /// Starts up the events managing system. /// </summary> public void Initialize(Application app, IApplicationEventsHandler handler) { application = app; assembly = GetAssembly(handler); assemblyTypes = GetAssemblyTypes(assembly); B1EventFilterManager.Initialize(app); CreateDispatchers(handler); StartEventDispatchers(); AddSystemFormLoadListeners(); AddEventSinks(); }
/// <summary> /// Initializes a new instance of the <see cref="B1Session" /> class. /// </summary> /// <param name="application"> /// The application. /// </param> /// <param name="applicationEventsHandler"> /// The instance responsible for application event handling. /// </param> /// <param name="mainMenu"> /// The main menu instance. /// </param> public B1Session( Application application, IApplicationEventsHandler applicationEventsHandler, [CanBeNull] IMainMenuInstance mainMenu) { this.application = application; assembly = applicationEventsHandler.GetType().Assembly; this.applicationEventsHandler = applicationEventsHandler; this.mainMenu = mainMenu ?? new NullMainMenuInstance(); B1ApplicationEventDispatcher = new B1ApplicationEventDispatcher(); B1FormDataEventDispatcher = new B1FormDataEventDispatcher(); B1MenuEventDispatcher = new B1MenuEventDispatcher(); B1ItemEventDispatcher = new B1ItemEventDispatcher(); B1RightClickEventDispatcher = new B1RightClickEventDispatcher(); B1LayoutKeyEventDispatcher = new B1LayoutKeyEventDispatcher(); }
public void SetListener(IApplicationEventsHandler listener) { eventsHandler = listener; }
private Assembly GetAssembly(IApplicationEventsHandler handler) { return(handler.GetType().Assembly); }
/// <summary> /// Set a custom built application event handler that will be responsible to handle application events /// such as Shutdown or LanguageChanged. /// </summary> /// <param name="handler"> /// The handler to use. /// </param> protected void SetApplicationEventsHandler(IApplicationEventsHandler handler) { appEventsHandler = handler ?? new DefaultApplicationEventsHandler(this); }
public ApplicationEventDispatcher(IApplicationEventsHandler handler) { Ensure.NotNull(nameof(handler), handler); eventsHandler = handler; }
/// <summary> /// Initializes a new instance of the <see cref="B1Session" /> class. /// </summary> /// <param name="application"> /// The application. /// </param> /// <param name="applicationEventsHandler"> /// The instance responsible for application event handling. /// </param> public B1Session( Application application, IApplicationEventsHandler applicationEventsHandler) : this(application, applicationEventsHandler, null) { }