Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- PageAdapter.cs
- ConnectionInterfaceCollection.cs
- VisualBasicHelper.cs
- TextReader.cs
- BufferAllocator.cs
- InheritanceContextHelper.cs
- BypassElement.cs
- TransformerConfigurationWizardBase.cs
- ValidationSummary.cs
- CookieParameter.cs
- SqlUserDefinedTypeAttribute.cs
- shaperfactory.cs
- SqlClientWrapperSmiStream.cs
- RunWorkerCompletedEventArgs.cs
- CorrelationValidator.cs
- XPathParser.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- HtmlTextBoxAdapter.cs
- _Win32.cs
- TableCell.cs
- ObsoleteAttribute.cs
- StringDictionaryCodeDomSerializer.cs
- ReferencedCollectionType.cs
- EntityViewGenerationConstants.cs
- XamlSerializer.cs
- DataGridViewRowStateChangedEventArgs.cs
- SystemBrushes.cs
- ScriptingJsonSerializationSection.cs
- FileUpload.cs
- DataGridViewCellStyleBuilderDialog.cs
- AutomationEventArgs.cs
- TaskbarItemInfo.cs
- ADConnectionHelper.cs
- SecurityManager.cs
- MulticastNotSupportedException.cs
- XmlIlVisitor.cs
- GridViewRowCollection.cs
- AsyncOperationManager.cs
- DeflateInput.cs
- TextFormatterImp.cs
- ConnectionPointCookie.cs
- TimeManager.cs
- BitmapVisualManager.cs
- DependencySource.cs
- XsdBuildProvider.cs
- MethodBuilder.cs
- WebBrowserHelper.cs
- GridViewRowPresenterBase.cs
- SessionPageStatePersister.cs
- StrongNameIdentityPermission.cs
- InputGestureCollection.cs
- UnsafeNativeMethods.cs
- AttachedProperty.cs
- AssemblyCache.cs
- FixedSchema.cs
- FilterEventArgs.cs
- SchemaImporterExtensionsSection.cs
- WmlSelectionListAdapter.cs
- CngAlgorithm.cs
- NamedPipeConnectionPoolSettings.cs
- CodeAttributeDeclaration.cs
- EditCommandColumn.cs
- CollectionViewProxy.cs
- CreateUserWizard.cs
- SupportsEventValidationAttribute.cs
- CodeObjectCreateExpression.cs
- BitmapInitialize.cs
- UnknownWrapper.cs
- BasicHttpMessageSecurityElement.cs
- UTF8Encoding.cs
- GraphicsContainer.cs
- TypeDefinition.cs
- HttpHandlerActionCollection.cs
- RootBuilder.cs
- RowBinding.cs
- DataQuery.cs
- PropertyChangingEventArgs.cs
- PageAdapter.cs
- UInt32Converter.cs
- DockPatternIdentifiers.cs
- ConfigXmlAttribute.cs
- InvalidPrinterException.cs
- WebPartsSection.cs
- CharStorage.cs
- ViewStateException.cs
- DataControlImageButton.cs
- InternalSafeNativeMethods.cs
- Vector3DAnimationBase.cs
- LogicalChannel.cs
- HtmlControl.cs
- PropertyValueUIItem.cs
- TextSerializer.cs
- CaseStatementSlot.cs
- MobileFormsAuthentication.cs
- CachedPathData.cs
- CellIdBoolean.cs
- WindowsTitleBar.cs
- Expressions.cs
- TextServicesContext.cs
- PropertyChangingEventArgs.cs