Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- ConstraintConverter.cs
- GridViewUpdateEventArgs.cs
- EntityStoreSchemaGenerator.cs
- Clipboard.cs
- PlainXmlSerializer.cs
- GridSplitter.cs
- unitconverter.cs
- DependencyProperty.cs
- TargetPerspective.cs
- OutputCacheSettings.cs
- CallbackValidator.cs
- DialogResultConverter.cs
- GeneralTransform2DTo3D.cs
- HotCommands.cs
- ToolStripTextBox.cs
- TemplateAction.cs
- CodeTypeReference.cs
- SignedPkcs7.cs
- GridItemPatternIdentifiers.cs
- SystemFonts.cs
- PersonalizationStateQuery.cs
- DocumentSignatureManager.cs
- XmlSchemaProviderAttribute.cs
- ChangeProcessor.cs
- ProfileGroupSettingsCollection.cs
- CreatingCookieEventArgs.cs
- Native.cs
- URLMembershipCondition.cs
- OdbcFactory.cs
- ServiceControllerDesigner.cs
- QuaternionAnimationBase.cs
- HwndProxyElementProvider.cs
- UnsafeNativeMethods.cs
- CalendarAutomationPeer.cs
- MessageSecurityOverMsmq.cs
- X509Certificate2Collection.cs
- ServiceNotStartedException.cs
- SignatureDescription.cs
- NativeRecognizer.cs
- WebPartMenuStyle.cs
- AddressHeader.cs
- DateRangeEvent.cs
- SHA384Managed.cs
- ListViewInsertedEventArgs.cs
- WebSysDefaultValueAttribute.cs
- SqlNamer.cs
- ScriptServiceAttribute.cs
- LessThan.cs
- SiteMap.cs
- DataPointer.cs
- DBPropSet.cs
- UnsafeNativeMethodsTablet.cs
- EmptyTextWriter.cs
- MenuAutoFormat.cs
- FileLoadException.cs
- SQLInt16Storage.cs
- ThicknessAnimationBase.cs
- GuidelineCollection.cs
- QilBinary.cs
- ConnectionProviderAttribute.cs
- HttpHeaderCollection.cs
- ResXResourceReader.cs
- RecommendedAsConfigurableAttribute.cs
- BinHexDecoder.cs
- validationstate.cs
- EndOfStreamException.cs
- LeafCellTreeNode.cs
- ListView.cs
- CodeTypeOfExpression.cs
- ExtensionDataReader.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- CqlParserHelpers.cs
- InputMethod.cs
- StateManagedCollection.cs
- StringInfo.cs
- unsafenativemethodsother.cs
- GenericTextProperties.cs
- XmlStreamStore.cs
- TimeZone.cs
- Nodes.cs
- SrgsNameValueTag.cs
- WebProxyScriptElement.cs
- TraceListener.cs
- Style.cs
- Error.cs
- BulletedListEventArgs.cs
- CacheForPrimitiveTypes.cs
- SQLDecimalStorage.cs
- FixedStringLookup.cs
- IResourceProvider.cs
- TimeSpanOrInfiniteValidator.cs
- StateDesigner.TransitionInfo.cs
- ObjectConverter.cs
- AccessKeyManager.cs
- Metadata.cs
- DBConcurrencyException.cs
- FontUnitConverter.cs
- CheckBoxStandardAdapter.cs
- DefaultValueConverter.cs
- Attributes.cs