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
- AsymmetricKeyExchangeFormatter.cs
- LinkedResourceCollection.cs
- HwndAppCommandInputProvider.cs
- QilDataSource.cs
- VisualProxy.cs
- ToolStripRenderEventArgs.cs
- DocumentScope.cs
- Tile.cs
- WebServiceTypeData.cs
- SqlNotificationRequest.cs
- ModuleConfigurationInfo.cs
- Helpers.cs
- AsyncOperationManager.cs
- BoolExpr.cs
- ExceptionRoutedEventArgs.cs
- UpdatePanelTriggerCollection.cs
- ConfigurationValue.cs
- WinInet.cs
- ListViewDeletedEventArgs.cs
- MultipleViewPattern.cs
- InvokePatternIdentifiers.cs
- ElementsClipboardData.cs
- MenuItemBinding.cs
- CardSpacePolicyElement.cs
- DateTimeAutomationPeer.cs
- PageCodeDomTreeGenerator.cs
- PenThreadPool.cs
- FtpWebResponse.cs
- WorkItem.cs
- BindingElementExtensionElement.cs
- WindowsAuthenticationModule.cs
- IDReferencePropertyAttribute.cs
- PageStatePersister.cs
- QueryRewriter.cs
- NotifyParentPropertyAttribute.cs
- DecoratedNameAttribute.cs
- DomNameTable.cs
- XsltSettings.cs
- WebPartConnectionsConfigureVerb.cs
- TCEAdapterGenerator.cs
- StrokeDescriptor.cs
- Light.cs
- TrustManager.cs
- AspNetSynchronizationContext.cs
- EnumerationRangeValidationUtil.cs
- SystemColors.cs
- RadioButtonRenderer.cs
- BulletDecorator.cs
- AbstractExpressions.cs
- DataKey.cs
- formatter.cs
- SystemFonts.cs
- SelfIssuedSamlTokenFactory.cs
- PointAnimation.cs
- TypeContext.cs
- CodeMemberProperty.cs
- PropertyMap.cs
- MenuItem.cs
- StickyNote.cs
- BamlWriter.cs
- XmlUtf8RawTextWriter.cs
- Debug.cs
- SafeFileMapViewHandle.cs
- WebPartDisplayModeCollection.cs
- ArrayList.cs
- SystemResourceHost.cs
- TextDecorationCollection.cs
- DocumentPageHost.cs
- ScrollEvent.cs
- Application.cs
- HttpResponseInternalWrapper.cs
- ScalarOps.cs
- JsonFormatReaderGenerator.cs
- ObjectViewListener.cs
- SiblingIterators.cs
- PolicyImporterElementCollection.cs
- SimpleApplicationHost.cs
- WindowsPen.cs
- IsolatedStorageFilePermission.cs
- ProfilePropertySettings.cs
- TextEditorCopyPaste.cs
- PropertyRecord.cs
- Token.cs
- XmlSchemaValidationException.cs
- ListViewItemCollectionEditor.cs
- StrokeNodeEnumerator.cs
- ApplicationBuildProvider.cs
- DataControlImageButton.cs
- QuotedPrintableStream.cs
- DescendentsWalkerBase.cs
- XmlTextReaderImpl.cs
- PriorityBindingExpression.cs
- TCEAdapterGenerator.cs
- LinearKeyFrames.cs
- RequestCacheManager.cs
- UrlMappingsModule.cs
- RotateTransform.cs
- ConstraintStruct.cs
- AssertFilter.cs
- HttpListener.cs