Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / WinForms / Managed / System / WinForms / HtmlWindowCollection.cs / 1 / 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
- DynamicPropertyHolder.cs
- IndexOutOfRangeException.cs
- IncrementalReadDecoders.cs
- GlobalItem.cs
- PageBuildProvider.cs
- InputReport.cs
- ObjectManager.cs
- InputManager.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- InkCollectionBehavior.cs
- MeshGeometry3D.cs
- StyleCollectionEditor.cs
- WsrmFault.cs
- PermissionRequestEvidence.cs
- Cloud.cs
- RegexWorker.cs
- TextDecoration.cs
- DataObject.cs
- ValidatingReaderNodeData.cs
- WorkflowEventArgs.cs
- COM2FontConverter.cs
- KeyTimeConverter.cs
- CacheMemory.cs
- MessageEventSubscriptionService.cs
- CodeAttachEventStatement.cs
- KnownTypeAttribute.cs
- XmlSchemaSearchPattern.cs
- StaticExtensionConverter.cs
- ReadOnlyDataSourceView.cs
- PersonalizationProviderCollection.cs
- ReadWriteSpinLock.cs
- Viewport2DVisual3D.cs
- PriorityQueue.cs
- ReadOnlyDataSourceView.cs
- QuadraticEase.cs
- Unit.cs
- ThreadNeutralSemaphore.cs
- ProtocolInformationReader.cs
- EntityStoreSchemaFilterEntry.cs
- LingerOption.cs
- KeyConstraint.cs
- ConfigXmlAttribute.cs
- HwndProxyElementProvider.cs
- PeerCollaboration.cs
- NameTable.cs
- NameValueConfigurationCollection.cs
- ModelTreeEnumerator.cs
- SEHException.cs
- TextBoxBase.cs
- EnumValidator.cs
- MarkedHighlightComponent.cs
- SoapSchemaExporter.cs
- X509Certificate.cs
- ListViewUpdateEventArgs.cs
- SafeMILHandle.cs
- TypefaceCollection.cs
- AudioDeviceOut.cs
- CopyOnWriteList.cs
- HostProtectionPermission.cs
- ToolboxBitmapAttribute.cs
- WorkflowMarkupSerializationException.cs
- MsmqHostedTransportManager.cs
- TextSchema.cs
- DiagnosticTrace.cs
- CopyCodeAction.cs
- XmlValueConverter.cs
- SmiRequestExecutor.cs
- KeyedHashAlgorithm.cs
- ScriptServiceAttribute.cs
- ActivityBindForm.Designer.cs
- RequestCache.cs
- CellRelation.cs
- RequestCacheEntry.cs
- GeometryValueSerializer.cs
- DrawingDrawingContext.cs
- CustomAttribute.cs
- Win32PrintDialog.cs
- RemotingAttributes.cs
- securitymgrsite.cs
- DetailsViewRow.cs
- WebBrowserDocumentCompletedEventHandler.cs
- PropertyGridCommands.cs
- TextAnchor.cs
- CheckBoxStandardAdapter.cs
- XmlDigitalSignatureProcessor.cs
- DocComment.cs
- AVElementHelper.cs
- GatewayDefinition.cs
- ClientBuildManager.cs
- Peer.cs
- TableItemStyle.cs
- indexingfiltermarshaler.cs
- FixUp.cs
- RowType.cs
- RoutedEventArgs.cs
- DataSourceControl.cs
- Number.cs
- GrammarBuilder.cs
- KeyPullup.cs
- CommandID.cs