private void CreateSourceList(Interop.IHTMLElement s) { if (_sources == null) { _sources = new SourceElementsCollection(s, base.HtmlEditor); _sources.OnInsertHandler += new CollectionInsertHandler(_sources_OnInsertHandler); _sources.OnClearHandler += new CollectionClearHandler(_sources_OnClearHandler); } else { _sources.OnInsertHandler -= new CollectionInsertHandler(_sources_OnInsertHandler); _sources.OnClearHandler -= new CollectionClearHandler(_sources_OnClearHandler); _sources.Clear(); Interop.IHTMLElement selectElement = (Interop.IHTMLElement)s; Interop.IHTMLElementCollection options = (Interop.IHTMLElementCollection)selectElement.GetChildren(); for (int i = 0; i < options.GetLength(); i++) { Interop.IHTMLElement el = (Interop.IHTMLElement)options.Item(i, i); object oe = new SourceElement(el, (HtmlEditor)base.HtmlEditor); _sources.Add(oe); } _sources.OnInsertHandler += new CollectionInsertHandler(_sources_OnInsertHandler); _sources.OnClearHandler += new CollectionClearHandler(_sources_OnClearHandler); } }
internal SourceElementsCollection(Interop.IHTMLElement s, IHtmlEditor editor) : base() { selectElement = (Interop.IHTMLElement)s; Interop.IHTMLElementCollection options = (Interop.IHTMLElementCollection)selectElement.GetChildren(); for (int i = 0; i < options.GetLength(); i++) { Interop.IHTMLElement el = (Interop.IHTMLElement)options.Item(i, i); object oe = new SourceElement(el, (HtmlEditor)editor); InnerList.Add(oe); } }