public static void UnsubscribeFrom(this IHTMLElement2 element, EventType eventType, IControlHtmlEvent handlerObj) { try { element?.detachEvent(eventType.Name(), handlerObj); } catch (RemotingException) { } catch (UnauthorizedAccessException) { } }
public static void UnsubscribeFrom(this IHTMLElement2 element, HtmlEvents eventType, HtmlEventObject eventObj) { try { element?.detachEvent(eventType.Name(), eventObj); } catch (RemotingException) { } catch (UnauthorizedAccessException) { } }
public static void UnsubscribeFrom(this IHTMLElement2 element, string @event, object pdisp) { try { element?.detachEvent(@event, pdisp); } catch (RemotingException) { } catch (UnauthorizedAccessException) { } }
/// <summary> /// detach only once (thread safe) /// </summary> public void Detach() { lock (this) { if (this.htmlElement != null) { IHTMLElement2 elem = (IHTMLElement2)htmlElement; elem.detachEvent(this.eventName, this); this.htmlElement = null; } } }