コード例 #1
0
 public void Unsubscribe()
 {
     if (Application != null)
     {
         Application.AppEvent -= OnAppEvent;
         eventsHandler         = null;
     }
 }
コード例 #2
0
ファイル: B1EventsManager.cs プロジェクト: pedromagueija/b1pp
 private void CreateDispatchers(IApplicationEventsHandler handler)
 {
     ApplicationEventDispatcher  = new ApplicationEventDispatcher(handler);
     B1FormDataEventDispatcher   = new B1FormDataEventDispatcher();
     B1MenuEventDispatcher       = new B1MenuEventDispatcher();
     B1ItemEventDispatcher       = new B1ItemEventDispatcher();
     B1RightClickEventDispatcher = new B1RightClickEventDispatcher();
     B1LayoutKeyEventDispatcher  = new B1LayoutKeyEventDispatcher();
 }
コード例 #3
0
ファイル: B1EventsManager.cs プロジェクト: pedromagueija/b1pp
        /// <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();
        }
コード例 #4
0
        /// <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();
        }
コード例 #5
0
 public void SetListener(IApplicationEventsHandler listener)
 {
     eventsHandler = listener;
 }
コード例 #6
0
ファイル: B1EventsManager.cs プロジェクト: pedromagueija/b1pp
 private Assembly GetAssembly(IApplicationEventsHandler handler)
 {
     return(handler.GetType().Assembly);
 }
コード例 #7
0
 /// <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);
 }
コード例 #8
0
        public ApplicationEventDispatcher(IApplicationEventsHandler handler)
        {
            Ensure.NotNull(nameof(handler), handler);

            eventsHandler = handler;
        }
コード例 #9
0
 /// <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)
 {
 }