Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- AutomationEventArgs.cs
- StagingAreaInputItem.cs
- InitializationEventAttribute.cs
- AdornerPresentationContext.cs
- SqlConnectionString.cs
- AppManager.cs
- precedingsibling.cs
- IfAction.cs
- DetailsViewDeleteEventArgs.cs
- Int64Storage.cs
- CellParaClient.cs
- IdentifierService.cs
- ApplicationInterop.cs
- CommandValueSerializer.cs
- MimeXmlReflector.cs
- ACE.cs
- PropagatorResult.cs
- DocumentPageTextView.cs
- RenderDataDrawingContext.cs
- ToolStripSystemRenderer.cs
- HostedHttpTransportManager.cs
- ParenthesizePropertyNameAttribute.cs
- WindowInteropHelper.cs
- SystemGatewayIPAddressInformation.cs
- TableLayoutPanelResizeGlyph.cs
- GlobalizationSection.cs
- MemoryPressure.cs
- ServiceHostingEnvironmentSection.cs
- ErrorHandler.cs
- BackgroundWorker.cs
- GridViewSelectEventArgs.cs
- NullableBoolConverter.cs
- BitmapCacheBrush.cs
- ISO2022Encoding.cs
- SecurityTokenResolver.cs
- NegationPusher.cs
- WindowsRebar.cs
- PasswordTextNavigator.cs
- ChannelFactory.cs
- IssuanceLicense.cs
- CompositeDataBoundControl.cs
- CurrentChangingEventArgs.cs
- WebSysDefaultValueAttribute.cs
- ProcessHost.cs
- ProgressBarHighlightConverter.cs
- _AutoWebProxyScriptEngine.cs
- WebPartVerbCollection.cs
- MergeLocalizationDirectives.cs
- SliderAutomationPeer.cs
- Point3DCollection.cs
- MDIWindowDialog.cs
- VisualStateManager.cs
- PointConverter.cs
- SqlFactory.cs
- RequestSecurityTokenResponseCollection.cs
- AssemblyUtil.cs
- CompiledRegexRunner.cs
- ResourcesGenerator.cs
- SafeCryptoHandles.cs
- NameSpaceExtractor.cs
- AccessedThroughPropertyAttribute.cs
- SecurityContext.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- SequenceDesignerAccessibleObject.cs
- DbQueryCommandTree.cs
- ToolStripRenderer.cs
- ContextBase.cs
- StrongTypingException.cs
- ParsedRoute.cs
- CrossContextChannel.cs
- UnsupportedPolicyOptionsException.cs
- XmlDesigner.cs
- DoubleKeyFrameCollection.cs
- XmlWrappingReader.cs
- ToolStripSplitStackLayout.cs
- PermissionSetTriple.cs
- BuildResult.cs
- UpDownEvent.cs
- Compiler.cs
- TextTreeInsertElementUndoUnit.cs
- CallbackHandler.cs
- OletxVolatileEnlistment.cs
- BindableTemplateBuilder.cs
- CallbackValidatorAttribute.cs
- COM2ExtendedTypeConverter.cs
- ResXResourceSet.cs
- DataSourceHelper.cs
- CodeEntryPointMethod.cs
- WebPartRestoreVerb.cs
- DeriveBytes.cs
- PageAdapter.cs
- PersistenceMetadataNamespace.cs
- MemberRestriction.cs
- HostingEnvironment.cs
- DefaultHttpHandler.cs
- DiagnosticTraceSource.cs
- Helper.cs
- HttpCachePolicyElement.cs
- MetricEntry.cs
- Int32Converter.cs