Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StreamGeometry.cs
- DragDeltaEventArgs.cs
- GreenMethods.cs
- ParseChildrenAsPropertiesAttribute.cs
- GeometryModel3D.cs
- EntityDataSourceWizardForm.cs
- HttpGetProtocolImporter.cs
- CodeSnippetStatement.cs
- RootBuilder.cs
- CustomAttributeFormatException.cs
- OAVariantLib.cs
- CodeTypeConstructor.cs
- CoreSwitches.cs
- MetadataUtilsSmi.cs
- DiffuseMaterial.cs
- WebRequest.cs
- LinkArea.cs
- DataIdProcessor.cs
- ImageSourceConverter.cs
- NodeLabelEditEvent.cs
- StateBag.cs
- PropertyManager.cs
- EntityViewGenerator.cs
- AssemblyAttributesGoHere.cs
- PageCatalogPart.cs
- NTAccount.cs
- CachedPathData.cs
- XPathSelfQuery.cs
- HttpApplication.cs
- ColumnMapProcessor.cs
- TextTabProperties.cs
- XmlDictionaryWriter.cs
- MDIClient.cs
- MetadataItemSerializer.cs
- ValidationSummary.cs
- PointAnimationUsingPath.cs
- EUCJPEncoding.cs
- DataGridCell.cs
- HttpHandler.cs
- ContentFileHelper.cs
- IndexedEnumerable.cs
- ProfileServiceManager.cs
- ButtonChrome.cs
- RawStylusInputCustomData.cs
- CompositeCollectionView.cs
- AssemblyBuilderData.cs
- StackBuilderSink.cs
- Timer.cs
- BlockUIContainer.cs
- securestring.cs
- MetadataCollection.cs
- NativeMethods.cs
- XmlComplianceUtil.cs
- LOSFormatter.cs
- TreeView.cs
- ConfigurationElement.cs
- DataServiceProcessingPipeline.cs
- DynamicUpdateCommand.cs
- HttpListenerContext.cs
- FileDialogCustomPlacesCollection.cs
- TreeChangeInfo.cs
- DateTimeSerializationSection.cs
- ObjectDataSource.cs
- DbModificationCommandTree.cs
- BindingValueChangedEventArgs.cs
- Baml2006KeyRecord.cs
- BasicCellRelation.cs
- PageWrapper.cs
- CngProperty.cs
- BindingListCollectionView.cs
- ShapingWorkspace.cs
- DashStyles.cs
- ImageField.cs
- Filter.cs
- GroupBoxRenderer.cs
- BatchStream.cs
- SponsorHelper.cs
- SqlCrossApplyToCrossJoin.cs
- AssemblyName.cs
- XmlValidatingReader.cs
- TickBar.cs
- ZipIOExtraFieldZip64Element.cs
- ToolStrip.cs
- ValueQuery.cs
- DataSourceConverter.cs
- ColumnCollection.cs
- TypeListConverter.cs
- SymbolType.cs
- ActivityTrace.cs
- MailHeaderInfo.cs
- ToggleButton.cs
- WindowsRichEditRange.cs
- CqlWriter.cs
- CookieProtection.cs
- SqlClientMetaDataCollectionNames.cs
- CodeBlockBuilder.cs
- RectConverter.cs
- BitmapEffectGeneralTransform.cs
- Misc.cs
- VisualCollection.cs