Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MailBnfHelper.cs
- SrgsDocumentParser.cs
- CustomGrammar.cs
- ProviderException.cs
- DataBindingHandlerAttribute.cs
- Tokenizer.cs
- PropertyFilterAttribute.cs
- MdiWindowListStrip.cs
- CustomTokenProvider.cs
- JournalEntry.cs
- PathGeometry.cs
- DtrList.cs
- CompletedAsyncResult.cs
- VectorAnimation.cs
- HttpClientCertificate.cs
- FontStyle.cs
- SessionSwitchEventArgs.cs
- XmlSchema.cs
- HtmlEncodedRawTextWriter.cs
- CacheVirtualItemsEvent.cs
- CustomAttributeSerializer.cs
- DesignObjectWrapper.cs
- VisualBrush.cs
- BitmapFrameEncode.cs
- RangeBaseAutomationPeer.cs
- DesignerWithHeader.cs
- ToolStripItemCollection.cs
- BamlRecordWriter.cs
- LineUtil.cs
- TranslateTransform3D.cs
- TimelineGroup.cs
- pingexception.cs
- Size.cs
- CodeGen.cs
- InheritanceContextChangedEventManager.cs
- XmlEncodedRawTextWriter.cs
- Clock.cs
- precedingsibling.cs
- TraceListeners.cs
- WebPartActionVerb.cs
- PopupRootAutomationPeer.cs
- InputScope.cs
- TextWriterEngine.cs
- WindowsPrincipal.cs
- DataBoundLiteralControl.cs
- _AcceptOverlappedAsyncResult.cs
- DataGridRelationshipRow.cs
- WizardForm.cs
- DiagnosticsConfiguration.cs
- VarRefManager.cs
- ValidatingPropertiesEventArgs.cs
- SoapEnumAttribute.cs
- TileBrush.cs
- StrokeNode.cs
- NavigationHelper.cs
- Setter.cs
- ExternalFile.cs
- mda.cs
- LinqDataSourceHelper.cs
- IisTraceListener.cs
- SafeHandles.cs
- ReverseInheritProperty.cs
- Oci.cs
- WebPartVerbCollection.cs
- ActivityFunc.cs
- AlphaSortedEnumConverter.cs
- ImageSource.cs
- HeaderedItemsControl.cs
- XmlMapping.cs
- ObjectCloneHelper.cs
- CatalogPartChrome.cs
- TaiwanLunisolarCalendar.cs
- CollectionViewGroupInternal.cs
- FileDialogCustomPlace.cs
- BoolLiteral.cs
- SiteMapNodeItem.cs
- ChangesetResponse.cs
- newinstructionaction.cs
- ScrollItemPatternIdentifiers.cs
- FileLogRecordStream.cs
- InvalidPipelineStoreException.cs
- MessageBodyMemberAttribute.cs
- DataServiceEntityAttribute.cs
- CursorInteropHelper.cs
- TextModifierScope.cs
- EmptyQuery.cs
- CmsInterop.cs
- Random.cs
- RtfNavigator.cs
- LineSegment.cs
- Message.cs
- LayoutExceptionEventArgs.cs
- CheckBox.cs
- WindowsMenu.cs
- Visual.cs
- GetIsBrowserClientRequest.cs
- PermissionSetEnumerator.cs
- PartialList.cs
- ModelTreeEnumerator.cs
- Positioning.cs