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
- ItemPager.cs
- WaitingCursor.cs
- WindowsProgressbar.cs
- PrimaryKeyTypeConverter.cs
- XmlWrappingReader.cs
- IFlowDocumentViewer.cs
- XmlDocumentFieldSchema.cs
- XmlSchemaGroupRef.cs
- ProxyOperationRuntime.cs
- Line.cs
- NameValueSectionHandler.cs
- Char.cs
- NativeMethodsCLR.cs
- CorrelationToken.cs
- TokenizerHelper.cs
- EndpointAddress.cs
- DictionaryContent.cs
- DocumentOrderComparer.cs
- ObjectQuery.cs
- _StreamFramer.cs
- ContentType.cs
- CodeAssignStatement.cs
- MediaContext.cs
- SmtpReplyReaderFactory.cs
- StatusBarPanel.cs
- SslStreamSecurityElement.cs
- counter.cs
- ErrorLog.cs
- DbConnectionOptions.cs
- TextEditorDragDrop.cs
- AttributeData.cs
- OleDbCommand.cs
- ISAPIWorkerRequest.cs
- DictionarySectionHandler.cs
- ToolboxComponentsCreatedEventArgs.cs
- PasswordBoxAutomationPeer.cs
- SevenBitStream.cs
- GridErrorDlg.cs
- XsltSettings.cs
- CodeTypeMember.cs
- smtpconnection.cs
- DocumentEventArgs.cs
- CodeExpressionStatement.cs
- ActionNotSupportedException.cs
- Property.cs
- AlternationConverter.cs
- safesecurityhelperavalon.cs
- HttpHandlerAction.cs
- SmtpNtlmAuthenticationModule.cs
- ClientSideProviderDescription.cs
- ControlParameter.cs
- ProtocolsConfigurationHandler.cs
- LookupNode.cs
- TemplateControlBuildProvider.cs
- SafeViewOfFileHandle.cs
- SqlTriggerAttribute.cs
- KnownTypes.cs
- ObjectConverter.cs
- Vector.cs
- OrderingQueryOperator.cs
- fixedPageContentExtractor.cs
- ControlParameter.cs
- TypeLoadException.cs
- AtomEntry.cs
- listitem.cs
- SystemEvents.cs
- ImageListStreamer.cs
- CodeDomSerializer.cs
- ParallelTimeline.cs
- sqlcontext.cs
- SoapAttributes.cs
- ProxySimple.cs
- BaseCAMarshaler.cs
- XmlQualifiedName.cs
- _SslStream.cs
- ThreadStaticAttribute.cs
- IdentifierCollection.cs
- TextStore.cs
- DataView.cs
- ObjectReaderCompiler.cs
- ZipIOExtraField.cs
- MessageAction.cs
- WebPartConnectionCollection.cs
- ElementHostPropertyMap.cs
- GlobalizationAssembly.cs
- SqlAliaser.cs
- securitymgrsite.cs
- RegexFCD.cs
- TableChangeProcessor.cs
- ListGeneralPage.cs
- ResourceManager.cs
- PriorityBindingExpression.cs
- JsonFormatMapping.cs
- TreeView.cs
- DictionaryEditChange.cs
- SqlTypesSchemaImporter.cs
- cryptoapiTransform.cs
- CriticalHandle.cs
- Schema.cs
- EmptyElement.cs