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
- NetworkAddressChange.cs
- Panel.cs
- ObjectConverter.cs
- ContainerSelectorActiveEvent.cs
- DBDataPermission.cs
- SemaphoreFullException.cs
- HtmlContainerControl.cs
- ThreadPoolTaskScheduler.cs
- TemplateControlParser.cs
- NotifyIcon.cs
- ListViewInsertEventArgs.cs
- FixedSOMContainer.cs
- XmlReflectionMember.cs
- SignatureDescription.cs
- XmlAttributeProperties.cs
- Region.cs
- SiteMapNodeCollection.cs
- MouseDevice.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- WebBrowserNavigatingEventHandler.cs
- LoginAutoFormat.cs
- TabControlCancelEvent.cs
- ApplyTemplatesAction.cs
- ValueQuery.cs
- XmlILTrace.cs
- LineVisual.cs
- SqlAliasesReferenced.cs
- SequenceDesigner.cs
- BinaryCommonClasses.cs
- CategoryValueConverter.cs
- QueryOperationResponseOfT.cs
- FileLogRecordHeader.cs
- HandlerFactoryCache.cs
- BufferedGraphicsContext.cs
- ControlParser.cs
- DataGridTextBox.cs
- TemplateField.cs
- TextTreeInsertUndoUnit.cs
- EventLogPermissionEntry.cs
- SafeTokenHandle.cs
- DataControlImageButton.cs
- DateTimeFormat.cs
- DWriteFactory.cs
- PropertyTabAttribute.cs
- DbExpressionVisitor.cs
- XmlResolver.cs
- ListSourceHelper.cs
- ScriptComponentDescriptor.cs
- WindowsListBox.cs
- GridViewRowPresenterBase.cs
- PropertySegmentSerializer.cs
- FlagsAttribute.cs
- TimeSpan.cs
- GeneralTransform3DTo2D.cs
- MenuItemAutomationPeer.cs
- Serializer.cs
- SynchronizingStream.cs
- Encoder.cs
- activationcontext.cs
- ColumnBinding.cs
- HoistedLocals.cs
- ipaddressinformationcollection.cs
- ExpressionHelper.cs
- InvalidComObjectException.cs
- DialogResultConverter.cs
- OneToOneMappingSerializer.cs
- ColumnReorderedEventArgs.cs
- BindingUtils.cs
- GeometryModel3D.cs
- DbConnectionClosed.cs
- LabelDesigner.cs
- DependencyPropertyAttribute.cs
- DesignDataSource.cs
- WindowsTreeView.cs
- CompilerTypeWithParams.cs
- Win32.cs
- basenumberconverter.cs
- Int32CollectionConverter.cs
- DecimalKeyFrameCollection.cs
- EntityException.cs
- PanelStyle.cs
- TreeNodeStyle.cs
- FigureParaClient.cs
- SemaphoreSecurity.cs
- ValidationHelper.cs
- JumpPath.cs
- XmlBinaryReader.cs
- PasswordRecoveryDesigner.cs
- TraceContext.cs
- DataGridViewComponentPropertyGridSite.cs
- WmlFormAdapter.cs
- RoutingSection.cs
- StyleCollection.cs
- StringStorage.cs
- BaseTemplateCodeDomTreeGenerator.cs
- Helper.cs
- Int16AnimationUsingKeyFrames.cs
- DBDataPermissionAttribute.cs
- BoundField.cs
- MethodRental.cs