Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- ModifierKeysValueSerializer.cs
- RepeaterDesigner.cs
- Int32RectConverter.cs
- ConditionalAttribute.cs
- DefaultValueMapping.cs
- SharedStatics.cs
- FontEditor.cs
- SchemaElement.cs
- ParagraphResult.cs
- _NetworkingPerfCounters.cs
- TdsParser.cs
- DataGridViewTopLeftHeaderCell.cs
- TextWriterEngine.cs
- PropertyDescriptorComparer.cs
- MsmqTransportReceiveParameters.cs
- FunctionDetailsReader.cs
- ImageInfo.cs
- PointLight.cs
- ResetableIterator.cs
- ZoneLinkButton.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- XamlTypeWithExplicitNamespace.cs
- LoginCancelEventArgs.cs
- MetadataArtifactLoaderCompositeResource.cs
- ToggleProviderWrapper.cs
- ManagedIStream.cs
- ColorInterpolationModeValidation.cs
- DataBindEngine.cs
- Cloud.cs
- EmissiveMaterial.cs
- InvokePattern.cs
- DbDataAdapter.cs
- WinEventTracker.cs
- StateRuntime.cs
- DotExpr.cs
- PropertyTabAttribute.cs
- SourceFilter.cs
- RuntimeArgumentHandle.cs
- SqlGatherConsumedAliases.cs
- Module.cs
- CryptoProvider.cs
- SqlDataSourceView.cs
- ipaddressinformationcollection.cs
- StrokeRenderer.cs
- PresentationSource.cs
- ListBox.cs
- DecimalAnimation.cs
- CheckBoxField.cs
- AsmxEndpointPickerExtension.cs
- BufferedGraphicsContext.cs
- SmiMetaData.cs
- TraceSection.cs
- DataGridSortCommandEventArgs.cs
- cookieexception.cs
- peersecuritysettings.cs
- MDIWindowDialog.cs
- BreakRecordTable.cs
- ColorMatrix.cs
- StrongNameMembershipCondition.cs
- ListItemCollection.cs
- peernodeimplementation.cs
- AutomationPropertyInfo.cs
- OrthographicCamera.cs
- SafeCryptContextHandle.cs
- CustomAssemblyResolver.cs
- InfoCardSymmetricCrypto.cs
- DataGridLinkButton.cs
- _ShellExpression.cs
- SingleKeyFrameCollection.cs
- AsymmetricSignatureFormatter.cs
- TypeDependencyAttribute.cs
- DockPattern.cs
- DrawingDrawingContext.cs
- CompoundFileDeflateTransform.cs
- PropertyEmitter.cs
- Odbc32.cs
- DataSvcMapFile.cs
- DbProviderFactoriesConfigurationHandler.cs
- HttpServerVarsCollection.cs
- ValidationHelper.cs
- XmlTextEncoder.cs
- QueryRewriter.cs
- PerformanceCounterManager.cs
- CryptoApi.cs
- PropertyChangingEventArgs.cs
- OraclePermissionAttribute.cs
- VisualStyleTypesAndProperties.cs
- IItemProperties.cs
- DrawItemEvent.cs
- RoutedEventConverter.cs
- OpenTypeMethods.cs
- ObjectViewEntityCollectionData.cs
- HwndStylusInputProvider.cs
- ActivityMarkupSerializationProvider.cs
- WpfXamlMember.cs
- CounterCreationData.cs
- ObjectViewQueryResultData.cs
- BasicHttpMessageSecurity.cs
- HybridDictionary.cs
- BitmapDecoder.cs