public static void UnsubscribeFrom(this IHTMLElement2 element, HtmlEvents eventType, HtmlEventObject eventObj) { try { element?.detachEvent(eventType.Name(), eventObj); } catch (RemotingException) { } catch (UnauthorizedAccessException) { } }
public static HtmlEventObject SubscribeTo(this IHTMLElement2 element, HtmlEvents eventType, HtmlEventObject handlerObj) { try { element?.attachEvent(eventType.Name(), handlerObj); } catch (RemotingException) { } catch (UnauthorizedAccessException) { } return(handlerObj); }