Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / Model / PropertyChange.cs / 1305376 / PropertyChange.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Presentation.Model { using System; using System.Collections.Generic; using System.Text; using System.Globalization; using System.Runtime; class PropertyChange : ModelChange { public ModelItem Owner { get; set; } public string PropertyName { get; set; } public ModelItem OldValue { get; set; } public ModelItem NewValue { get; set; } public ModelTreeManager ModelTreeManager { get; set; } public override string Description { get { return string.Format(CultureInfo.InvariantCulture, "{0} - {1}", SR.PropertyChangeEditingScopeDescription, this.PropertyName); } } public override bool Apply() { Fx.Assert(this.ModelTreeManager != null, "Modeltreemanager cannot be null"); Fx.Assert(this.Owner != null, "Owner modelitem cannot be null"); Fx.Assert(!String.IsNullOrEmpty(this.PropertyName), " property name cannot be null or emptry"); ModelPropertyImpl dataModelProperty = (ModelPropertyImpl)this.Owner.Properties[this.PropertyName]; ModelItem oldValue = dataModelProperty.Value; if ((oldValue == null && this.NewValue == null) || (oldValue != null && this.NewValue != null && oldValue.GetCurrentValue().Equals(this.NewValue.GetCurrentValue()))) { return false; } dataModelProperty.SetValueCore(this.NewValue); this.ModelTreeManager.NotifyPropertyChange(dataModelProperty); return true; } public override Change GetInverse() { return new PropertyChange() { ModelTreeManager = this.ModelTreeManager, Owner = this.Owner, OldValue = this.NewValue, NewValue = this.OldValue, PropertyName = this.PropertyName }; } } } // 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; using System.Globalization; using System.Runtime; class PropertyChange : ModelChange { public ModelItem Owner { get; set; } public string PropertyName { get; set; } public ModelItem OldValue { get; set; } public ModelItem NewValue { get; set; } public ModelTreeManager ModelTreeManager { get; set; } public override string Description { get { return string.Format(CultureInfo.InvariantCulture, "{0} - {1}", SR.PropertyChangeEditingScopeDescription, this.PropertyName); } } public override bool Apply() { Fx.Assert(this.ModelTreeManager != null, "Modeltreemanager cannot be null"); Fx.Assert(this.Owner != null, "Owner modelitem cannot be null"); Fx.Assert(!String.IsNullOrEmpty(this.PropertyName), " property name cannot be null or emptry"); ModelPropertyImpl dataModelProperty = (ModelPropertyImpl)this.Owner.Properties[this.PropertyName]; ModelItem oldValue = dataModelProperty.Value; if ((oldValue == null && this.NewValue == null) || (oldValue != null && this.NewValue != null && oldValue.GetCurrentValue().Equals(this.NewValue.GetCurrentValue()))) { return false; } dataModelProperty.SetValueCore(this.NewValue); this.ModelTreeManager.NotifyPropertyChange(dataModelProperty); return true; } public override Change GetInverse() { return new PropertyChange() { ModelTreeManager = this.ModelTreeManager, Owner = this.Owner, OldValue = this.NewValue, NewValue = this.OldValue, PropertyName = this.PropertyName }; } } } // 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
- FixedSOMFixedBlock.cs
- RegexStringValidatorAttribute.cs
- BamlBinaryReader.cs
- ScrollItemProviderWrapper.cs
- WebRequest.cs
- BamlLocalizationDictionary.cs
- BamlWriter.cs
- Pointer.cs
- ItemsControl.cs
- SiteMapSection.cs
- UpdateCompiler.cs
- CommandValueSerializer.cs
- ProfileGroupSettingsCollection.cs
- CodeGeneratorOptions.cs
- BrushConverter.cs
- PngBitmapDecoder.cs
- WeakEventTable.cs
- Signature.cs
- OdbcInfoMessageEvent.cs
- CachedFontFamily.cs
- PenThread.cs
- Clipboard.cs
- EventsTab.cs
- Item.cs
- LocalizabilityAttribute.cs
- ProfileServiceManager.cs
- PropertyPushdownHelper.cs
- DetailsViewInsertedEventArgs.cs
- NameSpaceExtractor.cs
- ProcessHost.cs
- WmlPanelAdapter.cs
- MarkerProperties.cs
- CompositeFontInfo.cs
- Utility.cs
- AggregateException.cs
- Button.cs
- IdentityManager.cs
- QilPatternVisitor.cs
- CuspData.cs
- Sequence.cs
- DocumentPageHost.cs
- PhoneCall.cs
- GenericIdentity.cs
- WindowsListViewGroup.cs
- ConfigurationSettings.cs
- DirectionalLight.cs
- AddressingProperty.cs
- CultureInfo.cs
- ZeroOpNode.cs
- BindingRestrictions.cs
- DateTimeValueSerializerContext.cs
- TrustManager.cs
- HwndHost.cs
- DirectionalLight.cs
- Queue.cs
- ByteAnimationBase.cs
- AttributeSetAction.cs
- DataGridViewImageCell.cs
- DetailsViewModeEventArgs.cs
- LinkedList.cs
- TypeUsageBuilder.cs
- FrameworkTemplate.cs
- FlowDocumentPage.cs
- StreamReader.cs
- WindowsSecurityToken.cs
- PathGeometry.cs
- HttpCapabilitiesSectionHandler.cs
- DynamicEntity.cs
- SortDescriptionCollection.cs
- Pair.cs
- ValueTypeFixupInfo.cs
- MasterPageCodeDomTreeGenerator.cs
- DrawListViewSubItemEventArgs.cs
- ScaleTransform.cs
- DrawingGroupDrawingContext.cs
- DiffuseMaterial.cs
- KeySplineConverter.cs
- Size3D.cs
- CodeDirectoryCompiler.cs
- ImageClickEventArgs.cs
- FastEncoderWindow.cs
- VectorConverter.cs
- ComplexPropertyEntry.cs
- BindingList.cs
- RectangleConverter.cs
- Polyline.cs
- SurrogateSelector.cs
- XmlEnumAttribute.cs
- EmbeddedMailObjectsCollection.cs
- SQLCharsStorage.cs
- mda.cs
- pingexception.cs
- ScriptResourceMapping.cs
- ExpandableObjectConverter.cs
- SqlException.cs
- XsdDateTime.cs
- GridViewRow.cs
- RemoteX509Token.cs
- OdbcParameterCollection.cs
- streamingZipPartStream.cs