Code:
/ FX-1434 / FX-1434 / 1.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
- XmlQueryOutput.cs
- DependencySource.cs
- HtmlContainerControl.cs
- CategoryNameCollection.cs
- PathFigureCollectionConverter.cs
- Point.cs
- dbenumerator.cs
- NameSpaceExtractor.cs
- AutoGeneratedField.cs
- TransformPatternIdentifiers.cs
- RelationshipDetailsRow.cs
- DBNull.cs
- FtpWebResponse.cs
- OledbConnectionStringbuilder.cs
- NamedObject.cs
- PenLineJoinValidation.cs
- XsltLoader.cs
- RSAPKCS1KeyExchangeFormatter.cs
- TraceSwitch.cs
- ArithmeticException.cs
- MatrixAnimationUsingKeyFrames.cs
- AnchorEditor.cs
- Button.cs
- FixUp.cs
- MappingMetadataHelper.cs
- ConfigXmlReader.cs
- AutomationElementCollection.cs
- ElementHostAutomationPeer.cs
- CompModSwitches.cs
- ADMembershipUser.cs
- DrawingGroup.cs
- GroupBoxRenderer.cs
- complextypematerializer.cs
- HttpProfileGroupBase.cs
- GlyphInfoList.cs
- SchemaNames.cs
- ChineseLunisolarCalendar.cs
- Span.cs
- FileInfo.cs
- UserControl.cs
- MenuScrollingVisibilityConverter.cs
- ActivityTypeResolver.xaml.cs
- OdbcHandle.cs
- ReadContentAsBinaryHelper.cs
- StaticSiteMapProvider.cs
- Marshal.cs
- RelationshipFixer.cs
- OracleNumber.cs
- TextElementCollectionHelper.cs
- DataViewSettingCollection.cs
- BatchWriter.cs
- DispatcherTimer.cs
- WorkflowApplicationAbortedEventArgs.cs
- DeobfuscatingStream.cs
- MetadataArtifactLoaderResource.cs
- FileVersionInfo.cs
- DynamicRenderer.cs
- ProvideValueServiceProvider.cs
- Single.cs
- NamespaceInfo.cs
- OleDbConnectionInternal.cs
- DataTableCollection.cs
- UrlPath.cs
- UrlMapping.cs
- CookielessHelper.cs
- SelectedGridItemChangedEvent.cs
- TextParagraphProperties.cs
- PartialTrustHelpers.cs
- DataGridViewLinkCell.cs
- ServiceActivationException.cs
- CreateUserWizardStep.cs
- SparseMemoryStream.cs
- EndCreateSecurityTokenRequest.cs
- Clipboard.cs
- ListViewCommandEventArgs.cs
- ErrorTableItemStyle.cs
- TemplateParser.cs
- DataGridBeginningEditEventArgs.cs
- FaultDescription.cs
- CompilerError.cs
- PeerObject.cs
- XpsFilter.cs
- SafeArchiveContext.cs
- HttpCacheParams.cs
- StoryFragments.cs
- XmlUTF8TextReader.cs
- BinaryUtilClasses.cs
- MultiAsyncResult.cs
- MembershipSection.cs
- XmlSchemaAppInfo.cs
- PointHitTestParameters.cs
- SpellerHighlightLayer.cs
- HealthMonitoringSection.cs
- SafePEFileHandle.cs
- UInt32Storage.cs
- InvalidAsynchronousStateException.cs
- TreeNodeCollection.cs
- DataGridViewAccessibleObject.cs
- StylusPointProperties.cs
- TextAdaptor.cs