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
- LingerOption.cs
- PersistenceTypeAttribute.cs
- EventSourceCreationData.cs
- VectorConverter.cs
- XmlSchemaCollection.cs
- UnregisterInfo.cs
- Style.cs
- ScriptingSectionGroup.cs
- ApplicationException.cs
- CompilerCollection.cs
- ClickablePoint.cs
- ConstraintStruct.cs
- QueryableDataSourceView.cs
- ControlPropertyNameConverter.cs
- ActiveXSite.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- CommentAction.cs
- DrawingCollection.cs
- ObjectTokenCategory.cs
- GridViewCommandEventArgs.cs
- ComponentChangingEvent.cs
- TableCell.cs
- PasswordDeriveBytes.cs
- DocumentPageView.cs
- HostingPreferredMapPath.cs
- XmlSchemaImport.cs
- TextComposition.cs
- BinaryFormatterWriter.cs
- MsmqQueue.cs
- Margins.cs
- SendMailErrorEventArgs.cs
- BrushMappingModeValidation.cs
- ParserOptions.cs
- MonthCalendar.cs
- PlatformNotSupportedException.cs
- CssClassPropertyAttribute.cs
- ComponentResourceManager.cs
- ListViewItemSelectionChangedEvent.cs
- MethodBody.cs
- AuthStoreRoleProvider.cs
- DataSourceView.cs
- OleDbRowUpdatingEvent.cs
- DataGridViewColumnCollectionEditor.cs
- ClientRuntimeConfig.cs
- AssertSection.cs
- ProxyWebPart.cs
- IdnMapping.cs
- PartialList.cs
- OdbcDataAdapter.cs
- CacheSection.cs
- RemotingHelper.cs
- EventLogStatus.cs
- SafeEventLogWriteHandle.cs
- LinearGradientBrush.cs
- HtmlTernaryTree.cs
- SecUtil.cs
- LinearKeyFrames.cs
- SetStoryboardSpeedRatio.cs
- ComponentCommands.cs
- WebPartVerbCollection.cs
- XmlSchemaFacet.cs
- TableLayoutCellPaintEventArgs.cs
- recordstatescratchpad.cs
- QilExpression.cs
- MailDefinition.cs
- ViewSimplifier.cs
- Int32EqualityComparer.cs
- Win32MouseDevice.cs
- CompilerGlobalScopeAttribute.cs
- TraceContext.cs
- BuildProviderAppliesToAttribute.cs
- HttpCacheParams.cs
- TextEffect.cs
- ObjectStateManagerMetadata.cs
- UserInitiatedRoutedEventPermission.cs
- AccessDataSourceView.cs
- HttpCachePolicy.cs
- ToolStripComboBox.cs
- storepermissionattribute.cs
- SqlLiftWhereClauses.cs
- InputLanguageProfileNotifySink.cs
- SecurityUtils.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- CollectionConverter.cs
- WebMessageBodyStyleHelper.cs
- Vector3DCollection.cs
- InheritanceAttribute.cs
- httpserverutility.cs
- ColorConvertedBitmap.cs
- MarkerProperties.cs
- FieldNameLookup.cs
- DataTableClearEvent.cs
- DataTableNewRowEvent.cs
- RuntimeWrappedException.cs
- XmlMemberMapping.cs
- FontCollection.cs
- MTConfigUtil.cs
- EpmHelper.cs
- SessionStateItemCollection.cs
- WebPartsSection.cs