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
- PropertyAccessVisitor.cs
- TextModifier.cs
- ObjectListCommandsPage.cs
- Lease.cs
- ServiceDeploymentInfo.cs
- WebEventCodes.cs
- Button.cs
- CurrentChangingEventManager.cs
- PointLight.cs
- httpserverutility.cs
- Guid.cs
- DataRowCollection.cs
- SimpleApplicationHost.cs
- Authorization.cs
- SecurityTraceRecordHelper.cs
- login.cs
- AutoResetEvent.cs
- SQLBinary.cs
- EventWaitHandle.cs
- AlphabeticalEnumConverter.cs
- MediaSystem.cs
- TextElementEnumerator.cs
- CqlLexerHelpers.cs
- CipherData.cs
- ScriptingAuthenticationServiceSection.cs
- WebHostUnsafeNativeMethods.cs
- ValidationUtility.cs
- CheckableControlBaseAdapter.cs
- MiniModule.cs
- Attributes.cs
- DesignerVerb.cs
- Error.cs
- TcpHostedTransportConfiguration.cs
- wgx_commands.cs
- DynamicValidatorEventArgs.cs
- TextView.cs
- ColorDialog.cs
- ScriptResourceInfo.cs
- Operand.cs
- InvokeMemberBinder.cs
- DataListItemCollection.cs
- AnimationException.cs
- RepeatButton.cs
- CloudCollection.cs
- WebControl.cs
- Native.cs
- CallTemplateAction.cs
- IdentityNotMappedException.cs
- SetIterators.cs
- ScrollItemPatternIdentifiers.cs
- TemplateBamlTreeBuilder.cs
- SystemWebExtensionsSectionGroup.cs
- ButtonField.cs
- UInt32Converter.cs
- CodeParameterDeclarationExpression.cs
- IndexedGlyphRun.cs
- SystemIcons.cs
- DesignerActionMethodItem.cs
- TextEditorTables.cs
- CommandConverter.cs
- WebPartVerbsEventArgs.cs
- Color.cs
- EndpointDiscoveryMetadata.cs
- PathSegment.cs
- HtmlGenericControl.cs
- Literal.cs
- LookupBindingPropertiesAttribute.cs
- IChannel.cs
- IndependentAnimationStorage.cs
- UIElement.cs
- MutexSecurity.cs
- DbConnectionFactory.cs
- SQLBoolean.cs
- Event.cs
- DataGridColumn.cs
- WebPartAuthorizationEventArgs.cs
- QilCloneVisitor.cs
- RoleManagerModule.cs
- FactoryGenerator.cs
- SelectionPatternIdentifiers.cs
- _Rfc2616CacheValidators.cs
- Deflater.cs
- HandlerWithFactory.cs
- NativeMethods.cs
- EmptyElement.cs
- XmlAttributeOverrides.cs
- AvTraceDetails.cs
- precedingquery.cs
- followingquery.cs
- PersonalizablePropertyEntry.cs
- MILUtilities.cs
- ElementsClipboardData.cs
- _ListenerAsyncResult.cs
- BindingSource.cs
- ChannelTokenTypeConverter.cs
- ContentFileHelper.cs
- EventBuilder.cs
- DBSqlParser.cs
- OdbcParameterCollection.cs
- ItemAutomationPeer.cs