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
- XPathSingletonIterator.cs
- NotifyCollectionChangedEventArgs.cs
- DataServiceContext.cs
- ConfigXmlComment.cs
- WindowsClientCredential.cs
- ThreadSafeList.cs
- ListViewGroupConverter.cs
- ContainerControl.cs
- ConfigurationProperty.cs
- DataSpaceManager.cs
- mediaeventargs.cs
- HtmlSelect.cs
- Utils.cs
- RewritingValidator.cs
- NativeMethods.cs
- DataColumn.cs
- CompressedStack.cs
- ManagementEventArgs.cs
- SerializerWriterEventHandlers.cs
- GatewayDefinition.cs
- SimpleWebHandlerParser.cs
- ListMarkerLine.cs
- Visual3D.cs
- KeyboardEventArgs.cs
- DependencyPropertyChangedEventArgs.cs
- StyleXamlTreeBuilder.cs
- ListMarkerSourceInfo.cs
- SqlCommandSet.cs
- EventLogger.cs
- DBCommandBuilder.cs
- DataGridCell.cs
- Number.cs
- ListenerSessionConnection.cs
- SchemaImporter.cs
- OutputCacheSettings.cs
- FontWeight.cs
- Point.cs
- EventEntry.cs
- RenderCapability.cs
- FileEnumerator.cs
- filewebresponse.cs
- BufferAllocator.cs
- StatusBarItem.cs
- Menu.cs
- ColorConvertedBitmapExtension.cs
- ThreadAbortException.cs
- SqlCacheDependencySection.cs
- NamespaceInfo.cs
- NetCodeGroup.cs
- RelationshipSet.cs
- X509CertificateClaimSet.cs
- TraceHwndHost.cs
- SqlConnectionStringBuilder.cs
- ListViewTableRow.cs
- CollectionChangeEventArgs.cs
- IImplicitResourceProvider.cs
- UpdatePanelTriggerCollection.cs
- StreamMarshaler.cs
- RouteItem.cs
- ImageDrawing.cs
- FamilyTypeface.cs
- PagesChangedEventArgs.cs
- UInt16Storage.cs
- RowToFieldTransformer.cs
- FixedDocumentSequencePaginator.cs
- SmtpException.cs
- HandleTable.cs
- DispatchChannelSink.cs
- UIElementHelper.cs
- WebPartUtil.cs
- FunctionDescription.cs
- EqualityComparer.cs
- ConfigXmlAttribute.cs
- BamlRecordHelper.cs
- Component.cs
- BrowserDefinition.cs
- ReadOnlyHierarchicalDataSourceView.cs
- EntitySetBaseCollection.cs
- UshortList2.cs
- TextFormatterHost.cs
- ActivityStatusChangeEventArgs.cs
- RenderTargetBitmap.cs
- MissingFieldException.cs
- DataGridViewSortCompareEventArgs.cs
- Pair.cs
- entityreference_tresulttype.cs
- ChtmlTextWriter.cs
- ListView.cs
- DocumentXPathNavigator.cs
- ToolboxItemSnapLineBehavior.cs
- MetadataCache.cs
- HttpBindingExtension.cs
- ClientConfigurationSystem.cs
- ProxyHelper.cs
- TdsRecordBufferSetter.cs
- CompressedStack.cs
- OutputCacheModule.cs
- BrowserTree.cs
- GridEntry.cs
- ApplicationTrust.cs