Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Shared / MS / Internal / FreezableOperations.cs / 1 / FreezableOperations.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: FreezableOperations class definition. // // History: // 2005/02/02 : [....] - Created // //--------------------------------------------------------------------------- using System; using System.Windows; using MS.Internal.PresentationCore; namespace MS.Internal { ////// Internal static class which provides helper methods for common /// Freezable operations. /// [FriendAccessAllowed] // Built into Core, also used by Framework. internal static class FreezableOperations { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- //------------------------------------------------------ // // Internal Methods // //----------------------------------------------------- #region Internal Methods ////// A null-safe wrapper around Freezable.Clone(). (If a null /// is encountered it returns null.) /// internal static Freezable Clone(Freezable freezable) { if (freezable == null) { return null; } return freezable.Clone(); } ////// Semantically equivilent to Freezable.Clone().Freeze() except that /// GetAsFrozen avoids copying any portions of the Freezable graph /// which are already frozen. /// public static Freezable GetAsFrozen(Freezable freezable) { if (freezable == null) { return null; } return freezable.GetAsFrozen(); } ////// If freezable is already frozen, it returns freezable /// If freezable is not frozen, it returns a copy that is frozen if possible /// internal static Freezable GetAsFrozenIfPossible(Freezable freezable) { if (freezable == null) { return null; } if (freezable.CanFreeze) { freezable = freezable.GetAsFrozen(); } return freezable; } ////// Moves the specified changed handler from the old value /// to the new value correctly no-oping nulls. This is useful /// for non-Freezables which expose a Freezable property. /// internal static void PropagateChangedHandlers( Freezable oldValue, Freezable newValue, EventHandler changedHandler) { if (newValue != null && !newValue.IsFrozen) { newValue.Changed += changedHandler; } if (oldValue != null && !oldValue.IsFrozen) { oldValue.Changed -= changedHandler; } } #endregion Internal Methods } } // 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: FreezableOperations class definition. // // History: // 2005/02/02 : [....] - Created // //--------------------------------------------------------------------------- using System; using System.Windows; using MS.Internal.PresentationCore; namespace MS.Internal { ////// Internal static class which provides helper methods for common /// Freezable operations. /// [FriendAccessAllowed] // Built into Core, also used by Framework. internal static class FreezableOperations { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- //------------------------------------------------------ // // Internal Methods // //----------------------------------------------------- #region Internal Methods ////// A null-safe wrapper around Freezable.Clone(). (If a null /// is encountered it returns null.) /// internal static Freezable Clone(Freezable freezable) { if (freezable == null) { return null; } return freezable.Clone(); } ////// Semantically equivilent to Freezable.Clone().Freeze() except that /// GetAsFrozen avoids copying any portions of the Freezable graph /// which are already frozen. /// public static Freezable GetAsFrozen(Freezable freezable) { if (freezable == null) { return null; } return freezable.GetAsFrozen(); } ////// If freezable is already frozen, it returns freezable /// If freezable is not frozen, it returns a copy that is frozen if possible /// internal static Freezable GetAsFrozenIfPossible(Freezable freezable) { if (freezable == null) { return null; } if (freezable.CanFreeze) { freezable = freezable.GetAsFrozen(); } return freezable; } ////// Moves the specified changed handler from the old value /// to the new value correctly no-oping nulls. This is useful /// for non-Freezables which expose a Freezable property. /// internal static void PropagateChangedHandlers( Freezable oldValue, Freezable newValue, EventHandler changedHandler) { if (newValue != null && !newValue.IsFrozen) { newValue.Changed += changedHandler; } if (oldValue != null && !oldValue.IsFrozen) { oldValue.Changed -= changedHandler; } } #endregion Internal Methods } } // 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
- UserControlBuildProvider.cs
- LineInfo.cs
- Binding.cs
- DispatcherSynchronizationContext.cs
- GregorianCalendarHelper.cs
- DeflateStream.cs
- ConnectionManagementElement.cs
- GridItem.cs
- MbpInfo.cs
- UnsafeNativeMethodsTablet.cs
- NamespaceExpr.cs
- StrokeNode.cs
- DataSet.cs
- AttributeCollection.cs
- TextBoxDesigner.cs
- CriticalHandle.cs
- PointCollectionValueSerializer.cs
- HyperlinkAutomationPeer.cs
- _ConnectStream.cs
- Query.cs
- Int16KeyFrameCollection.cs
- SetterBaseCollection.cs
- ActivityBuilderHelper.cs
- ConfigurationException.cs
- LostFocusEventManager.cs
- PagesSection.cs
- AssemblyHelper.cs
- AdornerDecorator.cs
- ResXFileRef.cs
- NavigationCommands.cs
- ExtendLockAsyncResult.cs
- DependencyPropertyKey.cs
- HatchBrush.cs
- UserControl.cs
- VirtualPath.cs
- FileDialog_Vista.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- CancellationHandler.cs
- CheckoutException.cs
- DiscoveryRequestHandler.cs
- WebPartManager.cs
- AnnotationResource.cs
- BatchWriter.cs
- EncoderExceptionFallback.cs
- ListBase.cs
- Util.cs
- ListViewContainer.cs
- TargetControlTypeAttribute.cs
- StorageEntityContainerMapping.cs
- DependencyObjectPropertyDescriptor.cs
- CacheHelper.cs
- TreeNodeBinding.cs
- CollectionType.cs
- ControlBuilder.cs
- TableAutomationPeer.cs
- CodeStatement.cs
- SqlProviderServices.cs
- CompressionTransform.cs
- ExtensionWindowHeader.cs
- SoapConverter.cs
- ChameleonKey.cs
- RequestValidator.cs
- Schema.cs
- ForEachAction.cs
- InputScope.cs
- DecimalKeyFrameCollection.cs
- XmlDocument.cs
- SqlInfoMessageEvent.cs
- DetailsViewDeletedEventArgs.cs
- ForwardPositionQuery.cs
- ThemeableAttribute.cs
- RecipientInfo.cs
- FilteredReadOnlyMetadataCollection.cs
- XmlAttributeProperties.cs
- BrowserTree.cs
- WhitespaceReader.cs
- EnumType.cs
- TextParagraph.cs
- SqlFormatter.cs
- Stackframe.cs
- UserNameSecurityToken.cs
- TdsRecordBufferSetter.cs
- Metadata.cs
- GacUtil.cs
- RadioButtonDesigner.cs
- EmptyReadOnlyDictionaryInternal.cs
- AdobeCFFWrapper.cs
- MouseButton.cs
- xsdvalidator.cs
- SetStoryboardSpeedRatio.cs
- TextChange.cs
- ClientOperationFormatterProvider.cs
- ChannelDemuxer.cs
- BasicKeyConstraint.cs
- Typography.cs
- IndependentAnimationStorage.cs
- DataStreams.cs
- TaskFormBase.cs
- RequestCache.cs
- DefaultValueAttribute.cs