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
- HttpConfigurationContext.cs
- XsdCachingReader.cs
- PropertyMapper.cs
- ExpressionVisitor.cs
- XmlExtensionFunction.cs
- ColorPalette.cs
- ScrollChrome.cs
- KeyboardNavigation.cs
- DescendantBaseQuery.cs
- COAUTHIDENTITY.cs
- ReflectionServiceProvider.cs
- ApplicationServicesHostFactory.cs
- HandlerBase.cs
- SqlLiftWhereClauses.cs
- TripleDESCryptoServiceProvider.cs
- Exceptions.cs
- DataGridViewColumnTypePicker.cs
- NamespaceEmitter.cs
- OleCmdHelper.cs
- UnmanagedMemoryStreamWrapper.cs
- WindowsSecurityToken.cs
- WebBrowserNavigatedEventHandler.cs
- DataGridViewCellEventArgs.cs
- SerializationEventsCache.cs
- InputElement.cs
- SmiGettersStream.cs
- NativeMethods.cs
- PropertySegmentSerializationProvider.cs
- ToolStripContainer.cs
- Gdiplus.cs
- ConnectionConsumerAttribute.cs
- CustomLineCap.cs
- XmlQualifiedNameTest.cs
- DbgUtil.cs
- GroupItemAutomationPeer.cs
- SafeHandles.cs
- XmlSchemaObjectTable.cs
- ComplexType.cs
- ComplexType.cs
- EventLogPermissionEntry.cs
- CodeCatchClause.cs
- SqlStatistics.cs
- ObjectPropertyMapping.cs
- ParserExtension.cs
- HttpCacheVary.cs
- EmptyControlCollection.cs
- VerificationException.cs
- TargetException.cs
- GeneralTransform3DTo2DTo3D.cs
- RedirectionProxy.cs
- CallbackBehaviorAttribute.cs
- FileLogRecordStream.cs
- CacheRequest.cs
- Mappings.cs
- Empty.cs
- XmlSchemaGroupRef.cs
- DataSourceControl.cs
- WebPartPersonalization.cs
- Pair.cs
- IndicFontClient.cs
- TimeZoneInfo.cs
- Propagator.cs
- ChangeInterceptorAttribute.cs
- ErrorFormatterPage.cs
- X509ChainElement.cs
- SecurityRuntime.cs
- SemaphoreSlim.cs
- XmlSchemaObjectCollection.cs
- SynchronizedPool.cs
- SelectionChangedEventArgs.cs
- WebPartConnectionsCancelVerb.cs
- HttpCachePolicyWrapper.cs
- PropertyToken.cs
- InvalidAsynchronousStateException.cs
- RegexParser.cs
- QueryOpeningEnumerator.cs
- ResourceAttributes.cs
- IdleTimeoutMonitor.cs
- Process.cs
- RenderCapability.cs
- HttpProcessUtility.cs
- AuthorizationSection.cs
- SystemFonts.cs
- HtmlInputCheckBox.cs
- KeyValuePair.cs
- DbProviderConfigurationHandler.cs
- MenuItemAutomationPeer.cs
- Rule.cs
- SectionVisual.cs
- LinearKeyFrames.cs
- FolderBrowserDialog.cs
- XDeferredAxisSource.cs
- IRCollection.cs
- StateFinalizationDesigner.cs
- DataObjectCopyingEventArgs.cs
- DecoderNLS.cs
- streamingZipPartStream.cs
- XPathNavigatorKeyComparer.cs
- TextEffect.cs
- DynamicUpdateCommand.cs