Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Documents / TextTreeInsertUndoUnit.cs / 1 / TextTreeInsertUndoUnit.cs
//---------------------------------------------------------------------------- // // File: TextTreeInsertUndoUnit.cs // // Description: Undo unit for TextContainer.InsertText and InsertEmbeddedObject calls. // // History: // 03/03/2004 : benwest - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Documents { // Undo unit for TextContainer.InsertText and InsertEmbeddedObject calls. internal class TextTreeInsertUndoUnit : TextTreeUndoUnit { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Create a new undo unit instance. // symbolOffset and symbolCount track the offset of the inserted content // and its symbol count, respectively. internal TextTreeInsertUndoUnit(TextContainer tree, int symbolOffset, int symbolCount) : base(tree, symbolOffset) { Invariant.Assert(symbolCount > 0, "Creating no-op insert undo unit!"); _symbolCount = symbolCount; } #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 start; TextPointer end; VerifyTreeContentHashCode(); start = new TextPointer(this.TextContainer, this.SymbolOffset, LogicalDirection.Forward); end = new TextPointer(this.TextContainer, this.SymbolOffset + _symbolCount, LogicalDirection.Forward); this.TextContainer.DeleteContentInternal(start, end); } #endregion Public Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields // Count of symbols to remove. private readonly int _symbolCount; #endregion Private Fields } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // File: TextTreeInsertUndoUnit.cs // // Description: Undo unit for TextContainer.InsertText and InsertEmbeddedObject calls. // // History: // 03/03/2004 : benwest - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Documents { // Undo unit for TextContainer.InsertText and InsertEmbeddedObject calls. internal class TextTreeInsertUndoUnit : TextTreeUndoUnit { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Create a new undo unit instance. // symbolOffset and symbolCount track the offset of the inserted content // and its symbol count, respectively. internal TextTreeInsertUndoUnit(TextContainer tree, int symbolOffset, int symbolCount) : base(tree, symbolOffset) { Invariant.Assert(symbolCount > 0, "Creating no-op insert undo unit!"); _symbolCount = symbolCount; } #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 start; TextPointer end; VerifyTreeContentHashCode(); start = new TextPointer(this.TextContainer, this.SymbolOffset, LogicalDirection.Forward); end = new TextPointer(this.TextContainer, this.SymbolOffset + _symbolCount, LogicalDirection.Forward); this.TextContainer.DeleteContentInternal(start, end); } #endregion Public Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields // Count of symbols to remove. private readonly int _symbolCount; #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
- FormsAuthenticationTicket.cs
- ChannelEndpointElementCollection.cs
- Label.cs
- HttpProfileBase.cs
- ImageMap.cs
- PowerModeChangedEventArgs.cs
- Header.cs
- TakeOrSkipQueryOperator.cs
- ReferenceEqualityComparer.cs
- EncryptedPackage.cs
- EventProxy.cs
- TagPrefixAttribute.cs
- SchemaNotation.cs
- TrackingProfile.cs
- ExcCanonicalXml.cs
- FixedFlowMap.cs
- SingleStorage.cs
- JsonClassDataContract.cs
- SynchronizedPool.cs
- PageContentAsyncResult.cs
- ImageMapEventArgs.cs
- SplitterEvent.cs
- InvalidComObjectException.cs
- PackagePart.cs
- ToolBarPanel.cs
- AffineTransform3D.cs
- GridViewSelectEventArgs.cs
- PropertyValueChangedEvent.cs
- SHA512Managed.cs
- StorageEntitySetMapping.cs
- Route.cs
- WebPartCatalogAddVerb.cs
- Debug.cs
- objectresult_tresulttype.cs
- TypeNameParser.cs
- HwndProxyElementProvider.cs
- WrappedIUnknown.cs
- MsmqBindingElementBase.cs
- EndEvent.cs
- CollectionViewSource.cs
- ImageButton.cs
- Number.cs
- FormatterConverter.cs
- XmlValidatingReaderImpl.cs
- SoapHeaderException.cs
- Stackframe.cs
- DataSet.cs
- WhitespaceRuleLookup.cs
- MessageQueuePermissionEntry.cs
- SiteMapSection.cs
- DataExpression.cs
- NotifyInputEventArgs.cs
- WorkflowElementDialogWindow.xaml.cs
- WsatStrings.cs
- ListBoxItemWrapperAutomationPeer.cs
- DateTimeUtil.cs
- FormParameter.cs
- Span.cs
- LoginCancelEventArgs.cs
- PublisherMembershipCondition.cs
- XPathAncestorQuery.cs
- DiscoveryVersionConverter.cs
- CacheRequest.cs
- InkCanvas.cs
- XmlLinkedNode.cs
- Rotation3DAnimation.cs
- _ShellExpression.cs
- DataKey.cs
- StrokeCollectionConverter.cs
- RequestCache.cs
- ConfigPathUtility.cs
- Type.cs
- CharacterMetricsDictionary.cs
- ReliabilityContractAttribute.cs
- MatrixUtil.cs
- ThreadInterruptedException.cs
- EventEntry.cs
- DocComment.cs
- PackageRelationshipSelector.cs
- RuntimeConfigurationRecord.cs
- ProgressChangedEventArgs.cs
- KeyTimeConverter.cs
- ButtonBase.cs
- AddInIpcChannel.cs
- SelectedCellsChangedEventArgs.cs
- ContextMenuStrip.cs
- DataGridAutoFormatDialog.cs
- ContentTextAutomationPeer.cs
- XsltContext.cs
- JsonUriDataContract.cs
- GetKeyedHashRequest.cs
- XmlToDatasetMap.cs
- NavigationEventArgs.cs
- SerializableAttribute.cs
- WebPageTraceListener.cs
- TranslateTransform.cs
- PasswordBox.cs
- MetadataFile.cs
- Profiler.cs
- CodeBinaryOperatorExpression.cs