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
- ProxyWebPartConnectionCollection.cs
- FastEncoder.cs
- _NetRes.cs
- DirectionalLight.cs
- securitycriticaldataformultiplegetandset.cs
- ProfessionalColors.cs
- Query.cs
- WebConfigurationManager.cs
- PhoneCallDesigner.cs
- LineGeometry.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- SqlInfoMessageEvent.cs
- EventItfInfo.cs
- Thread.cs
- CellQuery.cs
- XmlTextReaderImplHelpers.cs
- ProviderException.cs
- AliasedExpr.cs
- ChineseLunisolarCalendar.cs
- GatewayDefinition.cs
- SchemaElement.cs
- Enum.cs
- MessageDirection.cs
- ScriptModule.cs
- SimpleTypesSurrogate.cs
- AutomationTextAttribute.cs
- HtmlTitle.cs
- WinFormsSecurity.cs
- OdbcCommandBuilder.cs
- InvalidCastException.cs
- CircleHotSpot.cs
- Listen.cs
- _FixedSizeReader.cs
- XmlSerializationGeneratedCode.cs
- RenderOptions.cs
- Range.cs
- ElementInit.cs
- DataGridViewColumnConverter.cs
- SchemaTypeEmitter.cs
- ToolboxCategoryItems.cs
- TextBoxBase.cs
- CountAggregationOperator.cs
- Multiply.cs
- Publisher.cs
- TreeNodeBinding.cs
- NameScopePropertyAttribute.cs
- RemoteWebConfigurationHost.cs
- RootNamespaceAttribute.cs
- DSASignatureFormatter.cs
- InertiaRotationBehavior.cs
- Win32MouseDevice.cs
- AnnotationStore.cs
- AttachedAnnotation.cs
- BindingMAnagerBase.cs
- ContainerFilterService.cs
- SafeEventLogWriteHandle.cs
- IntSecurity.cs
- DataGridViewDataErrorEventArgs.cs
- DateBoldEvent.cs
- SqlUserDefinedAggregateAttribute.cs
- EdmType.cs
- ClientUtils.cs
- DashStyle.cs
- StrokeCollectionConverter.cs
- LassoHelper.cs
- IUnknownConstantAttribute.cs
- ReachDocumentPageSerializer.cs
- CodeGenHelper.cs
- ToolBarPanel.cs
- WebPartManagerInternals.cs
- ConnectionConsumerAttribute.cs
- ProviderCollection.cs
- SignatureGenerator.cs
- Point4D.cs
- HandleExceptionArgs.cs
- RtfControls.cs
- FixedSOMLineRanges.cs
- ErrorTableItemStyle.cs
- TemplateXamlParser.cs
- OdbcEnvironmentHandle.cs
- XmlCharCheckingReader.cs
- CapabilitiesRule.cs
- ExceptionHelpers.cs
- RunClient.cs
- CodeDirectoryCompiler.cs
- XmlSchemaSimpleContent.cs
- WindowsEditBoxRange.cs
- LabelLiteral.cs
- RunWorkerCompletedEventArgs.cs
- SystemIPInterfaceProperties.cs
- ASCIIEncoding.cs
- TextFormatter.cs
- SoapMessage.cs
- ItemContainerGenerator.cs
- NetCodeGroup.cs
- MsmqChannelFactory.cs
- XPathSelectionIterator.cs
- HScrollProperties.cs
- PersistenceProviderElement.cs
- IIS7UserPrincipal.cs