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
- TogglePatternIdentifiers.cs
- FormsAuthenticationEventArgs.cs
- Run.cs
- HyperLinkStyle.cs
- ScalarConstant.cs
- Registry.cs
- TextBoxView.cs
- InProcStateClientManager.cs
- XmlTextReaderImpl.cs
- TextCompositionEventArgs.cs
- SystemIcons.cs
- XmlHelper.cs
- _UriSyntax.cs
- CqlErrorHelper.cs
- NavigationHelper.cs
- DoubleStorage.cs
- Instrumentation.cs
- FileEnumerator.cs
- TypeUnloadedException.cs
- VolatileEnlistmentMultiplexing.cs
- FunctionParameter.cs
- DataGridCellsPanel.cs
- ColorMatrix.cs
- CachedCompositeFamily.cs
- XmlDataLoader.cs
- sitestring.cs
- CodeDesigner.cs
- WebPartZoneCollection.cs
- TransactionOptions.cs
- TableCellCollection.cs
- bindurihelper.cs
- DbConnectionPoolGroup.cs
- CodeTypeConstructor.cs
- SynchronizationContext.cs
- dtdvalidator.cs
- TemplateFactory.cs
- Range.cs
- Int16AnimationUsingKeyFrames.cs
- SafeNativeMethodsMilCoreApi.cs
- StorageConditionPropertyMapping.cs
- StringPropertyBuilder.cs
- AxParameterData.cs
- TdsParameterSetter.cs
- PathFigureCollection.cs
- DataStreamFromComStream.cs
- WebPartCancelEventArgs.cs
- DockAndAnchorLayout.cs
- KerberosSecurityTokenProvider.cs
- IndexerNameAttribute.cs
- StylusEditingBehavior.cs
- RouteData.cs
- List.cs
- BitmapEffectDrawingContextState.cs
- SystemWebSectionGroup.cs
- System.Data_BID.cs
- FlowDocumentScrollViewer.cs
- StrokeNodeOperations2.cs
- DragEventArgs.cs
- DesignColumn.cs
- XDeferredAxisSource.cs
- ParserOptions.cs
- SafeProcessHandle.cs
- XmlSchemaAnnotation.cs
- CustomAttributeFormatException.cs
- WebPartCatalogCloseVerb.cs
- XslAstAnalyzer.cs
- Unit.cs
- CompositeTypefaceMetrics.cs
- OleDbInfoMessageEvent.cs
- LineServices.cs
- XMLSyntaxException.cs
- KeyboardDevice.cs
- PreProcessor.cs
- InstanceStoreQueryResult.cs
- ManagedIStream.cs
- TextEditorLists.cs
- KeySplineConverter.cs
- ProfilePropertyNameValidator.cs
- IndicCharClassifier.cs
- TaskExtensions.cs
- DataGridColumn.cs
- SchemaExporter.cs
- SqlInfoMessageEvent.cs
- SoapExtensionStream.cs
- ArrayElementGridEntry.cs
- ConstraintEnumerator.cs
- CommonDialog.cs
- ValidationPropertyAttribute.cs
- HttpModuleCollection.cs
- DrawItemEvent.cs
- ScrollViewer.cs
- BuildProvider.cs
- EntityUtil.cs
- ItemType.cs
- Transform3D.cs
- ReadOnlyCollectionBuilder.cs
- Error.cs
- httpapplicationstate.cs
- AsynchronousChannelMergeEnumerator.cs
- WebServiceData.cs