Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BufferAllocator.cs
- SafeTimerHandle.cs
- SymmetricKeyWrap.cs
- WebPartEditorCancelVerb.cs
- AtomMaterializer.cs
- CipherData.cs
- SoapSchemaExporter.cs
- TableCellAutomationPeer.cs
- HasCopySemanticsAttribute.cs
- PrintingPermission.cs
- SemaphoreSecurity.cs
- ToggleButton.cs
- AuthorizationRuleCollection.cs
- MSAANativeProvider.cs
- SessionViewState.cs
- SerialErrors.cs
- PrimitiveDataContract.cs
- VectorCollectionConverter.cs
- BuildResult.cs
- TextDecoration.cs
- ReferenceSchema.cs
- XPathDescendantIterator.cs
- ScriptReference.cs
- SystemColorTracker.cs
- MainMenu.cs
- Itemizer.cs
- EventMap.cs
- HierarchicalDataBoundControl.cs
- StrongNameHelpers.cs
- GridView.cs
- ZipIOBlockManager.cs
- ParameterModifier.cs
- SmiMetaData.cs
- ToolStripArrowRenderEventArgs.cs
- DataContractJsonSerializer.cs
- ToolBarButton.cs
- NegationPusher.cs
- OdbcConnectionPoolProviderInfo.cs
- CompositeActivityCodeGenerator.cs
- XmlSignatureManifest.cs
- SimpleWorkerRequest.cs
- Subordinate.cs
- MediaElementAutomationPeer.cs
- InvalidCommandTreeException.cs
- SqlDataReader.cs
- RepeatInfo.cs
- BooleanProjectedSlot.cs
- glyphs.cs
- GraphicsContainer.cs
- Socket.cs
- QualifiedCellIdBoolean.cs
- BuilderElements.cs
- RootBrowserWindowAutomationPeer.cs
- RowUpdatedEventArgs.cs
- LayoutUtils.cs
- documentsequencetextcontainer.cs
- PositiveTimeSpanValidator.cs
- WebPartHelpVerb.cs
- ChannelServices.cs
- SiteMap.cs
- ActivityCodeDomSerializationManager.cs
- TheQuery.cs
- ResourceExpressionBuilder.cs
- ToolStripSplitStackLayout.cs
- DataTemplateKey.cs
- DefaultHttpHandler.cs
- BufferBuilder.cs
- HandleExceptionArgs.cs
- PartitionerStatic.cs
- ObfuscateAssemblyAttribute.cs
- PagedDataSource.cs
- DataSourceHelper.cs
- XsltSettings.cs
- PersonalizablePropertyEntry.cs
- TypeConverterBase.cs
- DataGridViewSelectedRowCollection.cs
- ComplexBindingPropertiesAttribute.cs
- HtmlInputReset.cs
- NullRuntimeConfig.cs
- MetadataArtifactLoader.cs
- ElementHostAutomationPeer.cs
- ToolStripContentPanelDesigner.cs
- Journal.cs
- UTF32Encoding.cs
- BooleanSwitch.cs
- DependencySource.cs
- InstanceLockException.cs
- EdmFunction.cs
- XmlDataCollection.cs
- FixedFindEngine.cs
- TextRangeProviderWrapper.cs
- CultureInfo.cs
- AppDomainManager.cs
- ToolStripGrip.cs
- DesignerValidatorAdapter.cs
- DispatcherObject.cs
- SQLGuidStorage.cs
- SqlNotificationEventArgs.cs
- OdbcParameterCollection.cs
- PropertyCondition.cs