Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- NotificationContext.cs
- ProgressBarAutomationPeer.cs
- sqlmetadatafactory.cs
- BufferedGraphicsContext.cs
- EnterpriseServicesHelper.cs
- CollectionViewProxy.cs
- WsatServiceCertificate.cs
- PkcsUtils.cs
- TextDecoration.cs
- CompareInfo.cs
- FieldInfo.cs
- TypefaceMap.cs
- DataGridRelationshipRow.cs
- _CommandStream.cs
- FontFamilyIdentifier.cs
- HttpResponse.cs
- XamlToRtfParser.cs
- AuthenticationConfig.cs
- WsdlBuildProvider.cs
- TextEndOfParagraph.cs
- AdornedElementPlaceholder.cs
- InkSerializer.cs
- ZipIOCentralDirectoryBlock.cs
- ResourceDisplayNameAttribute.cs
- StylusButtonEventArgs.cs
- CharacterBufferReference.cs
- SizeAnimationClockResource.cs
- ConfigXmlComment.cs
- UpdateRecord.cs
- WebPartDescription.cs
- ProgressBarBrushConverter.cs
- ViewService.cs
- Rect3DValueSerializer.cs
- SiteMapNodeItemEventArgs.cs
- TemplateControlCodeDomTreeGenerator.cs
- WebPartEditVerb.cs
- CodeSubDirectory.cs
- DescriptionAttribute.cs
- _PooledStream.cs
- CreateUserWizardStep.cs
- ToolStripLabel.cs
- CheckedPointers.cs
- PictureBox.cs
- EditorBrowsableAttribute.cs
- EventMappingSettingsCollection.cs
- PersonalizationAdministration.cs
- Event.cs
- CaseKeyBox.ViewModel.cs
- SystemInformation.cs
- GridViewRowCollection.cs
- DurableErrorHandler.cs
- LayoutEngine.cs
- RuleSettings.cs
- Zone.cs
- BuiltInExpr.cs
- ModelItemCollection.cs
- GlobalizationAssembly.cs
- WebPartMinimizeVerb.cs
- BasicBrowserDialog.designer.cs
- DataTableClearEvent.cs
- PropertyGroupDescription.cs
- DataColumnPropertyDescriptor.cs
- PermissionSet.cs
- OptimalTextSource.cs
- TextTreeInsertElementUndoUnit.cs
- WpfGeneratedKnownTypes.cs
- XhtmlBasicValidatorAdapter.cs
- PerformanceCounterLib.cs
- XmlSchemas.cs
- Script.cs
- MsmqIntegrationSecurityElement.cs
- TreeViewEvent.cs
- ResumeStoryboard.cs
- RequiredAttributeAttribute.cs
- StructuredType.cs
- FormViewPagerRow.cs
- DropSource.cs
- SQLByte.cs
- ProcessHostFactoryHelper.cs
- Speller.cs
- BufferAllocator.cs
- DbConnectionPool.cs
- ColorAnimationBase.cs
- DocumentApplicationJournalEntry.cs
- SplitterDesigner.cs
- NumberEdit.cs
- SplineQuaternionKeyFrame.cs
- FloaterBaseParagraph.cs
- AddInControllerImpl.cs
- SHA512Managed.cs
- DetailsViewUpdateEventArgs.cs
- ProtocolsConfiguration.cs
- RawStylusInputCustomDataList.cs
- CodeExporter.cs
- SerialStream.cs
- Transactions.cs
- DeviceContext.cs
- StreamInfo.cs
- StorageComplexTypeMapping.cs
- PropertyDescriptor.cs