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
- QilNode.cs
- UniformGrid.cs
- TextCollapsingProperties.cs
- ObjectViewEntityCollectionData.cs
- XmlILConstructAnalyzer.cs
- AnnotationStore.cs
- BinaryObjectInfo.cs
- LabelAutomationPeer.cs
- EventlogProvider.cs
- ArraySegment.cs
- HelpInfo.cs
- RetrieveVirtualItemEventArgs.cs
- JsonWriter.cs
- XmlAttributeAttribute.cs
- CopyCodeAction.cs
- XmlUtf8RawTextWriter.cs
- TextAnchor.cs
- nulltextcontainer.cs
- SafeProcessHandle.cs
- GenerateTemporaryAssemblyTask.cs
- ExpressionBuilderContext.cs
- ValidatorCollection.cs
- SspiHelper.cs
- SqlCaseSimplifier.cs
- DeploymentSection.cs
- SystemFonts.cs
- ModifiableIteratorCollection.cs
- Source.cs
- FrugalList.cs
- DataGridViewColumnTypeEditor.cs
- WpfWebRequestHelper.cs
- StreamUpdate.cs
- DefaultAssemblyResolver.cs
- CodeCommentStatementCollection.cs
- ContainerSelectorBehavior.cs
- XmlIlGenerator.cs
- AnimationTimeline.cs
- TableRow.cs
- SuppressMergeCheckAttribute.cs
- XPathNodeIterator.cs
- SignatureHelper.cs
- ISAPIWorkerRequest.cs
- GroupItemAutomationPeer.cs
- Query.cs
- SpeakProgressEventArgs.cs
- ParameterElementCollection.cs
- ParameterToken.cs
- TextRenderer.cs
- SystemIPv4InterfaceProperties.cs
- AsyncCompletedEventArgs.cs
- EmptyReadOnlyDictionaryInternal.cs
- Facet.cs
- DeleteMemberBinder.cs
- UserValidatedEventArgs.cs
- DataGridPageChangedEventArgs.cs
- PackageRelationship.cs
- RootBrowserWindowAutomationPeer.cs
- SolidColorBrush.cs
- ThicknessConverter.cs
- UnknownWrapper.cs
- StickyNoteContentControl.cs
- ToolStripContentPanel.cs
- SessionStateModule.cs
- CombinedGeometry.cs
- Graphics.cs
- CanonicalFontFamilyReference.cs
- WebPartConnectionCollection.cs
- Variant.cs
- CodeArgumentReferenceExpression.cs
- GridViewUpdatedEventArgs.cs
- TextEffectCollection.cs
- CookielessHelper.cs
- COAUTHIDENTITY.cs
- CollectionView.cs
- BitmapEffectDrawing.cs
- ConnectionOrientedTransportBindingElement.cs
- ButtonFieldBase.cs
- SpellerInterop.cs
- InheritanceRules.cs
- EntityDataSourceViewSchema.cs
- EventTask.cs
- AlphabeticalEnumConverter.cs
- GridViewEditEventArgs.cs
- WebPartConnectionsConnectVerb.cs
- EntityClassGenerator.cs
- CaretElement.cs
- QueryContinueDragEventArgs.cs
- Variable.cs
- CommonDialog.cs
- PersonalizationStateInfo.cs
- HttpCacheParams.cs
- ConditionalWeakTable.cs
- Button.cs
- ObjectSet.cs
- KeyGestureValueSerializer.cs
- ToolStripDropDownClosingEventArgs.cs
- AppDomainShutdownMonitor.cs
- UInt32Storage.cs
- EnumDataContract.cs
- Package.cs