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
- DataFormat.cs
- ProcessModelInfo.cs
- SafeLocalMemHandle.cs
- NativeMethods.cs
- ConstraintConverter.cs
- UserMapPath.cs
- CryptoKeySecurity.cs
- HtmlWindow.cs
- SafeHandles.cs
- Vector3DAnimationBase.cs
- OdbcDataReader.cs
- RoleManagerModule.cs
- designeractionlistschangedeventargs.cs
- HttpCacheVaryByContentEncodings.cs
- BitmapFrameEncode.cs
- InstanceKeyView.cs
- Drawing.cs
- DataTemplateSelector.cs
- OleDbEnumerator.cs
- HandleCollector.cs
- SerTrace.cs
- SecurityAlgorithmSuite.cs
- XmlSchemaSimpleContentRestriction.cs
- TypeElement.cs
- QueryOpcode.cs
- StylusPointProperty.cs
- BamlRecords.cs
- DataTableReader.cs
- DataColumnCollection.cs
- ZipIOExtraFieldZip64Element.cs
- SystemDropShadowChrome.cs
- DefaultAssemblyResolver.cs
- UnhandledExceptionEventArgs.cs
- Pens.cs
- AnimatedTypeHelpers.cs
- SafeMILHandleMemoryPressure.cs
- DrawListViewSubItemEventArgs.cs
- FontWeights.cs
- StringFreezingAttribute.cs
- ModelUIElement3D.cs
- ClientType.cs
- TextRange.cs
- RichTextBoxAutomationPeer.cs
- StorageInfo.cs
- DocumentsTrace.cs
- LinearGradientBrush.cs
- CodeThrowExceptionStatement.cs
- AccessDataSource.cs
- ServiceNameElement.cs
- Pts.cs
- DetailsViewCommandEventArgs.cs
- WindowsToolbarAsMenu.cs
- ConversionContext.cs
- HttpResponseMessageProperty.cs
- ScopelessEnumAttribute.cs
- ResourceLoader.cs
- TcpHostedTransportConfiguration.cs
- JournalEntryListConverter.cs
- BitmapMetadataBlob.cs
- RelationshipEnd.cs
- TextReader.cs
- Substitution.cs
- BindingListCollectionView.cs
- AddInAttribute.cs
- ToolStripPanel.cs
- AssociationSetEnd.cs
- ConstraintEnumerator.cs
- WindowProviderWrapper.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- TransactionsSectionGroup.cs
- PrimitiveRenderer.cs
- InternalRelationshipCollection.cs
- ApplicationSecurityManager.cs
- ServiceDeploymentInfo.cs
- SessionPageStateSection.cs
- SelectorItemAutomationPeer.cs
- ObjectListCommand.cs
- FileAuthorizationModule.cs
- translator.cs
- ObjectSet.cs
- NameValuePermission.cs
- SignatureToken.cs
- NonSerializedAttribute.cs
- HttpApplicationFactory.cs
- TextMetrics.cs
- WrappedReader.cs
- XamlFilter.cs
- SafeFindHandle.cs
- EntityFrameworkVersions.cs
- DesignTable.cs
- TextRunCacheImp.cs
- Policy.cs
- UserThread.cs
- ToolStripOverflow.cs
- XmlEncodedRawTextWriter.cs
- TreeNodeStyleCollectionEditor.cs
- ProcessModelSection.cs
- RunClient.cs
- CalendarModeChangedEventArgs.cs
- FixedSOMPageConstructor.cs