Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / Documents / TextTreePropertyUndoUnit.cs / 1 / TextTreePropertyUndoUnit.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: Undo unit for TextContainer.SetValue, etc. calls.
//
// History:
// 03/03/2004 : benwest - 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 : benwest - 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
- BamlVersionHeader.cs
- CallSiteBinder.cs
- NullRuntimeConfig.cs
- Listbox.cs
- ACL.cs
- ServicePoint.cs
- DesignOnlyAttribute.cs
- RadioButtonStandardAdapter.cs
- DocumentPageView.cs
- ScriptManagerProxy.cs
- StorageEntityContainerMapping.cs
- Marshal.cs
- FileDialog_Vista.cs
- NonSerializedAttribute.cs
- UnauthorizedAccessException.cs
- BrowserCapabilitiesFactory.cs
- WebDescriptionAttribute.cs
- CodeDelegateInvokeExpression.cs
- Stream.cs
- SevenBitStream.cs
- SqlNotificationEventArgs.cs
- Reference.cs
- SimpleType.cs
- DateBoldEvent.cs
- ImpersonationContext.cs
- ResourceDictionary.cs
- GotoExpression.cs
- BaseTemplateCodeDomTreeGenerator.cs
- _ConnectOverlappedAsyncResult.cs
- DataGridLinkButton.cs
- IssuanceLicense.cs
- InputLangChangeRequestEvent.cs
- PageParserFilter.cs
- _UncName.cs
- Border.cs
- DataKeyPropertyAttribute.cs
- ListViewUpdatedEventArgs.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- QueryContext.cs
- DateTimeConverter.cs
- PageBreakRecord.cs
- QilInvokeEarlyBound.cs
- FileEnumerator.cs
- ColumnHeaderConverter.cs
- PointLight.cs
- NullableIntAverageAggregationOperator.cs
- XdrBuilder.cs
- DataList.cs
- URLMembershipCondition.cs
- Image.cs
- XmlDataDocument.cs
- entityreference_tresulttype.cs
- StylusButtonCollection.cs
- CompilationPass2TaskInternal.cs
- URIFormatException.cs
- WebPartConnectVerb.cs
- XmlQualifiedName.cs
- ListViewEditEventArgs.cs
- Context.cs
- PartialArray.cs
- ExpressionLexer.cs
- BidOverLoads.cs
- wgx_render.cs
- PageStatePersister.cs
- StrongNameIdentityPermission.cs
- AttributeCollection.cs
- MatrixTransform.cs
- FixedSOMLineRanges.cs
- TextOutput.cs
- ValueTable.cs
- SeekableReadStream.cs
- XmlProcessingInstruction.cs
- DataGridViewHitTestInfo.cs
- MultipleViewProviderWrapper.cs
- DesignerWidgets.cs
- XmlSchemaObject.cs
- GraphicsPath.cs
- ProgressBar.cs
- XmlText.cs
- BitmapFrame.cs
- ThicknessKeyFrameCollection.cs
- WorkflowInstanceRecord.cs
- DefaultClaimSet.cs
- WebPartConnectionsConnectVerb.cs
- GridLengthConverter.cs
- TypedReference.cs
- ConfigsHelper.cs
- X500Name.cs
- PartitionResolver.cs
- Page.cs
- XmlLangPropertyAttribute.cs
- JsonEnumDataContract.cs
- MD5.cs
- TextEditorContextMenu.cs
- ComplexTypeEmitter.cs
- ClientEndpointLoader.cs
- CompensableActivity.cs
- IDispatchConstantAttribute.cs
- MouseDevice.cs
- PenThreadWorker.cs