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
- IApplicationTrustManager.cs
- Wizard.cs
- CodeArgumentReferenceExpression.cs
- CompatibleIComparer.cs
- ObjectDataSourceEventArgs.cs
- NavigatorInput.cs
- NamedPipeChannelFactory.cs
- FormViewInsertedEventArgs.cs
- PersonalizationState.cs
- DiagnosticsConfiguration.cs
- UdpDiscoveryMessageFilter.cs
- GregorianCalendar.cs
- PackWebResponse.cs
- arc.cs
- NavigationFailedEventArgs.cs
- LinkDescriptor.cs
- XmlEntity.cs
- SchemaComplexType.cs
- ServiceModelEnumValidatorAttribute.cs
- ReadOnlyDataSource.cs
- shaperfactory.cs
- TagMapCollection.cs
- GetWinFXPath.cs
- OleDbEnumerator.cs
- PropertyPushdownHelper.cs
- NamespaceList.cs
- DockProviderWrapper.cs
- MembershipValidatePasswordEventArgs.cs
- WindowsListViewItem.cs
- KeyValuePairs.cs
- SiteMapHierarchicalDataSourceView.cs
- NullExtension.cs
- LineSegment.cs
- WebPart.cs
- SafeHandles.cs
- TriggerCollection.cs
- Stylus.cs
- CustomTypeDescriptor.cs
- ProxyGenerationError.cs
- WebPartDeleteVerb.cs
- Window.cs
- ColorDialog.cs
- ColorTransform.cs
- AttributeCollection.cs
- GeneratedContractType.cs
- Vector3dCollection.cs
- Soap.cs
- _ConnectionGroup.cs
- SqlNotificationRequest.cs
- GetWorkflowTree.cs
- Clipboard.cs
- StreamGeometryContext.cs
- CacheSection.cs
- ExpressionSelection.cs
- ADMembershipUser.cs
- IntSecurity.cs
- XamlSerializationHelper.cs
- SymLanguageType.cs
- ListViewDeletedEventArgs.cs
- RSAPKCS1KeyExchangeFormatter.cs
- PostBackOptions.cs
- QueryUtil.cs
- SecurityElement.cs
- NameValuePair.cs
- ReplyChannelBinder.cs
- BitmapDownload.cs
- Grid.cs
- InputReportEventArgs.cs
- SoapClientProtocol.cs
- WebZone.cs
- BooleanFacetDescriptionElement.cs
- SuppressMergeCheckAttribute.cs
- DataSourceCacheDurationConverter.cs
- NamespaceInfo.cs
- TableRowGroupCollection.cs
- ColumnWidthChangingEvent.cs
- listitem.cs
- BevelBitmapEffect.cs
- ScriptControlManager.cs
- PersonalizationState.cs
- CannotUnloadAppDomainException.cs
- PathGeometry.cs
- ByteAnimationUsingKeyFrames.cs
- ToolboxComponentsCreatedEventArgs.cs
- Certificate.cs
- Identifier.cs
- MobileControl.cs
- ClientRolePrincipal.cs
- Switch.cs
- ToolStripDesignerAvailabilityAttribute.cs
- HtmlInputText.cs
- OneOf.cs
- QueryStringParameter.cs
- SocketInformation.cs
- Matrix3D.cs
- ParallelTimeline.cs
- VerbConverter.cs
- CodeEventReferenceExpression.cs
- UrlMappingsModule.cs
- LogicalCallContext.cs