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
- ModelTreeManager.cs
- ProviderCollection.cs
- WebColorConverter.cs
- ACE.cs
- LogReserveAndAppendState.cs
- XmlAttributeAttribute.cs
- IntellisenseTextBox.cs
- RoleGroup.cs
- WindowsRichEditRange.cs
- CacheHelper.cs
- XmlMtomWriter.cs
- TripleDES.cs
- OutputScope.cs
- DataGridViewCellStateChangedEventArgs.cs
- AuthenticatingEventArgs.cs
- PaintValueEventArgs.cs
- Pts.cs
- ActiveXHelper.cs
- GlyphRunDrawing.cs
- BrowserDefinitionCollection.cs
- CompositeActivityTypeDescriptorProvider.cs
- VisualStyleInformation.cs
- MultipartContentParser.cs
- base64Transforms.cs
- BaseDataListComponentEditor.cs
- DataGridCellAutomationPeer.cs
- X509UI.cs
- ApplicationCommands.cs
- SoundPlayerAction.cs
- FileUpload.cs
- BaseHashHelper.cs
- FigureParagraph.cs
- DependencyObjectProvider.cs
- UIElement.cs
- FlowSwitch.cs
- SqlTrackingService.cs
- CustomAttributeFormatException.cs
- XmlCustomFormatter.cs
- WebPartCatalogCloseVerb.cs
- XmlMembersMapping.cs
- DockAndAnchorLayout.cs
- SqlProvider.cs
- DataGridTable.cs
- DoubleKeyFrameCollection.cs
- ContentIterators.cs
- FilterableAttribute.cs
- XmlArrayItemAttributes.cs
- DataGridViewTextBoxEditingControl.cs
- Scene3D.cs
- ListViewCommandEventArgs.cs
- Binding.cs
- CallSiteBinder.cs
- SelectionEditingBehavior.cs
- CodePrimitiveExpression.cs
- SessionEndingEventArgs.cs
- SoapInteropTypes.cs
- PasswordDeriveBytes.cs
- ByteStreamMessage.cs
- RelationshipNavigation.cs
- XmlSchemaSimpleTypeRestriction.cs
- EncryptedXml.cs
- metadatamappinghashervisitor.cs
- BamlLocalizabilityResolver.cs
- DataGridViewComboBoxEditingControl.cs
- RightsManagementInformation.cs
- HttpServerVarsCollection.cs
- Drawing.cs
- ArithmeticException.cs
- EdmRelationshipRoleAttribute.cs
- SqlCommandSet.cs
- WpfXamlType.cs
- RuleEngine.cs
- ImageSource.cs
- Avt.cs
- AssemblyHash.cs
- FileFormatException.cs
- ComponentResourceManager.cs
- CoreSwitches.cs
- InheritablePropertyChangeInfo.cs
- InkPresenterAutomationPeer.cs
- SmiEventStream.cs
- ObjectStateEntryDbDataRecord.cs
- CodeDirectoryCompiler.cs
- StringBuilder.cs
- XhtmlBasicPanelAdapter.cs
- StylusButtonCollection.cs
- ConfigXmlCDataSection.cs
- BufferedGraphicsManager.cs
- CustomCredentialPolicy.cs
- SingleTagSectionHandler.cs
- ColorTransform.cs
- StreamGeometry.cs
- PackageRelationship.cs
- COM2IPerPropertyBrowsingHandler.cs
- FixedPageStructure.cs
- EventLogPermissionAttribute.cs
- EntityModelSchemaGenerator.cs
- HashCodeCombiner.cs
- ButtonChrome.cs
- StandardToolWindows.cs