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
- SafeHandles.cs
- Translator.cs
- ButtonBaseDesigner.cs
- RC2.cs
- CustomAttributeFormatException.cs
- _NativeSSPI.cs
- ProcessHostServerConfig.cs
- CompatibleComparer.cs
- ExecutionContext.cs
- AuthenticationException.cs
- DebugHandleTracker.cs
- PolyQuadraticBezierSegment.cs
- DeviceContexts.cs
- RuleAttributes.cs
- EndpointDispatcherTable.cs
- ConnectionManagementSection.cs
- NetCodeGroup.cs
- GridItemPatternIdentifiers.cs
- AddInProcess.cs
- TakeOrSkipQueryOperator.cs
- Utils.cs
- FakeModelItemImpl.cs
- PointCollectionValueSerializer.cs
- DotExpr.cs
- WebEventTraceProvider.cs
- DESCryptoServiceProvider.cs
- SerializationAttributes.cs
- CodeValidator.cs
- WebDisplayNameAttribute.cs
- TimeSpanStorage.cs
- QilTypeChecker.cs
- ConfigurationManagerInternalFactory.cs
- AssemblyResourceLoader.cs
- BaseParaClient.cs
- dataprotectionpermissionattribute.cs
- DetailsViewPagerRow.cs
- SerializationInfo.cs
- ToolStripGrip.cs
- TextTreeInsertElementUndoUnit.cs
- MarkupCompiler.cs
- SerializationInfo.cs
- TerminateDesigner.cs
- TypeLoader.cs
- ContainerParagraph.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- CompilerHelpers.cs
- XmlSchemaSimpleTypeRestriction.cs
- Shape.cs
- SQLCharsStorage.cs
- DialogWindow.cs
- HwndSourceKeyboardInputSite.cs
- XamlWriter.cs
- HtmlFormWrapper.cs
- SemanticResultValue.cs
- ObjectKeyFrameCollection.cs
- AutomationPropertyInfo.cs
- MSAANativeProvider.cs
- BitmapData.cs
- OutputCacheProviderCollection.cs
- InputScopeNameConverter.cs
- PixelShader.cs
- TTSEngineProxy.cs
- ContentPropertyAttribute.cs
- AffineTransform3D.cs
- PanelStyle.cs
- WorkItem.cs
- DockingAttribute.cs
- DisplayInformation.cs
- PriorityItem.cs
- UnauthorizedAccessException.cs
- MdiWindowListStrip.cs
- SymbolEqualComparer.cs
- PolicyFactory.cs
- XsdCachingReader.cs
- WindowsUpDown.cs
- AddressAlreadyInUseException.cs
- MsmqUri.cs
- EntityDataReader.cs
- arc.cs
- SecurityState.cs
- CompositeControlDesigner.cs
- __Filters.cs
- Button.cs
- DataGridViewCellParsingEventArgs.cs
- NavigationService.cs
- DataExpression.cs
- RelationshipManager.cs
- Model3DGroup.cs
- Update.cs
- ComboBoxRenderer.cs
- ZipIOLocalFileBlock.cs
- FontUnitConverter.cs
- AttributeProviderAttribute.cs
- EntityContainer.cs
- ProxyFragment.cs
- OpenFileDialog.cs
- ObjectDataSourceSelectingEventArgs.cs
- CachedBitmap.cs
- HintTextConverter.cs
- loginstatus.cs