Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / WindowCollection.cs / 1 / WindowCollection.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // WindowCollection can be used to interate over all the windows // that have been opened in the current application. // // History: // 08/10/04: kusumav Moved out of Application.cs to its own separate file. // //--------------------------------------------------------------------------- using System.Collections; using System.Diagnostics; namespace System.Windows { #region WindowCollection class ////// WindowCollection can be used to interate over all the windows that have been /// opened in the current application. /// // public sealed class WindowCollection : ICollection { //----------------------------------------------------- // // Public Methods // //----------------------------------------------------- #region Public Methods ////// Default Constructor /// public WindowCollection() { _list = new ArrayList(1); } internal WindowCollection(int count) { Debug.Assert(count >= 0, "count must not be less than zero"); _list = new ArrayList(count); } #endregion Public Methods //------------------------------------------------------ // // Operator overload // //----------------------------------------------------- #region Operator overload ////// Overloaded [] operator to access the WindowCollection list /// public Window this[int index] { get { return _list[index] as Window; } } #endregion Operator overload //------------------------------------------------------ // // IEnumerable implementation // //------------------------------------------------------ #region IEnumerable implementation ////// GetEnumerator /// ///public IEnumerator GetEnumerator() { return _list.GetEnumerator(); } #endregion IEnumerable implementation //------------------------------------------------------- // // ICollection implementation (derives from IEnumerable) // //-------------------------------------------------------- #region ICollection implementation /// /// CopyTo /// /// /// void ICollection.CopyTo(Array array, int index) { _list.CopyTo(array, index); } ////// CopyTo /// /// /// public void CopyTo(Window[] array, int index) { _list.CopyTo(array, index); } ////// Count property /// public int Count { get { return _list.Count; } } ////// IsSynchronized /// public bool IsSynchronized { get { return _list.IsSynchronized; } } ////// SyncRoot /// public Object SyncRoot { get { return _list.SyncRoot; } } #endregion ICollection implementation //----------------------------------------------------- // // Internal Methods // //----------------------------------------------------- #region Internal Methods internal WindowCollection Clone() { WindowCollection clone; lock (_list.SyncRoot) { clone = new WindowCollection(_list.Count); for (int i = 0; i < _list.Count; i++) { clone._list.Add(_list[i]); } } return clone; } internal void Remove(Window win) { lock (_list.SyncRoot) { _list.Remove(win); } } internal void RemoveAt(int index) { lock (_list.SyncRoot) { _list.Remove(index); } } internal int Add (Window win) { lock (_list.SyncRoot) { return _list.Add(win); } } internal bool HasItem(Window win) { lock (_list.SyncRoot) { for (int i = 0; i < _list.Count; i++) { if (_list[i] == win) { return true; } } } return false; } #endregion Internal Methods //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ #region Private Fields private ArrayList _list; #endregion Private Fields } #endregion WindowCollection class } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // WindowCollection can be used to interate over all the windows // that have been opened in the current application. // // History: // 08/10/04: kusumav Moved out of Application.cs to its own separate file. // //--------------------------------------------------------------------------- using System.Collections; using System.Diagnostics; namespace System.Windows { #region WindowCollection class ////// WindowCollection can be used to interate over all the windows that have been /// opened in the current application. /// // public sealed class WindowCollection : ICollection { //----------------------------------------------------- // // Public Methods // //----------------------------------------------------- #region Public Methods ////// Default Constructor /// public WindowCollection() { _list = new ArrayList(1); } internal WindowCollection(int count) { Debug.Assert(count >= 0, "count must not be less than zero"); _list = new ArrayList(count); } #endregion Public Methods //------------------------------------------------------ // // Operator overload // //----------------------------------------------------- #region Operator overload ////// Overloaded [] operator to access the WindowCollection list /// public Window this[int index] { get { return _list[index] as Window; } } #endregion Operator overload //------------------------------------------------------ // // IEnumerable implementation // //------------------------------------------------------ #region IEnumerable implementation ////// GetEnumerator /// ///public IEnumerator GetEnumerator() { return _list.GetEnumerator(); } #endregion IEnumerable implementation //------------------------------------------------------- // // ICollection implementation (derives from IEnumerable) // //-------------------------------------------------------- #region ICollection implementation /// /// CopyTo /// /// /// void ICollection.CopyTo(Array array, int index) { _list.CopyTo(array, index); } ////// CopyTo /// /// /// public void CopyTo(Window[] array, int index) { _list.CopyTo(array, index); } ////// Count property /// public int Count { get { return _list.Count; } } ////// IsSynchronized /// public bool IsSynchronized { get { return _list.IsSynchronized; } } ////// SyncRoot /// public Object SyncRoot { get { return _list.SyncRoot; } } #endregion ICollection implementation //----------------------------------------------------- // // Internal Methods // //----------------------------------------------------- #region Internal Methods internal WindowCollection Clone() { WindowCollection clone; lock (_list.SyncRoot) { clone = new WindowCollection(_list.Count); for (int i = 0; i < _list.Count; i++) { clone._list.Add(_list[i]); } } return clone; } internal void Remove(Window win) { lock (_list.SyncRoot) { _list.Remove(win); } } internal void RemoveAt(int index) { lock (_list.SyncRoot) { _list.Remove(index); } } internal int Add (Window win) { lock (_list.SyncRoot) { return _list.Add(win); } } internal bool HasItem(Window win) { lock (_list.SyncRoot) { for (int i = 0; i < _list.Count; i++) { if (_list[i] == win) { return true; } } } return false; } #endregion Internal Methods //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ #region Private Fields private ArrayList _list; #endregion Private Fields } #endregion WindowCollection class } // 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
- MailDefinition.cs
- TriggerCollection.cs
- WebDescriptionAttribute.cs
- IndependentlyAnimatedPropertyMetadata.cs
- ObjectQueryExecutionPlan.cs
- ErrorFormatter.cs
- CellCreator.cs
- CmsUtils.cs
- SchemaElementLookUpTable.cs
- OperationCanceledException.cs
- XmlSchemaObjectTable.cs
- XsdBuildProvider.cs
- EncoderFallback.cs
- WebPartDescriptionCollection.cs
- GenerateHelper.cs
- HwndSource.cs
- ScriptingRoleServiceSection.cs
- DiagnosticTrace.cs
- TreeViewItemAutomationPeer.cs
- StandardBindingOptionalReliableSessionElement.cs
- SoapInteropTypes.cs
- SpellCheck.cs
- _HeaderInfoTable.cs
- ImageCodecInfoPrivate.cs
- PictureBox.cs
- LiteralLink.cs
- DependencyStoreSurrogate.cs
- Mutex.cs
- DodSequenceMerge.cs
- XmlComplianceUtil.cs
- OrderedParallelQuery.cs
- HTMLTextWriter.cs
- XPathParser.cs
- StaticExtensionConverter.cs
- DrawingVisualDrawingContext.cs
- SmtpTransport.cs
- SamlAttributeStatement.cs
- ToolStripSystemRenderer.cs
- ControlValuePropertyAttribute.cs
- AxisAngleRotation3D.cs
- PriorityRange.cs
- CTreeGenerator.cs
- GridViewCancelEditEventArgs.cs
- ToolStripGrip.cs
- WebPartEventArgs.cs
- TimelineCollection.cs
- UpdateException.cs
- OdbcConnection.cs
- TcpAppDomainProtocolHandler.cs
- GenericTypeParameterBuilder.cs
- SoapWriter.cs
- LoginName.cs
- ItemCollection.cs
- EntityProxyFactory.cs
- RichTextBoxConstants.cs
- AsnEncodedData.cs
- LabelDesigner.cs
- AttachInfo.cs
- SqlClientPermission.cs
- autovalidator.cs
- FunctionParameter.cs
- SecurityPolicyVersion.cs
- PassportAuthenticationModule.cs
- SmtpFailedRecipientException.cs
- UTF7Encoding.cs
- ResourceSetExpression.cs
- InkCanvasInnerCanvas.cs
- PostBackTrigger.cs
- PrinterResolution.cs
- PresentationTraceSources.cs
- Base64Decoder.cs
- DesignerSelectionListAdapter.cs
- XmlnsCache.cs
- NodeLabelEditEvent.cs
- ElementHost.cs
- FileResponseElement.cs
- ApplicationServiceHelper.cs
- BatchParser.cs
- Vector3D.cs
- InputLanguageEventArgs.cs
- AggregateNode.cs
- WebPartEditorCancelVerb.cs
- peersecurityelement.cs
- UnsafeNativeMethods.cs
- OperationAbortedException.cs
- WindowPattern.cs
- Decoder.cs
- X509AsymmetricSecurityKey.cs
- SelectionHighlightInfo.cs
- FlowStep.cs
- SigningCredentials.cs
- Message.cs
- ConnectionPoint.cs
- ParameterToken.cs
- FrameAutomationPeer.cs
- BrushProxy.cs
- InkCanvasSelectionAdorner.cs
- BinaryReader.cs
- TrackingRecord.cs
- CqlWriter.cs