Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / Host / DesignSurfaceCollection.cs / 1 / DesignSurfaceCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.ComponentModel.Design { using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Design; using System.Diagnostics; ////// /// Provides a read-only collection of design surfaces. /// public sealed class DesignSurfaceCollection : ICollection { private DesignerCollection _designers; ////// Initializes a new instance of the DesignSurfaceCollection class /// internal DesignSurfaceCollection(DesignerCollection designers) { _designers = designers; if (_designers == null) { _designers = new DesignerCollection(null); } } ////// /// Gets number of design surfaces in the collection. /// public int Count { get { return _designers.Count; } } ////// /// Gets or sets the document at the specified index. /// public DesignSurface this[int index] { get { IDesignerHost host = _designers[index]; DesignSurface surface = host.GetService(typeof(DesignSurface)) as DesignSurface; if (surface == null) { throw new NotSupportedException(); } return surface; } } ////// /// Creates and retrieves a new enumerator for this collection. /// public IEnumerator GetEnumerator() { return new DesignSurfaceEnumerator(_designers.GetEnumerator()); } ////// int ICollection.Count { get { return Count; } } /// /// bool ICollection.IsSynchronized { get { return false; } } /// /// object ICollection.SyncRoot { get { return null; } } /// /// void ICollection.CopyTo(Array array, int index) { foreach(DesignSurface surface in this) { array.SetValue(surface, index++); } } public void CopyTo(DesignSurface[] array, int index) { ((ICollection)this).CopyTo(array, index); } /// /// IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } /// /// Enumerator that performs the conversion from designer host /// to design surface. /// private class DesignSurfaceEnumerator : IEnumerator { private IEnumerator _designerEnumerator; internal DesignSurfaceEnumerator(IEnumerator designerEnumerator) { _designerEnumerator = designerEnumerator; } public object Current { get { IDesignerHost host = (IDesignerHost)_designerEnumerator.Current; DesignSurface surface = host.GetService(typeof(DesignSurface)) as DesignSurface; if (surface == null) { throw new NotSupportedException(); } return surface; } } public bool MoveNext() { return _designerEnumerator.MoveNext(); } public void Reset() { _designerEnumerator.Reset(); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DoubleLink.cs
- X500Name.cs
- Vector.cs
- CatalogZone.cs
- TemplateInstanceAttribute.cs
- FormattedText.cs
- ToolStripTextBox.cs
- MediaScriptCommandRoutedEventArgs.cs
- QilGenerator.cs
- BindingMemberInfo.cs
- SelectionItemProviderWrapper.cs
- ProbeMatchesMessageCD1.cs
- Point.cs
- ProcessMonitor.cs
- EventItfInfo.cs
- DescendantQuery.cs
- DataRecordInternal.cs
- PeerHelpers.cs
- WebPartEventArgs.cs
- AutoGeneratedField.cs
- ElementHost.cs
- AuthenticationService.cs
- FolderLevelBuildProviderAppliesToAttribute.cs
- UrlAuthorizationModule.cs
- WindowsRebar.cs
- CodeAttributeArgumentCollection.cs
- WindowsStatic.cs
- Reference.cs
- InkCanvasInnerCanvas.cs
- InvalidEnumArgumentException.cs
- PrimitiveXmlSerializers.cs
- DataErrorValidationRule.cs
- SizeChangedInfo.cs
- MultipartContentParser.cs
- UndoManager.cs
- ContainerParagraph.cs
- FileDataSourceCache.cs
- InvalidOperationException.cs
- ThemeableAttribute.cs
- FileBasedResourceGroveler.cs
- GridViewActionList.cs
- KeyPressEvent.cs
- DataGridViewHitTestInfo.cs
- XmlSchemaType.cs
- EncoderFallback.cs
- DesignerDataStoredProcedure.cs
- ScriptControl.cs
- CodeTypeParameter.cs
- ChangeDirector.cs
- CollectionDataContractAttribute.cs
- RegexGroup.cs
- DateTimeOffsetStorage.cs
- Hashtable.cs
- GraphicsState.cs
- FixedPageAutomationPeer.cs
- EventToken.cs
- ConstNode.cs
- NameTable.cs
- SchemaDeclBase.cs
- MetadataWorkspace.cs
- KerberosRequestorSecurityToken.cs
- Model3DGroup.cs
- FixedSOMPageElement.cs
- SqlDataSourceQuery.cs
- AmbientLight.cs
- KeyboardNavigation.cs
- EncoderFallback.cs
- DesignBindingEditor.cs
- Size.cs
- CultureInfo.cs
- ToolboxDataAttribute.cs
- MethodBuilder.cs
- NavigationService.cs
- DataFieldConverter.cs
- DesignObjectWrapper.cs
- NavigationFailedEventArgs.cs
- GeneralTransform3DTo2DTo3D.cs
- HuffCodec.cs
- ProcessActivityTreeOptions.cs
- WebPartsSection.cs
- XmlSchemas.cs
- ConfigurationStrings.cs
- SystemIPInterfaceStatistics.cs
- SqlConnectionString.cs
- ActivityMarkupSerializer.cs
- WindowManager.cs
- BuildProviderCollection.cs
- WebRequest.cs
- BaseHashHelper.cs
- ItemCollection.cs
- ValidationService.cs
- DependencyPropertyConverter.cs
- DataGridViewColumnConverter.cs
- CodeCastExpression.cs
- GridViewSortEventArgs.cs
- DataGridViewComboBoxCell.cs
- OutOfProcStateClientManager.cs
- __FastResourceComparer.cs
- XmlArrayAttribute.cs
- IDReferencePropertyAttribute.cs