Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / DrawingCollection.cs / 1305600 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OwnerDrawPropertyBag.cs
- LinqDataSourceUpdateEventArgs.cs
- SQLString.cs
- NameSpaceEvent.cs
- XmlAnyAttributeAttribute.cs
- DataControlPagerLinkButton.cs
- XmlSchemaParticle.cs
- ADMembershipProvider.cs
- DataBindingExpressionBuilder.cs
- SHA512Cng.cs
- Normalizer.cs
- AnnotationAuthorChangedEventArgs.cs
- IPGlobalProperties.cs
- ControlTemplate.cs
- activationcontext.cs
- SrgsElementFactory.cs
- WindowsRichEdit.cs
- OleDbConnectionFactory.cs
- WindowsFormsLinkLabel.cs
- TabPage.cs
- safesecurityhelperavalon.cs
- ImageListImage.cs
- QueryResponse.cs
- StylusCollection.cs
- BamlLocalizableResourceKey.cs
- CompositeDataBoundControl.cs
- odbcmetadatafactory.cs
- ExpressionBuilder.cs
- XPathScanner.cs
- FirstQueryOperator.cs
- ObservableDictionary.cs
- Stylesheet.cs
- GridErrorDlg.cs
- DbConnectionPoolGroupProviderInfo.cs
- ColumnResizeUndoUnit.cs
- DataGridViewSortCompareEventArgs.cs
- DefaultPropertyAttribute.cs
- CodeStatement.cs
- CqlBlock.cs
- ToolStripPanelRenderEventArgs.cs
- EncoderBestFitFallback.cs
- XsltException.cs
- NetDataContractSerializer.cs
- ConfigXmlAttribute.cs
- ImmutableObjectAttribute.cs
- LinqTreeNodeEvaluator.cs
- ParameterRefs.cs
- ImportDesigner.xaml.cs
- ClrPerspective.cs
- WhiteSpaceTrimStringConverter.cs
- XmlFormatExtensionPrefixAttribute.cs
- FixedSOMLineRanges.cs
- DocumentPageHost.cs
- sqlinternaltransaction.cs
- LightweightCodeGenerator.cs
- BaseHashHelper.cs
- LogRestartAreaEnumerator.cs
- DataReceivedEventArgs.cs
- LinqDataSourceEditData.cs
- CodePageEncoding.cs
- CodeNamespaceImportCollection.cs
- SqlDataSourceStatusEventArgs.cs
- UniqueIdentifierService.cs
- CodeGroup.cs
- SettingsPropertyIsReadOnlyException.cs
- ServiceNameCollection.cs
- DecimalConstantAttribute.cs
- PeerInvitationResponse.cs
- MissingSatelliteAssemblyException.cs
- Maps.cs
- XmlReflectionMember.cs
- ReadContentAsBinaryHelper.cs
- MultiTargetingUtil.cs
- OleDbError.cs
- TableCell.cs
- TreeNodeBinding.cs
- GenericTypeParameterBuilder.cs
- FormatException.cs
- DecoderReplacementFallback.cs
- Root.cs
- SiteMapHierarchicalDataSourceView.cs
- StaticExtension.cs
- MediaSystem.cs
- CacheSection.cs
- UnsettableComboBox.cs
- ProfileSettingsCollection.cs
- MetafileHeaderWmf.cs
- TraceUtility.cs
- TextProviderWrapper.cs
- Int64.cs
- BCryptNative.cs
- Mouse.cs
- RegexTree.cs
- Comparer.cs
- PathFigureCollection.cs
- PageSettings.cs
- UpdateManifestForBrowserApplication.cs
- ZipIOExtraFieldZip64Element.cs
- TextFormatter.cs
- sqlmetadatafactory.cs