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
- IListConverters.cs
- SafeRightsManagementEnvironmentHandle.cs
- AppDomainManager.cs
- ServiceMemoryGates.cs
- EventHandlersDesigner.cs
- BaseCodeDomTreeGenerator.cs
- ProfileSettings.cs
- AdvancedBindingEditor.cs
- HtmlInputSubmit.cs
- RegexTree.cs
- X509ChainPolicy.cs
- DefaultEventAttribute.cs
- ReverseInheritProperty.cs
- MissingMemberException.cs
- CustomAttributeBuilder.cs
- StretchValidation.cs
- MemberHolder.cs
- CacheRequest.cs
- EmptyEnumerator.cs
- ParserHooks.cs
- ToolBarPanel.cs
- XmlMemberMapping.cs
- DockPattern.cs
- OleDbDataReader.cs
- AssemblyAttributesGoHere.cs
- ItemContainerGenerator.cs
- RegexStringValidator.cs
- WebEventTraceProvider.cs
- DateRangeEvent.cs
- CodeDirectionExpression.cs
- SQLRoleProvider.cs
- Point3DCollection.cs
- DataTableReader.cs
- WebReferenceCollection.cs
- XmlSchemaAttributeGroupRef.cs
- RegisteredHiddenField.cs
- Int32RectConverter.cs
- GradientSpreadMethodValidation.cs
- ExceptionUtility.cs
- SourceLineInfo.cs
- SqlCharStream.cs
- HttpChannelBindingToken.cs
- TabControl.cs
- XappLauncher.cs
- TextEditorCopyPaste.cs
- DbReferenceCollection.cs
- StringReader.cs
- TemplateControlCodeDomTreeGenerator.cs
- XmlDownloadManager.cs
- DefaultPropertiesToSend.cs
- EventLogLink.cs
- ConnectionConsumerAttribute.cs
- StateMachineHelpers.cs
- Pens.cs
- HttpCachePolicyWrapper.cs
- AtomicFile.cs
- XPathNodePointer.cs
- Bezier.cs
- Size.cs
- PrintPreviewDialog.cs
- ToolStripItemCollection.cs
- DebugView.cs
- PostBackOptions.cs
- XPathBinder.cs
- CompilationSection.cs
- Vector3DCollection.cs
- RangeContentEnumerator.cs
- StrongNameMembershipCondition.cs
- DeclarationUpdate.cs
- BigInt.cs
- RtfControlWordInfo.cs
- XmlSchemaAnnotation.cs
- ParameterCollection.cs
- CommonRemoteMemoryBlock.cs
- SqlFunctionAttribute.cs
- WebDescriptionAttribute.cs
- RenderOptions.cs
- TemplateLookupAction.cs
- ProcessMessagesAsyncResult.cs
- QilExpression.cs
- ProcessingInstructionAction.cs
- RevocationPoint.cs
- ObjectManager.cs
- ViewSimplifier.cs
- QueryStringHandler.cs
- UIElement3DAutomationPeer.cs
- XmlDomTextWriter.cs
- ListViewUpdatedEventArgs.cs
- StatusStrip.cs
- SqlClientWrapperSmiStreamChars.cs
- AnnotationObservableCollection.cs
- RadialGradientBrush.cs
- URLMembershipCondition.cs
- DocumentViewerBaseAutomationPeer.cs
- ClientSideProviderDescription.cs
- TreeView.cs
- SqlParameterCollection.cs
- Baml2006ReaderFrame.cs
- ValidationService.cs
- MouseEventArgs.cs