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
- DataBoundControlParameterTarget.cs
- Mappings.cs
- brushes.cs
- ExpressionBuilderCollection.cs
- PeerNameRecordCollection.cs
- Compiler.cs
- CodeCompileUnit.cs
- RowBinding.cs
- Decimal.cs
- InkCanvasSelection.cs
- cookiecollection.cs
- CharacterMetrics.cs
- Style.cs
- SQLByte.cs
- TemplateParser.cs
- TrackingProfile.cs
- SortFieldComparer.cs
- _TLSstream.cs
- InvalidContentTypeException.cs
- Int32AnimationUsingKeyFrames.cs
- HitTestWithPointDrawingContextWalker.cs
- GlyphTypeface.cs
- FixedTextPointer.cs
- IIS7WorkerRequest.cs
- TaiwanCalendar.cs
- ObfuscationAttribute.cs
- DiscoveryProxy.cs
- ColumnPropertiesGroup.cs
- MatrixCamera.cs
- MasterPageParser.cs
- ScrollItemPattern.cs
- AttachedAnnotationChangedEventArgs.cs
- DataError.cs
- XmlQualifiedName.cs
- StatusStrip.cs
- EndEvent.cs
- NetSectionGroup.cs
- TypeValidationEventArgs.cs
- SqlClientWrapperSmiStreamChars.cs
- Module.cs
- MobileListItem.cs
- XamlPoint3DCollectionSerializer.cs
- PointUtil.cs
- Comparer.cs
- ReadOnlyTernaryTree.cs
- MouseButtonEventArgs.cs
- HashJoinQueryOperatorEnumerator.cs
- TextRangeAdaptor.cs
- JsonEnumDataContract.cs
- StaticResourceExtension.cs
- RadioButtonPopupAdapter.cs
- SchemaImporter.cs
- Icon.cs
- ListItemConverter.cs
- itemelement.cs
- ConnectionString.cs
- ScriptIgnoreAttribute.cs
- PtsHelper.cs
- LogFlushAsyncResult.cs
- ConnectionStringsSection.cs
- StatusBar.cs
- InstanceDescriptor.cs
- EncodedStreamFactory.cs
- URLMembershipCondition.cs
- BitmapImage.cs
- TouchPoint.cs
- _ContextAwareResult.cs
- HighlightComponent.cs
- BindStream.cs
- ManipulationDeltaEventArgs.cs
- EntityKey.cs
- WithStatement.cs
- Pick.cs
- ReverseInheritProperty.cs
- ExpressionVisitorHelpers.cs
- AnimationClock.cs
- HostingEnvironmentWrapper.cs
- PropertyFilterAttribute.cs
- ListViewInsertedEventArgs.cs
- PerformanceCounterNameAttribute.cs
- FixedFindEngine.cs
- SpecularMaterial.cs
- RoleService.cs
- ManipulationPivot.cs
- ObjectDataSourceDisposingEventArgs.cs
- IPGlobalProperties.cs
- DataGridState.cs
- WebPartDisplayModeCollection.cs
- PermissionSet.cs
- XmlSchemaElement.cs
- KeyConstraint.cs
- ServiceMemoryGates.cs
- WebSysDisplayNameAttribute.cs
- FacetValueContainer.cs
- ProxyBuilder.cs
- TypeSystem.cs
- DataTableReaderListener.cs
- SqlBinder.cs
- X509ClientCertificateAuthentication.cs
- Graphics.cs