Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Shared / MS / Internal / FreezableOperations.cs / 1305600 / 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
- CompleteWizardStep.cs
- _AutoWebProxyScriptHelper.cs
- Utils.cs
- IteratorFilter.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- SecureEnvironment.cs
- CfgParser.cs
- SqlUdtInfo.cs
- BuilderPropertyEntry.cs
- FunctionCommandText.cs
- XmlCharType.cs
- ManagementDateTime.cs
- StringToken.cs
- EncoderNLS.cs
- WebPartConnectionsConnectVerb.cs
- CodeNamespaceImportCollection.cs
- Wildcard.cs
- Subtract.cs
- RemotingConfiguration.cs
- _SafeNetHandles.cs
- X509Certificate.cs
- ExtensibleClassFactory.cs
- BitArray.cs
- Timer.cs
- StylusPointPropertyId.cs
- RefreshResponseInfo.cs
- TextParagraph.cs
- ModelTreeEnumerator.cs
- PageClientProxyGenerator.cs
- DataGridTextBoxColumn.cs
- Typeface.cs
- DataGridViewElement.cs
- AccessDataSourceView.cs
- RegexStringValidator.cs
- SqlMethods.cs
- CustomAttributeSerializer.cs
- BmpBitmapDecoder.cs
- XmlSchemaProviderAttribute.cs
- ProxyWebPartConnectionCollection.cs
- DragEvent.cs
- XmlFormatWriterGenerator.cs
- XPathNavigatorReader.cs
- JapaneseCalendar.cs
- BaseValidator.cs
- UnauthorizedAccessException.cs
- HashHelper.cs
- MemberAssignment.cs
- _Connection.cs
- XmlHierarchyData.cs
- BitmapCache.cs
- ConstraintStruct.cs
- CornerRadius.cs
- SapiRecognizer.cs
- ConnectionManagementSection.cs
- Attribute.cs
- ScriptControlManager.cs
- ToolBarOverflowPanel.cs
- MultipartContentParser.cs
- EventlogProvider.cs
- InternalSafeNativeMethods.cs
- XmlDataProvider.cs
- SystemInfo.cs
- ImageAttributes.cs
- XmlSubtreeReader.cs
- InvalidDataException.cs
- ChildrenQuery.cs
- XmlQueryContext.cs
- ConnectivityStatus.cs
- Socket.cs
- SecurityToken.cs
- DataMemberAttribute.cs
- UpdatePanel.cs
- Odbc32.cs
- ExpressionList.cs
- CreatingCookieEventArgs.cs
- MultiTrigger.cs
- ReflectionUtil.cs
- Registry.cs
- FunctionImportElement.cs
- TransformProviderWrapper.cs
- CodeTypeDelegate.cs
- ConfigurationManagerInternal.cs
- ReservationCollection.cs
- Stylus.cs
- ReachPageContentCollectionSerializer.cs
- ErrorEventArgs.cs
- DataGridViewCellValidatingEventArgs.cs
- Sql8ConformanceChecker.cs
- MetadataUtilsSmi.cs
- StrongNamePublicKeyBlob.cs
- SqlGenerator.cs
- SpotLight.cs
- PageBreakRecord.cs
- ZipIOLocalFileHeader.cs
- PersianCalendar.cs
- WindowsTreeView.cs
- SpellerInterop.cs
- DataSourceView.cs
- GB18030Encoding.cs
- TableItemPatternIdentifiers.cs