/// <summary> /// The register event handler. /// </summary> /// <param name="key"> /// The key. /// </param> /// <param name="handler"> /// The handler. /// </param> /// <typeparam name="T"> /// This is the event argument classe - e,g - LoadErrorEventArgs, FrameLoadStartEventArgs. /// </typeparam> public void RegisterEventHandler <T>(CefEventKey key, ChromelyEventHandler <T> handler) { if (_windowCreated) { throw new Exception("\"RegisterEventHandler\" method must be called before \"Run\" method."); } HostConfig?.RegisterEventHandler(key, handler); }
private void RegisterEventHandler <TEventArgs>( IChromelyContainer container, CefEventKey key, Action <object, TEventArgs, IChromelyContainer> handler) { var service = CefEventHandlerTypes.GetHandlerType(key); var eventHandler = new ChromelyEventHandler <TEventArgs>(key, (s, e) => handler(s, e, container)); container.RegisterInstance(service, eventHandler.Key, eventHandler); }
private void RegisterEventHandler <T>(IChromelyContainer container, CefEventKey key, ChromelyEventHandler <T> handler) { var service = CefEventHandlerTypes.GetHandlerType(key); container.RegisterInstance(service, handler.Key, handler); }