Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / 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 : [....] - 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlFunctions.cs
- DataBoundControlDesigner.cs
- ClientProtocol.cs
- HitTestResult.cs
- __ComObject.cs
- TextBox.cs
- WrappedIUnknown.cs
- SqlRetyper.cs
- DataGridCellItemAutomationPeer.cs
- PowerStatus.cs
- NativeMethodsOther.cs
- KnownColorTable.cs
- TreeViewImageGenerator.cs
- Root.cs
- SimpleBitVector32.cs
- WindowExtensionMethods.cs
- StylusEditingBehavior.cs
- ClickablePoint.cs
- EndpointConfigContainer.cs
- HtmlMeta.cs
- CellParaClient.cs
- ReflectPropertyDescriptor.cs
- StorageEntitySetMapping.cs
- DefaultTextStore.cs
- Cursor.cs
- SqlClientFactory.cs
- RSAPKCS1SignatureFormatter.cs
- AuthenticationModuleElement.cs
- PowerModeChangedEventArgs.cs
- SafeArrayRankMismatchException.cs
- SoapParser.cs
- NonBatchDirectoryCompiler.cs
- Util.cs
- GestureRecognizer.cs
- ItemsChangedEventArgs.cs
- JsonSerializer.cs
- MouseDevice.cs
- RadioButton.cs
- MeshGeometry3D.cs
- PrintController.cs
- FixUpCollection.cs
- XmlSchemas.cs
- TextServicesCompartmentEventSink.cs
- Intellisense.cs
- TemplateControl.cs
- GenericUI.cs
- CodeTypeParameterCollection.cs
- ContentPropertyAttribute.cs
- TypedTableHandler.cs
- TextBounds.cs
- CmsUtils.cs
- __ComObject.cs
- TextMarkerSource.cs
- WpfKnownMember.cs
- RemoteEndpointMessageProperty.cs
- ExpressionPrinter.cs
- MatrixTransform.cs
- CommandID.cs
- FormatterServices.cs
- CodeSubDirectory.cs
- XmlElement.cs
- _UriTypeConverter.cs
- WebDescriptionAttribute.cs
- Padding.cs
- VirtualDirectoryMappingCollection.cs
- DataServicePagingProviderWrapper.cs
- SafeLocalMemHandle.cs
- ContractMapping.cs
- MultitargetingHelpers.cs
- StrongNamePublicKeyBlob.cs
- PropertyToken.cs
- ping.cs
- ContractUtils.cs
- MultipleViewPattern.cs
- ModifierKeysConverter.cs
- WorkflowMessageEventHandler.cs
- SafeBitVector32.cs
- CachedFontFamily.cs
- NetworkCredential.cs
- ProvidersHelper.cs
- TemplateControlParser.cs
- CompensatableTransactionScopeActivityDesigner.cs
- TailPinnedEventArgs.cs
- OracleCommandSet.cs
- DataTemplateKey.cs
- XmlAutoDetectWriter.cs
- ImplicitInputBrush.cs
- CodeLabeledStatement.cs
- TypeReference.cs
- EndpointConfigContainer.cs
- MouseActionValueSerializer.cs
- InfiniteIntConverter.cs
- ClickablePoint.cs
- FeatureAttribute.cs
- IODescriptionAttribute.cs
- MenuAutomationPeer.cs
- QueryOperationResponseOfT.cs
- SecurityKeyType.cs
- TextSpanModifier.cs
- ExternalFile.cs