Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Core / CSharp / System / Windows / Media / DrawingCollection.cs / 1 / DrawingCollection.cs
//---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // Description: This file contains non-generated DrawingCollection // methods. // // History: // // 2005/03/18 : timothyc - Created it. // //--------------------------------------------------------------------------- using System.Collections; using System.Collections.Generic; using System.Windows.Media.Animation; using System.Windows.Markup; namespace System.Windows.Media { ////// Collection of Drawing objects /// public sealed partial class DrawingCollection : Animatable, IList, IList{ /// /// Appends the entire input DrawingCollection, while only firing a single set of /// public events. If an exception is thrown from the public events, the /// Append operation is rolled back. /// internal void TransactionalAppend(DrawingCollection collectionToAppend) { // Use appendCount to avoid inconsistencies & runaway loops when // this == collectionToAppend, and to ensure collectionToAppend.Count // is only evaluated once. int appendCount = collectionToAppend.Count; // First, append the collection for(int i = 0; i < appendCount; i++) { AddWithoutFiringPublicEvents(collectionToAppend.Internal_GetItem(i)); } // Fire the public Changed event after all the elements have been added. // // If an exception is thrown, then the Append operation is rolled-back without // firing additional events. try { FireChanged(); } catch (Exception) { // Compute the number of elements that existed before the append int beforeAppendCount = Count - appendCount; // Remove the appended elements in reverse order without firing Changed events. for ( int i = Count - 1; // Start at the current last index i >= beforeAppendCount; // Until the previous last index i-- // Move to the preceding index ) { RemoveAtWithoutFiringPublicEvents(i); } // Avoid firing WritePostscript events (e.g., OnChanged) after rolling-back // the current operation. // // This ensures that only a single set of events is fired for both exceptional & // typical cases, and it's likely that firing events would cause another exception. throw; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // Description: This file contains non-generated DrawingCollection // methods. // // History: // // 2005/03/18 : timothyc - Created it. // //--------------------------------------------------------------------------- using System.Collections; using System.Collections.Generic; using System.Windows.Media.Animation; using System.Windows.Markup; namespace System.Windows.Media { ////// Collection of Drawing objects /// public sealed partial class DrawingCollection : Animatable, IList, IList{ /// /// Appends the entire input DrawingCollection, while only firing a single set of /// public events. If an exception is thrown from the public events, the /// Append operation is rolled back. /// internal void TransactionalAppend(DrawingCollection collectionToAppend) { // Use appendCount to avoid inconsistencies & runaway loops when // this == collectionToAppend, and to ensure collectionToAppend.Count // is only evaluated once. int appendCount = collectionToAppend.Count; // First, append the collection for(int i = 0; i < appendCount; i++) { AddWithoutFiringPublicEvents(collectionToAppend.Internal_GetItem(i)); } // Fire the public Changed event after all the elements have been added. // // If an exception is thrown, then the Append operation is rolled-back without // firing additional events. try { FireChanged(); } catch (Exception) { // Compute the number of elements that existed before the append int beforeAppendCount = Count - appendCount; // Remove the appended elements in reverse order without firing Changed events. for ( int i = Count - 1; // Start at the current last index i >= beforeAppendCount; // Until the previous last index i-- // Move to the preceding index ) { RemoveAtWithoutFiringPublicEvents(i); } // Avoid firing WritePostscript events (e.g., OnChanged) after rolling-back // the current operation. // // This ensures that only a single set of events is fired for both exceptional & // typical cases, and it's likely that firing events would cause another exception. throw; } } } } // 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
- ClientRoleProvider.cs
- ImportContext.cs
- LoginView.cs
- TextTreeObjectNode.cs
- InputMethodStateTypeInfo.cs
- DSASignatureDeformatter.cs
- SiteMapPath.cs
- DetailsViewPagerRow.cs
- XhtmlBasicCommandAdapter.cs
- ExpressionPrefixAttribute.cs
- SiteMapPath.cs
- HandlerFactoryCache.cs
- UpdateExpressionVisitor.cs
- UTF7Encoding.cs
- SpnegoTokenAuthenticator.cs
- DateTime.cs
- DataShape.cs
- UpdatableGenericsFeature.cs
- SqlBuffer.cs
- ObjectDataSource.cs
- ManagedWndProcTracker.cs
- EmbeddedMailObjectsCollection.cs
- MbpInfo.cs
- WindowExtensionMethods.cs
- QilLoop.cs
- PropertyInformation.cs
- MimeParameterWriter.cs
- MediaTimeline.cs
- X509Certificate.cs
- XmlIlTypeHelper.cs
- SafeFindHandle.cs
- TableCellsCollectionEditor.cs
- SessionStateUtil.cs
- FrameworkElement.cs
- DataList.cs
- XmlSchemaException.cs
- ValueType.cs
- EqualityArray.cs
- AppModelKnownContentFactory.cs
- StorageEndPropertyMapping.cs
- HttpRequestCacheValidator.cs
- XsdBuildProvider.cs
- AutomationPattern.cs
- ObjectDataSource.cs
- DataGridViewCellStyleConverter.cs
- TableLayoutColumnStyleCollection.cs
- Column.cs
- SimpleRecyclingCache.cs
- LOSFormatter.cs
- TextWriterTraceListener.cs
- DesignerCatalogPartChrome.cs
- Column.cs
- StringFormat.cs
- CompiledAction.cs
- CalendarDataBindingHandler.cs
- StorageModelBuildProvider.cs
- XmlDocument.cs
- MenuAutoFormat.cs
- UdpChannelListener.cs
- TableHeaderCell.cs
- ObjectDataSource.cs
- ResourceIDHelper.cs
- ArgumentOutOfRangeException.cs
- HtmlMeta.cs
- ExplicitDiscriminatorMap.cs
- WorkflowFileItem.cs
- RadioButton.cs
- DataSourceNameHandler.cs
- XmlCollation.cs
- SmtpTransport.cs
- DataGridViewCellValidatingEventArgs.cs
- FrameworkElementAutomationPeer.cs
- LineInfo.cs
- DeleteMemberBinder.cs
- SafeNativeMethods.cs
- DynamicMethod.cs
- PermissionRequestEvidence.cs
- columnmapkeybuilder.cs
- MissingMethodException.cs
- MergablePropertyAttribute.cs
- OracleConnectionFactory.cs
- figurelengthconverter.cs
- PageWrapper.cs
- HtmlInputText.cs
- InertiaRotationBehavior.cs
- MulticastOption.cs
- SqlBulkCopyColumnMapping.cs
- ButtonChrome.cs
- InstanceLockException.cs
- Style.cs
- PerformanceCountersElement.cs
- HttpResponse.cs
- CardSpacePolicyElement.cs
- FixedTextSelectionProcessor.cs
- ApplicationActivator.cs
- WebControlsSection.cs
- MulticastNotSupportedException.cs
- Vector3DKeyFrameCollection.cs
- ThreadAbortException.cs
- ObjectManager.cs