Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- sqlpipe.cs
- SqlDataSourceConfigureSelectPanel.cs
- SettingsProperty.cs
- QueryOutputWriter.cs
- CroppedBitmap.cs
- ReceiveMessageRecord.cs
- WinCategoryAttribute.cs
- TimeZone.cs
- SQLDecimalStorage.cs
- ConfigXmlText.cs
- ValidationVisibilityAttribute.cs
- ConnectionPointConverter.cs
- Html32TextWriter.cs
- TreeViewDesigner.cs
- TextEditorTyping.cs
- Converter.cs
- ResourceExpressionBuilder.cs
- LineInfo.cs
- DataViewManagerListItemTypeDescriptor.cs
- SettingsProperty.cs
- ObjectNotFoundException.cs
- LabelTarget.cs
- GridViewRowPresenter.cs
- ParserExtension.cs
- HierarchicalDataSourceControl.cs
- TreeNodeSelectionProcessor.cs
- CodePageUtils.cs
- ScaleTransform3D.cs
- EntityDataSourceChangingEventArgs.cs
- ActivityExecutorDelegateInfo.cs
- Hyperlink.cs
- MaskedTextBoxDesigner.cs
- EventProviderWriter.cs
- OpCellTreeNode.cs
- _NegotiateClient.cs
- DesignTimeType.cs
- UnsafeNativeMethodsCLR.cs
- TextEditorTables.cs
- Size.cs
- IsolatedStorageException.cs
- IPCCacheManager.cs
- MimeMapping.cs
- UnsafeNativeMethods.cs
- GestureRecognitionResult.cs
- RegistrationServices.cs
- pingexception.cs
- CodeStatement.cs
- InvokeWebService.cs
- TransactionFlowProperty.cs
- WebSysDescriptionAttribute.cs
- GacUtil.cs
- CompilationUtil.cs
- UnsafeNativeMethods.cs
- DependencyObject.cs
- ResourceType.cs
- String.cs
- ReachDocumentSequenceSerializerAsync.cs
- SplineKeyFrames.cs
- DivideByZeroException.cs
- PointLightBase.cs
- Registry.cs
- SingleConverter.cs
- XappLauncher.cs
- Int32CollectionConverter.cs
- GetWinFXPath.cs
- EventLogConfiguration.cs
- UidManager.cs
- ProcessModelSection.cs
- DecoderFallbackWithFailureFlag.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- TraceSource.cs
- HtmlForm.cs
- FlowDocumentFormatter.cs
- TransformerConfigurationWizardBase.cs
- MultipartContentParser.cs
- DateTimeOffsetStorage.cs
- Thickness.cs
- WebPartMenuStyle.cs
- HotSpotCollection.cs
- Function.cs
- DeclarativeConditionsCollection.cs
- RuleSetBrowserDialog.cs
- TraversalRequest.cs
- EntityDataSourceSelectedEventArgs.cs
- TraceLevelHelper.cs
- Utils.cs
- XamlDesignerSerializationManager.cs
- DecodeHelper.cs
- ComboBox.cs
- SplashScreen.cs
- ChildrenQuery.cs
- ImpersonationOption.cs
- OleDbRowUpdatedEvent.cs
- ObservableCollectionDefaultValueFactory.cs
- Vector3D.cs
- Rijndael.cs
- Point.cs
- FixedSOMTableCell.cs
- SiteMapDataSourceView.cs
- DataGridViewCellEventArgs.cs