public static void UnsubscribeFrom(this IHTMLElement2 element, EventType eventType, IControlHtmlEvent handlerObj) { try { element?.detachEvent(eventType.Name(), handlerObj); } catch (RemotingException) { } catch (UnauthorizedAccessException) { } }
public static bool SubscribeTo(this IHTMLElement2 element, EventType eventType, IControlHtmlEvent handlerObj) { try { return(element.IsNull() ? false : element.attachEvent(eventType.Name(), handlerObj)); } catch (RemotingException) { } catch (UnauthorizedAccessException) { } return(false); }