Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / HtmlWindowCollection.cs / 1305376 / HtmlWindowCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Drawing; using System.Drawing.Printing; using System.Windows.Forms; using System.Security.Permissions; using System.Security; using System.Runtime.InteropServices; using System.Net; using System.Collections; namespace System.Windows.Forms { ////// /// public class HtmlWindowCollection : ICollection { private UnsafeNativeMethods.IHTMLFramesCollection2 htmlFramesCollection2; private HtmlShimManager shimManager; internal HtmlWindowCollection(HtmlShimManager shimManager, UnsafeNativeMethods.IHTMLFramesCollection2 collection) { this.htmlFramesCollection2 = collection; this.shimManager = shimManager; Debug.Assert(this.NativeHTMLFramesCollection2 != null, "The window collection object should implement IHTMLFramesCollection2"); } private UnsafeNativeMethods.IHTMLFramesCollection2 NativeHTMLFramesCollection2 { get { return this.htmlFramesCollection2; } } ///[To be supplied.] ////// /// public HtmlWindow this[int index] { get { if (index < 0 || index >= this.Count) { throw new ArgumentOutOfRangeException("index", SR.GetString(SR.InvalidBoundArgument, "index", index, 0, this.Count - 1)); } object oIndex = (object)index; UnsafeNativeMethods.IHTMLWindow2 htmlWindow2 = this.NativeHTMLFramesCollection2.Item(ref oIndex) as UnsafeNativeMethods.IHTMLWindow2; return (htmlWindow2 != null) ? new HtmlWindow(shimManager, htmlWindow2) : null; } } ///[To be supplied.] ////// /// public HtmlWindow this[string windowId] { get { object oWindowId = (object)windowId; UnsafeNativeMethods.IHTMLWindow2 htmlWindow2 = null; try { htmlWindow2 = this.htmlFramesCollection2.Item(ref oWindowId) as UnsafeNativeMethods.IHTMLWindow2; } catch (COMException) { throw new ArgumentException(SR.GetString(SR.InvalidArgument, "windowId", windowId)); } return (htmlWindow2 != null) ? new HtmlWindow(shimManager, htmlWindow2) : null; } } ///[To be supplied.] ////// /// Returns the total number of elements in the collection. /// public int Count { get { return this.NativeHTMLFramesCollection2.GetLength(); } } ////// bool ICollection.IsSynchronized { get { return false; } } /// /// object ICollection.SyncRoot { get { return this; } } /// /// void ICollection.CopyTo(Array dest, int index) { int count = this.Count; for (int i = 0; i < count; i++) { dest.SetValue(this[i], index++); } } /// /// public IEnumerator GetEnumerator() { HtmlWindow[] htmlWindows = new HtmlWindow[this.Count]; ((ICollection)this).CopyTo(htmlWindows, 0); return htmlWindows.GetEnumerator(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Drawing; using System.Drawing.Printing; using System.Windows.Forms; using System.Security.Permissions; using System.Security; using System.Runtime.InteropServices; using System.Net; using System.Collections; namespace System.Windows.Forms { ////// /// public class HtmlWindowCollection : ICollection { private UnsafeNativeMethods.IHTMLFramesCollection2 htmlFramesCollection2; private HtmlShimManager shimManager; internal HtmlWindowCollection(HtmlShimManager shimManager, UnsafeNativeMethods.IHTMLFramesCollection2 collection) { this.htmlFramesCollection2 = collection; this.shimManager = shimManager; Debug.Assert(this.NativeHTMLFramesCollection2 != null, "The window collection object should implement IHTMLFramesCollection2"); } private UnsafeNativeMethods.IHTMLFramesCollection2 NativeHTMLFramesCollection2 { get { return this.htmlFramesCollection2; } } ///[To be supplied.] ////// /// public HtmlWindow this[int index] { get { if (index < 0 || index >= this.Count) { throw new ArgumentOutOfRangeException("index", SR.GetString(SR.InvalidBoundArgument, "index", index, 0, this.Count - 1)); } object oIndex = (object)index; UnsafeNativeMethods.IHTMLWindow2 htmlWindow2 = this.NativeHTMLFramesCollection2.Item(ref oIndex) as UnsafeNativeMethods.IHTMLWindow2; return (htmlWindow2 != null) ? new HtmlWindow(shimManager, htmlWindow2) : null; } } ///[To be supplied.] ////// /// public HtmlWindow this[string windowId] { get { object oWindowId = (object)windowId; UnsafeNativeMethods.IHTMLWindow2 htmlWindow2 = null; try { htmlWindow2 = this.htmlFramesCollection2.Item(ref oWindowId) as UnsafeNativeMethods.IHTMLWindow2; } catch (COMException) { throw new ArgumentException(SR.GetString(SR.InvalidArgument, "windowId", windowId)); } return (htmlWindow2 != null) ? new HtmlWindow(shimManager, htmlWindow2) : null; } } ///[To be supplied.] ////// /// Returns the total number of elements in the collection. /// public int Count { get { return this.NativeHTMLFramesCollection2.GetLength(); } } ////// bool ICollection.IsSynchronized { get { return false; } } /// /// object ICollection.SyncRoot { get { return this; } } /// /// void ICollection.CopyTo(Array dest, int index) { int count = this.Count; for (int i = 0; i < count; i++) { dest.SetValue(this[i], index++); } } /// /// public IEnumerator GetEnumerator() { HtmlWindow[] htmlWindows = new HtmlWindow[this.Count]; ((ICollection)this).CopyTo(htmlWindows, 0); return htmlWindows.GetEnumerator(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TreeViewImageIndexConverter.cs
- TableCell.cs
- OleDbException.cs
- DesignerActionPanel.cs
- CompilerHelpers.cs
- SQLMoneyStorage.cs
- _UncName.cs
- Literal.cs
- GroupItemAutomationPeer.cs
- EdmItemCollection.cs
- XmlElement.cs
- _DomainName.cs
- CustomAttributeFormatException.cs
- RegexStringValidator.cs
- VBCodeProvider.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- MemoryMappedFileSecurity.cs
- SplitterPanel.cs
- Container.cs
- ValidatedMobileControlConverter.cs
- Triangle.cs
- WorkflowOperationContext.cs
- NavigationPropertyEmitter.cs
- BaseValidatorDesigner.cs
- ToolStripRenderer.cs
- JpegBitmapEncoder.cs
- SimpleHandlerFactory.cs
- XPathDocumentBuilder.cs
- CustomErrorsSection.cs
- Number.cs
- XmlAttribute.cs
- HMACSHA1.cs
- PenThreadWorker.cs
- DataGridViewSelectedColumnCollection.cs
- AnnouncementSendsAsyncResult.cs
- ChtmlLinkAdapter.cs
- DependencyObjectPropertyDescriptor.cs
- MetaModel.cs
- WebPageTraceListener.cs
- CodeCompiler.cs
- ListParagraph.cs
- ImageCollectionEditor.cs
- CustomServiceCredentials.cs
- updatecommandorderer.cs
- basecomparevalidator.cs
- AmbiguousMatchException.cs
- TextCompositionManager.cs
- DrawingContextDrawingContextWalker.cs
- FixedSOMImage.cs
- DataGridRowDetailsEventArgs.cs
- Setter.cs
- UriWriter.cs
- WebProxyScriptElement.cs
- OleDbFactory.cs
- FragmentQueryProcessor.cs
- IsolatedStorageFile.cs
- Point3DAnimationBase.cs
- Size3DConverter.cs
- Verify.cs
- MatcherBuilder.cs
- COM2ExtendedTypeConverter.cs
- TripleDES.cs
- BlockCollection.cs
- ColorTransformHelper.cs
- NetSectionGroup.cs
- InterleavedZipPartStream.cs
- DockProviderWrapper.cs
- KeyProperty.cs
- DateTimeAutomationPeer.cs
- BuildProvider.cs
- CachedRequestParams.cs
- Hyperlink.cs
- SemaphoreFullException.cs
- SiteMapDataSourceView.cs
- MoveSizeWinEventHandler.cs
- PaintEvent.cs
- Visual.cs
- CollectionDataContractAttribute.cs
- SectionXmlInfo.cs
- DummyDataSource.cs
- XmlNodeList.cs
- ColumnReorderedEventArgs.cs
- WindowPatternIdentifiers.cs
- OleDbTransaction.cs
- MiniCustomAttributeInfo.cs
- DataGridViewComboBoxCell.cs
- DataRowChangeEvent.cs
- ColumnResizeAdorner.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- unitconverter.cs
- Delegate.cs
- OperandQuery.cs
- PtsHost.cs
- InstanceNotFoundException.cs
- RegisteredExpandoAttribute.cs
- ReflectionPermission.cs
- StringArrayConverter.cs
- KnownTypes.cs
- IRCollection.cs
- ToolTipService.cs