Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- XmlSchemaAppInfo.cs
- MenuAdapter.cs
- SchemaImporterExtensionElementCollection.cs
- SQLRoleProvider.cs
- XmlWellformedWriter.cs
- EntityCollection.cs
- PropertyItem.cs
- IgnoreFlushAndCloseStream.cs
- ComboBox.cs
- EpmCustomContentDeSerializer.cs
- ChangeInterceptorAttribute.cs
- CodeCommentStatementCollection.cs
- ResourceExpressionBuilder.cs
- InnerItemCollectionView.cs
- CodeMethodInvokeExpression.cs
- PageTheme.cs
- UnsafeNativeMethodsPenimc.cs
- TypeHelpers.cs
- Visual3D.cs
- ActivationService.cs
- BindingCollection.cs
- InternalDispatchObject.cs
- ReceiveCompletedEventArgs.cs
- XmlName.cs
- ColorBlend.cs
- listitem.cs
- OleDbParameterCollection.cs
- ScrollPattern.cs
- WebRequestModuleElement.cs
- VectorKeyFrameCollection.cs
- SectionXmlInfo.cs
- ProcessModuleCollection.cs
- SystemShuttingDownException.cs
- ControlBuilder.cs
- TextBoxDesigner.cs
- XmlReaderSettings.cs
- ReadOnlyDictionary.cs
- ProviderSettings.cs
- CodeCatchClause.cs
- MissingFieldException.cs
- DesignerVerbCollection.cs
- DataGridViewBand.cs
- NamedPipeProcessProtocolHandler.cs
- BuildResultCache.cs
- TableProviderWrapper.cs
- SqlUtils.cs
- RuleSettings.cs
- DataRelation.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- WebConvert.cs
- WindowInteropHelper.cs
- SessionStateUtil.cs
- DependentTransaction.cs
- ListenDesigner.cs
- WebPartEditorCancelVerb.cs
- SqlDataRecord.cs
- Grant.cs
- InkCanvasFeedbackAdorner.cs
- BookmarkScopeHandle.cs
- SQLSingleStorage.cs
- DescendantBaseQuery.cs
- TabItemWrapperAutomationPeer.cs
- QuadraticEase.cs
- PasswordTextContainer.cs
- EventDescriptor.cs
- NavigationProperty.cs
- ApplicationTrust.cs
- NegotiationTokenAuthenticator.cs
- FormatterConverter.cs
- ItemChangedEventArgs.cs
- PageCatalogPart.cs
- ServerValidateEventArgs.cs
- SafeRegistryHandle.cs
- TextSegment.cs
- UnaryQueryOperator.cs
- ColorTranslator.cs
- MetadataPropertyvalue.cs
- XmlNodeList.cs
- ModelFunction.cs
- AssociationSet.cs
- PathGeometry.cs
- DatePickerDateValidationErrorEventArgs.cs
- DataTrigger.cs
- RowUpdatingEventArgs.cs
- NameGenerator.cs
- ApplicationSecurityInfo.cs
- RequestCacheEntry.cs
- RequestCachePolicy.cs
- TextTreeRootTextBlock.cs
- RepeaterItem.cs
- SqlDataSourceSelectingEventArgs.cs
- UnaryNode.cs
- Substitution.cs
- XmlException.cs
- DataTableTypeConverter.cs
- RightsManagementInformation.cs
- EventlogProvider.cs
- UnmanagedMemoryStreamWrapper.cs
- StdValidatorsAndConverters.cs
- MatrixAnimationUsingKeyFrames.cs