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
- HttpException.cs
- HashAlgorithm.cs
- SQLByteStorage.cs
- LineMetrics.cs
- ToolStripItemImageRenderEventArgs.cs
- ReadOnlyDictionary.cs
- CalendarDesigner.cs
- SQLByte.cs
- webproxy.cs
- Component.cs
- SafeSystemMetrics.cs
- ConfigurationFileMap.cs
- ToolBarButtonDesigner.cs
- CodeDOMUtility.cs
- BinaryFormatter.cs
- SSmlParser.cs
- DoubleCollectionConverter.cs
- ObjectAnimationUsingKeyFrames.cs
- ReachPageContentSerializerAsync.cs
- WpfWebRequestHelper.cs
- WS2007HttpBindingCollectionElement.cs
- FileUtil.cs
- OperatingSystem.cs
- OleDbCommandBuilder.cs
- SqlDataSourceFilteringEventArgs.cs
- CodeGotoStatement.cs
- RadioButtonList.cs
- IERequestCache.cs
- ClockController.cs
- SmiMetaData.cs
- SemanticBasicElement.cs
- LocalizedNameDescriptionPair.cs
- ImageSourceValueSerializer.cs
- InstancePersistenceCommandException.cs
- SubclassTypeValidatorAttribute.cs
- PrimarySelectionAdorner.cs
- DoubleMinMaxAggregationOperator.cs
- PhysicalAddress.cs
- NonVisualControlAttribute.cs
- DelimitedListTraceListener.cs
- Globals.cs
- WriteableBitmap.cs
- AvTraceDetails.cs
- CompositeFontFamily.cs
- Messages.cs
- XmlDataFileEditor.cs
- PrivilegedConfigurationManager.cs
- CipherData.cs
- FactoryGenerator.cs
- MessageTransmitTraceRecord.cs
- AsymmetricSignatureFormatter.cs
- SequentialUshortCollection.cs
- WebScriptServiceHostFactory.cs
- GridViewCancelEditEventArgs.cs
- Serializer.cs
- NativeMethods.cs
- TableRowCollection.cs
- BitmapEffect.cs
- AdornerPresentationContext.cs
- DataObjectCopyingEventArgs.cs
- RequestCache.cs
- BufferModeSettings.cs
- IOException.cs
- WrappedDispatcherException.cs
- ToRequest.cs
- DataGridViewImageCell.cs
- SynchronousChannelMergeEnumerator.cs
- WebPartConnectionsConfigureVerb.cs
- AnimationClockResource.cs
- QueryPrefixOp.cs
- StylusEditingBehavior.cs
- GenericTypeParameterBuilder.cs
- StandardBindingElementCollection.cs
- PasswordTextContainer.cs
- NavigatorOutput.cs
- LinkedResourceCollection.cs
- Transform3DGroup.cs
- LicenseException.cs
- TableCell.cs
- ExpressionTextBoxAutomationPeer.cs
- RequestCache.cs
- Invariant.cs
- Deflater.cs
- EdmItemError.cs
- SchemaCreator.cs
- TemplateContainer.cs
- SerializationAttributes.cs
- ColumnHeader.cs
- HtmlElement.cs
- exports.cs
- StrongNameIdentityPermission.cs
- TdsEnums.cs
- Int64Animation.cs
- Timer.cs
- AnonymousIdentificationModule.cs
- IfElseDesigner.xaml.cs
- UnicodeEncoding.cs
- DataGridViewCellConverter.cs
- LicenseManager.cs
- WindowsFormsSynchronizationContext.cs