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
- Executor.cs
- __TransparentProxy.cs
- WebPartCatalogCloseVerb.cs
- XmlLoader.cs
- ToggleButton.cs
- DebuggerAttributes.cs
- CheckBox.cs
- RuntimeIdentifierPropertyAttribute.cs
- X509CertificateChain.cs
- TreeNodeCollection.cs
- ObjectIDGenerator.cs
- DataRowChangeEvent.cs
- ClientScriptManagerWrapper.cs
- StreamInfo.cs
- SettingsPropertyValue.cs
- WebUtil.cs
- StringReader.cs
- MessageQueuePermission.cs
- ToolStripContentPanelRenderEventArgs.cs
- DecoderNLS.cs
- CheckBoxStandardAdapter.cs
- BitVector32.cs
- HttpCapabilitiesSectionHandler.cs
- RSAPKCS1SignatureFormatter.cs
- CapabilitiesUse.cs
- UrlMappingCollection.cs
- DependencyPropertyDescriptor.cs
- CachedCompositeFamily.cs
- StatusStrip.cs
- FixedSOMElement.cs
- SqlDataSourceStatusEventArgs.cs
- DispatchChannelSink.cs
- TableParaClient.cs
- SrgsRuleRef.cs
- FontStretch.cs
- IisTraceWebEventProvider.cs
- HttpResponseHeader.cs
- XsltException.cs
- SqlRecordBuffer.cs
- NavigationCommands.cs
- CharEnumerator.cs
- SQLBytes.cs
- DataRelationCollection.cs
- WindowsListView.cs
- StartUpEventArgs.cs
- StorageFunctionMapping.cs
- _SSPISessionCache.cs
- Content.cs
- GeneralTransformCollection.cs
- GenericUriParser.cs
- ReadOnlyCollection.cs
- AnonymousIdentificationModule.cs
- CounterCreationData.cs
- XPathNodeList.cs
- Rotation3D.cs
- MinMaxParagraphWidth.cs
- StringConverter.cs
- HighContrastHelper.cs
- HtmlAnchor.cs
- ForceCopyBuildProvider.cs
- IdentityModelStringsVersion1.cs
- Vector3DAnimationBase.cs
- MeshGeometry3D.cs
- FloatSumAggregationOperator.cs
- ZipIOExtraFieldZip64Element.cs
- X509Chain.cs
- GlobalEventManager.cs
- QilList.cs
- DataListItem.cs
- XmlDictionaryString.cs
- _TLSstream.cs
- ClientSettingsStore.cs
- CompoundFileStorageReference.cs
- RectangleGeometry.cs
- NavigatingCancelEventArgs.cs
- ClassDataContract.cs
- GridViewCancelEditEventArgs.cs
- NativeCppClassAttribute.cs
- ObjectDataSourceDisposingEventArgs.cs
- PackageRelationshipCollection.cs
- ScriptComponentDescriptor.cs
- StrokeCollection2.cs
- PropertyEntry.cs
- GenericFlowSwitchHelper.cs
- CompleteWizardStep.cs
- CompilationUnit.cs
- ProgressChangedEventArgs.cs
- infer.cs
- ReadOnlyCollection.cs
- LinearGradientBrush.cs
- Parameter.cs
- InvalidEnumArgumentException.cs
- ViewStateModeByIdAttribute.cs
- DefaultAsyncDataDispatcher.cs
- ProcessHostMapPath.cs
- TypedTableHandler.cs
- ArrayHelper.cs
- PermissionToken.cs
- KeyConverter.cs
- DbConnectionPoolGroup.cs