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
- WebPartConnectionsCancelVerb.cs
- DependencyPropertyConverter.cs
- ConfigViewGenerator.cs
- SplitterPanel.cs
- WebControlsSection.cs
- IpcClientChannel.cs
- ApplicationTrust.cs
- ReadOnlyDataSource.cs
- XamlVector3DCollectionSerializer.cs
- HtmlGenericControl.cs
- CodeTypeDeclaration.cs
- DataGridTablesFactory.cs
- SchemaTypeEmitter.cs
- XmlWellformedWriter.cs
- HelpEvent.cs
- DataSourceControlBuilder.cs
- DNS.cs
- RSAPKCS1SignatureFormatter.cs
- ColumnTypeConverter.cs
- TextFragmentEngine.cs
- StylusPointPropertyUnit.cs
- KeyMatchBuilder.cs
- DataGridColumnCollection.cs
- HashAlgorithm.cs
- XamlTypeMapper.cs
- PersonalizationProviderCollection.cs
- CookieHandler.cs
- Types.cs
- StringResourceManager.cs
- MetafileHeaderWmf.cs
- DataGridItemAutomationPeer.cs
- TextBoxDesigner.cs
- WebPartMinimizeVerb.cs
- DragEventArgs.cs
- IsolatedStorageFilePermission.cs
- AsyncPostBackTrigger.cs
- LinkClickEvent.cs
- HtmlElementCollection.cs
- TagMapInfo.cs
- DecimalSumAggregationOperator.cs
- GridSplitterAutomationPeer.cs
- _LocalDataStore.cs
- CodeObject.cs
- ExtensionSurface.cs
- SoapProcessingBehavior.cs
- SpellerError.cs
- ComplexTypeEmitter.cs
- ResourcesBuildProvider.cs
- Underline.cs
- QilLiteral.cs
- MatrixStack.cs
- nulltextcontainer.cs
- XPathParser.cs
- CompensationHandlingFilter.cs
- DisplayInformation.cs
- Scheduling.cs
- BitmapEffectGroup.cs
- SerializationHelper.cs
- BoundPropertyEntry.cs
- WmlFormAdapter.cs
- DynamicRenderer.cs
- DataGridPagingPage.cs
- _SingleItemRequestCache.cs
- WebPartConnectVerb.cs
- TraceLevelStore.cs
- DesignerDataStoredProcedure.cs
- CheckoutException.cs
- WorkflowValidationFailedException.cs
- EditingScope.cs
- ArgumentException.cs
- XamlStackWriter.cs
- AdapterDictionary.cs
- BamlTreeUpdater.cs
- SrgsElementFactoryCompiler.cs
- InternalCompensate.cs
- SqlParameterCollection.cs
- Rect3DConverter.cs
- compensatingcollection.cs
- DoubleAnimationUsingPath.cs
- DateTimeOffset.cs
- ArrayWithOffset.cs
- Quaternion.cs
- ConfigXmlWhitespace.cs
- FtpCachePolicyElement.cs
- TextTabProperties.cs
- columnmapfactory.cs
- OutputCacheSettings.cs
- ElapsedEventArgs.cs
- NativeMethods.cs
- DocobjHost.cs
- PanelContainerDesigner.cs
- ComponentChangingEvent.cs
- ParentQuery.cs
- CardSpaceSelector.cs
- Light.cs
- ToolStripPanelCell.cs
- PropertyChangedEventManager.cs
- HttpClientCertificate.cs
- CryptoApi.cs
- ToolStripGripRenderEventArgs.cs