Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Documents / TextTreePropertyUndoUnit.cs / 1305600 / TextTreePropertyUndoUnit.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: Undo unit for TextContainer.SetValue, etc. calls. // // History: // 03/03/2004 : [....] - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Documents { // Undo unit for TextContainer.SetValue, etc. calls. internal class TextTreePropertyUndoUnit : TextTreeUndoUnit { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Create a new undo unit instance. // symbolOffset is where property values will be set. internal TextTreePropertyUndoUnit(TextContainer tree, int symbolOffset, PropertyRecord propertyRecord) : base(tree, symbolOffset) { _propertyRecord = propertyRecord; } #endregion Constructors //------------------------------------------------------ // // Public Methods // //----------------------------------------------------- #region Public Methods // Called by the undo manager. Restores tree state to its condition // when the unit was created. Assumes the tree state matches conditions // just after the unit was created. public override void DoCore() { TextPointer position; VerifyTreeContentHashCode(); position = new TextPointer(this.TextContainer, this.SymbolOffset, LogicalDirection.Forward); Invariant.Assert(position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart, "TextTree undo unit out of [....] with TextTree."); if (_propertyRecord.Value != DependencyProperty.UnsetValue) { this.TextContainer.SetValue(position, _propertyRecord.Property, _propertyRecord.Value); } else { position.Parent.ClearValue(_propertyRecord.Property); } } #endregion Public Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields // Property/value pair to restore. private readonly PropertyRecord _propertyRecord; #endregion Private Fields } } // 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: Undo unit for TextContainer.SetValue, etc. calls. // // History: // 03/03/2004 : [....] - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Documents { // Undo unit for TextContainer.SetValue, etc. calls. internal class TextTreePropertyUndoUnit : TextTreeUndoUnit { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Create a new undo unit instance. // symbolOffset is where property values will be set. internal TextTreePropertyUndoUnit(TextContainer tree, int symbolOffset, PropertyRecord propertyRecord) : base(tree, symbolOffset) { _propertyRecord = propertyRecord; } #endregion Constructors //------------------------------------------------------ // // Public Methods // //----------------------------------------------------- #region Public Methods // Called by the undo manager. Restores tree state to its condition // when the unit was created. Assumes the tree state matches conditions // just after the unit was created. public override void DoCore() { TextPointer position; VerifyTreeContentHashCode(); position = new TextPointer(this.TextContainer, this.SymbolOffset, LogicalDirection.Forward); Invariant.Assert(position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart, "TextTree undo unit out of [....] with TextTree."); if (_propertyRecord.Value != DependencyProperty.UnsetValue) { this.TextContainer.SetValue(position, _propertyRecord.Property, _propertyRecord.Value); } else { position.Parent.ClearValue(_propertyRecord.Property); } } #endregion Public Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields // Property/value pair to restore. private readonly PropertyRecord _propertyRecord; #endregion Private Fields } } // 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
- CodeSnippetCompileUnit.cs
- SchemaElementDecl.cs
- ValueConversionAttribute.cs
- DocumentViewer.cs
- ITreeGenerator.cs
- ProfessionalColors.cs
- ClonableStack.cs
- DragDrop.cs
- TwoPhaseCommitProxy.cs
- RepeaterItemCollection.cs
- TextAnchor.cs
- HttpFileCollectionWrapper.cs
- VectorAnimation.cs
- ResponseBodyWriter.cs
- DataControlLinkButton.cs
- ListBoxItem.cs
- FlagsAttribute.cs
- LayoutExceptionEventArgs.cs
- sqlpipe.cs
- LOSFormatter.cs
- CurrencyWrapper.cs
- XPathBinder.cs
- InvariantComparer.cs
- DrawingAttributesDefaultValueFactory.cs
- ExtendedPropertyDescriptor.cs
- PagesSection.cs
- WebPartCancelEventArgs.cs
- HtmlControl.cs
- ListBase.cs
- InvalidProgramException.cs
- LogReservationCollection.cs
- SystemKeyConverter.cs
- NotifyParentPropertyAttribute.cs
- dataobject.cs
- Sql8ConformanceChecker.cs
- ProtocolsSection.cs
- ContainerControl.cs
- Inline.cs
- ByteStreamGeometryContext.cs
- AnimationException.cs
- StrokeIntersection.cs
- Range.cs
- TraceUtility.cs
- XPathPatternBuilder.cs
- EncodingInfo.cs
- UnsafeNativeMethodsMilCoreApi.cs
- WebPartManagerInternals.cs
- OptimalBreakSession.cs
- ChildDocumentBlock.cs
- DataGridViewComboBoxColumn.cs
- ToolStripStatusLabel.cs
- Merger.cs
- SymLanguageType.cs
- StringDictionaryCodeDomSerializer.cs
- CatalogZone.cs
- Latin1Encoding.cs
- WebPartHelpVerb.cs
- EdmConstants.cs
- GridSplitterAutomationPeer.cs
- SessionPageStatePersister.cs
- Attributes.cs
- OpenFileDialog.cs
- ResourceWriter.cs
- DiscreteKeyFrames.cs
- UserMapPath.cs
- DictionaryBase.cs
- HashAlgorithm.cs
- RelatedImageListAttribute.cs
- _TLSstream.cs
- DataGridViewCellLinkedList.cs
- DocumentReferenceCollection.cs
- ProfileService.cs
- Keyboard.cs
- SpecularMaterial.cs
- DeflateStream.cs
- Point.cs
- MultiSelectRootGridEntry.cs
- XpsImage.cs
- DuplicateDetector.cs
- ProgressiveCrcCalculatingStream.cs
- ToolBarOverflowPanel.cs
- ScrollProperties.cs
- OciLobLocator.cs
- SystemIdentity.cs
- GenericUriParser.cs
- ToolStripPanelRow.cs
- CompareInfo.cs
- DSGeneratorProblem.cs
- MediaContextNotificationWindow.cs
- HandlerBase.cs
- X509Certificate2Collection.cs
- NameValueFileSectionHandler.cs
- StubHelpers.cs
- Table.cs
- SubstitutionDesigner.cs
- EdmFunctionAttribute.cs
- AutomationInteropProvider.cs
- InstalledVoice.cs
- Listbox.cs
- XmlObjectSerializerContext.cs