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
- Exception.cs
- CommandTreeTypeHelper.cs
- TabControl.cs
- SQLSingle.cs
- HttpStaticObjectsCollectionWrapper.cs
- ConnectionAcceptor.cs
- EmptyEnumerator.cs
- EventHandlerList.cs
- ActionNotSupportedException.cs
- DocumentXPathNavigator.cs
- CollectionBuilder.cs
- ZipIOLocalFileDataDescriptor.cs
- BulletedList.cs
- ProgramPublisher.cs
- TCEAdapterGenerator.cs
- TargetPerspective.cs
- FullTextLine.cs
- TransactionManager.cs
- ECDiffieHellmanCngPublicKey.cs
- DurableInstanceContextProvider.cs
- HtmlElementEventArgs.cs
- XPathMultyIterator.cs
- DeploymentExceptionMapper.cs
- ArgumentOutOfRangeException.cs
- GeometryModel3D.cs
- PtsHelper.cs
- FileDialog.cs
- GroupItemAutomationPeer.cs
- StateBag.cs
- peernodestatemanager.cs
- xmlNames.cs
- UIntPtr.cs
- DataBindingValueUIHandler.cs
- BuildProvidersCompiler.cs
- TransactionFilter.cs
- Source.cs
- PropertyNames.cs
- QilSortKey.cs
- DPCustomTypeDescriptor.cs
- DoWorkEventArgs.cs
- WebSysDefaultValueAttribute.cs
- PopupRootAutomationPeer.cs
- EventDescriptorCollection.cs
- BaseDataListActionList.cs
- Viewport3DVisual.cs
- TransactionChannelFactory.cs
- PointAnimationUsingPath.cs
- Rectangle.cs
- KnownBoxes.cs
- AnchorEditor.cs
- XmlCompatibilityReader.cs
- SqlMultiplexer.cs
- DecimalFormatter.cs
- _NativeSSPI.cs
- XmlSchemaAttributeGroupRef.cs
- CSharpCodeProvider.cs
- LinkedResource.cs
- SslStream.cs
- DirectoryRedirect.cs
- PrimaryKeyTypeConverter.cs
- MailWebEventProvider.cs
- RepeaterDesigner.cs
- Membership.cs
- ProfileParameter.cs
- SignatureToken.cs
- Model3D.cs
- IPEndPoint.cs
- xmlfixedPageInfo.cs
- DataControlField.cs
- ClickablePoint.cs
- WindowsStatic.cs
- SqlNamer.cs
- Win32Native.cs
- XmlSchemaDocumentation.cs
- SerializationTrace.cs
- objectquery_tresulttype.cs
- Control.cs
- CodeSpit.cs
- TypeDefinition.cs
- RootNamespaceAttribute.cs
- CapabilitiesAssignment.cs
- AsyncDataRequest.cs
- SmtpReplyReaderFactory.cs
- WindowInteractionStateTracker.cs
- EmbeddedObject.cs
- TextServicesPropertyRanges.cs
- SiteMapPath.cs
- PathSegmentCollection.cs
- TextEndOfParagraph.cs
- SqlNodeAnnotations.cs
- IpcPort.cs
- HtmlInputText.cs
- ExpressionList.cs
- KeyValuePairs.cs
- WebServiceHandlerFactory.cs
- HierarchicalDataSourceControl.cs
- SharedPersonalizationStateInfo.cs
- SmiRequestExecutor.cs
- AssemblySettingAttributes.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs