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
- HttpListenerContext.cs
- DataGridViewToolTip.cs
- StylusPointDescription.cs
- TargetException.cs
- ElapsedEventArgs.cs
- KnownBoxes.cs
- PersonalizationProvider.cs
- TextAnchor.cs
- ListViewTableRow.cs
- SBCSCodePageEncoding.cs
- MenuDesigner.cs
- GeneralTransform3DTo2D.cs
- ChannelProtectionRequirements.cs
- BitmapFrameEncode.cs
- SplitterPanel.cs
- SecurityTokenResolver.cs
- CompilationLock.cs
- Compiler.cs
- MenuItemStyleCollectionEditor.cs
- MetafileHeaderWmf.cs
- KeyValueConfigurationElement.cs
- WindowsNonControl.cs
- WeakEventManager.cs
- SweepDirectionValidation.cs
- PeerConnector.cs
- TreeNodeStyleCollection.cs
- ParserStreamGeometryContext.cs
- OutOfProcStateClientManager.cs
- XsdBuilder.cs
- MultiView.cs
- UnsafeNativeMethodsPenimc.cs
- ProtocolElement.cs
- OracleColumn.cs
- BitmapPalette.cs
- XmlnsCache.cs
- ServiceRouteHandler.cs
- TextBoxAutoCompleteSourceConverter.cs
- CodeDomLocalizationProvider.cs
- ChangePasswordDesigner.cs
- Rotation3DAnimation.cs
- ColumnClickEvent.cs
- DefaultEvaluationContext.cs
- SerialErrors.cs
- IPGlobalProperties.cs
- UserControl.cs
- PathParser.cs
- GeneralTransform3DGroup.cs
- PriorityChain.cs
- MtomMessageEncodingBindingElement.cs
- WebPartsPersonalization.cs
- IntSecurity.cs
- XmlNodeReader.cs
- GeometryDrawing.cs
- DataListItemCollection.cs
- IODescriptionAttribute.cs
- MimeWriter.cs
- GenericAuthenticationEventArgs.cs
- HtmlElement.cs
- ITextView.cs
- EdmItemCollection.cs
- IsolationInterop.cs
- SystemShuttingDownException.cs
- TemplateControlParser.cs
- DocumentCollection.cs
- KeysConverter.cs
- SoapDocumentServiceAttribute.cs
- FilterElement.cs
- contentDescriptor.cs
- XmlHierarchyData.cs
- XmlHelper.cs
- XmlValueConverter.cs
- XmlSerializationWriter.cs
- ConfigurationValues.cs
- diagnosticsswitches.cs
- DefaultEventAttribute.cs
- RequestStatusBarUpdateEventArgs.cs
- ValueUtilsSmi.cs
- TextModifierScope.cs
- ForceCopyBuildProvider.cs
- HttpProfileBase.cs
- GeneralTransformGroup.cs
- CommandField.cs
- XmlRawWriter.cs
- ControlCollection.cs
- HotCommands.cs
- XmlCDATASection.cs
- DynamicMethod.cs
- WebPartCollection.cs
- MSAAWinEventWrap.cs
- XPathSelectionIterator.cs
- Freezable.cs
- LocalValueEnumerator.cs
- UrlMapping.cs
- DoubleAnimationUsingKeyFrames.cs
- Rotation3DAnimationUsingKeyFrames.cs
- RegexCode.cs
- HttpWebResponse.cs
- DecoderBestFitFallback.cs
- JsonSerializer.cs
- BaseComponentEditor.cs