Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SmiMetaData.cs
- ConfigXmlSignificantWhitespace.cs
- InternalEnumValidator.cs
- SettingsPropertyNotFoundException.cs
- NavigationProgressEventArgs.cs
- Mappings.cs
- LostFocusEventManager.cs
- NonClientArea.cs
- WebPartTransformerCollection.cs
- ViewLoader.cs
- InstanceCreationEditor.cs
- ProgressBarBrushConverter.cs
- BaseHashHelper.cs
- BuildManager.cs
- WebResponse.cs
- RepeaterCommandEventArgs.cs
- Bezier.cs
- TreeWalkHelper.cs
- SecurityElement.cs
- DbProviderConfigurationHandler.cs
- Keyboard.cs
- NullReferenceException.cs
- BreakSafeBase.cs
- IdentitySection.cs
- FreezableCollection.cs
- SequentialWorkflowRootDesigner.cs
- PiiTraceSource.cs
- TextServicesManager.cs
- SafePointer.cs
- _PooledStream.cs
- XamlToRtfParser.cs
- SqlLiftIndependentRowExpressions.cs
- FastEncoderWindow.cs
- OptimizerPatterns.cs
- RIPEMD160.cs
- ContractTypeNameCollection.cs
- StrokeCollectionDefaultValueFactory.cs
- EndpointAddress.cs
- InstanceDataCollection.cs
- ExpandCollapseProviderWrapper.cs
- StretchValidation.cs
- XmlExceptionHelper.cs
- ConfigXmlSignificantWhitespace.cs
- AnnotationResourceChangedEventArgs.cs
- ConfigurationElementProperty.cs
- BadImageFormatException.cs
- DBBindings.cs
- DetailsViewCommandEventArgs.cs
- EmbeddedMailObjectsCollection.cs
- RSAPKCS1KeyExchangeFormatter.cs
- PointCollectionConverter.cs
- AvTraceFormat.cs
- DropShadowBitmapEffect.cs
- ColorConvertedBitmapExtension.cs
- TextAction.cs
- ShaperBuffers.cs
- KeyValuePair.cs
- XmlDeclaration.cs
- SettingsPropertyCollection.cs
- Tokenizer.cs
- PermissionToken.cs
- ServicePerformanceCounters.cs
- Identity.cs
- XpsFilter.cs
- ColumnTypeConverter.cs
- DataFormats.cs
- smtppermission.cs
- FaultReasonText.cs
- UMPAttributes.cs
- EndpointIdentityConverter.cs
- NamespaceInfo.cs
- ISSmlParser.cs
- SoapSchemaImporter.cs
- QuestionEventArgs.cs
- CustomPeerResolverService.cs
- HighlightVisual.cs
- EllipseGeometry.cs
- MemberAccessException.cs
- SHA256.cs
- CatalogPartChrome.cs
- AttachedPropertyBrowsableAttribute.cs
- TimersDescriptionAttribute.cs
- SafeNativeMethodsMilCoreApi.cs
- UnauthorizedWebPart.cs
- LabelTarget.cs
- WorkflowApplicationException.cs
- TogglePattern.cs
- SQLSingleStorage.cs
- CatalogPartChrome.cs
- ContentPropertyAttribute.cs
- GridViewHeaderRowPresenter.cs
- Stream.cs
- InvokeWebService.cs
- GorillaCodec.cs
- CodeDOMProvider.cs
- ImageMetadata.cs
- GeneralTransformGroup.cs
- ServiceDiscoveryBehavior.cs
- SystemMulticastIPAddressInformation.cs
- OutputScope.cs