Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / Model / DictionaryEditChange.cs / 1305376 / DictionaryEditChange.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.Activities.Presentation.Model
{
using System;
using System.Collections.Generic;
using System.Text;
class DictionaryEditChange : ModelChange
{
public ModelItemDictionary Dictionary { get; set; }
public ModelItem Key { get; set; }
public ModelItem OldValue { get; set; }
public ModelItem NewValue { get; set; }
public ModelTreeManager ModelTreeManager { get; set; }
public override string Description
{
get
{
return SR.DictionaryEditEditingScopeDescription;
}
}
public override bool Apply()
{
ModelItem oldValue = this.Dictionary[this.Key];
if ((oldValue == null && this.NewValue == null) ||
(oldValue != null && this.NewValue != null && oldValue.GetCurrentValue().Equals(this.NewValue.GetCurrentValue())))
{
return false;
}
this.ModelTreeManager.ReAddModelItemToModelTree(this.NewValue);
((ModelItemDictionaryImpl)this.Dictionary).EditCore(this.Key, this.NewValue);
if (null != this.OldValue)
{
this.ModelTreeManager.modelService.OnModelItemRemoved(this.OldValue);
((IModelTreeItem)OldValue).RemoveParent(this.Dictionary);
this.ModelTreeManager.ReleaseModelItem(this.OldValue, this.Dictionary);
}
if (null != this.NewValue)
{
this.ModelTreeManager.modelService.OnModelItemAdded(this.NewValue);
}
return true;
}
public override Change GetInverse()
{
return new DictionaryEditChange()
{
Dictionary = this.Dictionary,
Key = this.Key,
OldValue = this.NewValue,
NewValue = this.OldValue,
ModelTreeManager = this.ModelTreeManager,
};
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.Activities.Presentation.Model
{
using System;
using System.Collections.Generic;
using System.Text;
class DictionaryEditChange : ModelChange
{
public ModelItemDictionary Dictionary { get; set; }
public ModelItem Key { get; set; }
public ModelItem OldValue { get; set; }
public ModelItem NewValue { get; set; }
public ModelTreeManager ModelTreeManager { get; set; }
public override string Description
{
get
{
return SR.DictionaryEditEditingScopeDescription;
}
}
public override bool Apply()
{
ModelItem oldValue = this.Dictionary[this.Key];
if ((oldValue == null && this.NewValue == null) ||
(oldValue != null && this.NewValue != null && oldValue.GetCurrentValue().Equals(this.NewValue.GetCurrentValue())))
{
return false;
}
this.ModelTreeManager.ReAddModelItemToModelTree(this.NewValue);
((ModelItemDictionaryImpl)this.Dictionary).EditCore(this.Key, this.NewValue);
if (null != this.OldValue)
{
this.ModelTreeManager.modelService.OnModelItemRemoved(this.OldValue);
((IModelTreeItem)OldValue).RemoveParent(this.Dictionary);
this.ModelTreeManager.ReleaseModelItem(this.OldValue, this.Dictionary);
}
if (null != this.NewValue)
{
this.ModelTreeManager.modelService.OnModelItemAdded(this.NewValue);
}
return true;
}
public override Change GetInverse()
{
return new DictionaryEditChange()
{
Dictionary = this.Dictionary,
Key = this.Key,
OldValue = this.NewValue,
NewValue = this.OldValue,
ModelTreeManager = this.ModelTreeManager,
};
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Control.cs
- SpecularMaterial.cs
- Simplifier.cs
- DataView.cs
- ChangesetResponse.cs
- FixedLineResult.cs
- ElementUtil.cs
- Timer.cs
- HttpBrowserCapabilitiesBase.cs
- InputChannelAcceptor.cs
- mactripleDES.cs
- DesignerToolStripControlHost.cs
- WebPartsPersonalizationAuthorization.cs
- DateTimeValueSerializerContext.cs
- TimeSpanMinutesConverter.cs
- PreDigestedSignedInfo.cs
- StateWorkerRequest.cs
- TypeProvider.cs
- InternalTransaction.cs
- XXXInfos.cs
- MDIClient.cs
- MouseButton.cs
- GeneralTransformCollection.cs
- DataControlPagerLinkButton.cs
- LineBreakRecord.cs
- IOThreadTimer.cs
- RIPEMD160Managed.cs
- Int32KeyFrameCollection.cs
- AutomationPeer.cs
- HostProtectionException.cs
- IImplicitResourceProvider.cs
- WsiProfilesElementCollection.cs
- AppSettingsExpressionBuilder.cs
- ValidatorCollection.cs
- TriggerAction.cs
- DataGridTextBoxColumn.cs
- ToolStripOverflowButton.cs
- Int32Rect.cs
- TextServicesContext.cs
- TemplatedMailWebEventProvider.cs
- AddInSegmentDirectoryNotFoundException.cs
- ACE.cs
- Activator.cs
- XmlEncoding.cs
- QueryContinueDragEventArgs.cs
- Triplet.cs
- TextTreeFixupNode.cs
- ConnectionPoint.cs
- TdsValueSetter.cs
- StrongNameMembershipCondition.cs
- Quad.cs
- TimeSpan.cs
- CompilationRelaxations.cs
- PeerNameRegistration.cs
- AttributeProviderAttribute.cs
- FontUnitConverter.cs
- CodeCatchClause.cs
- tibetanshape.cs
- _AcceptOverlappedAsyncResult.cs
- AssemblyBuilder.cs
- GridViewColumn.cs
- EasingQuaternionKeyFrame.cs
- XPathDocument.cs
- InternalEnumValidatorAttribute.cs
- SecurityVersion.cs
- InstalledFontCollection.cs
- DictionaryMarkupSerializer.cs
- AsymmetricKeyExchangeFormatter.cs
- CheckBoxRenderer.cs
- Permission.cs
- SchemaInfo.cs
- Int32CAMarshaler.cs
- MemberJoinTreeNode.cs
- ConfigXmlElement.cs
- PreProcessor.cs
- SqlDataSourceQueryEditorForm.cs
- Stackframe.cs
- CustomAttributeSerializer.cs
- DBDataPermission.cs
- ContainerParaClient.cs
- BufferedStream.cs
- XmlSubtreeReader.cs
- TdsValueSetter.cs
- SqlConnectionPoolGroupProviderInfo.cs
- JsonFormatReaderGenerator.cs
- ValidatingCollection.cs
- QilNode.cs
- ThreadExceptionDialog.cs
- ScrollBar.cs
- ClassData.cs
- TreeNodeStyleCollection.cs
- Component.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- HttpContextWrapper.cs
- DocobjHost.cs
- MarkupCompilePass2.cs
- NullableIntAverageAggregationOperator.cs
- UndoManager.cs
- XhtmlBasicCommandAdapter.cs
- HandleCollector.cs