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
- Models.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- XPathDocumentNavigator.cs
- TextPenaltyModule.cs
- Range.cs
- ObjectResult.cs
- DirectionalAction.cs
- TimeZoneNotFoundException.cs
- UnsafeNativeMethods.cs
- TypeBuilderInstantiation.cs
- EventMappingSettings.cs
- EnumMemberAttribute.cs
- WindowsToolbarItemAsMenuItem.cs
- TrackingServices.cs
- DerivedKeyCachingSecurityTokenSerializer.cs
- Image.cs
- BufferBuilder.cs
- TimelineGroup.cs
- SkinBuilder.cs
- InputLanguageEventArgs.cs
- TypefaceCollection.cs
- ParenthesizePropertyNameAttribute.cs
- TdsParameterSetter.cs
- AllowedAudienceUriElement.cs
- HtmlPhoneCallAdapter.cs
- WarningException.cs
- XmlUtil.cs
- KeyboardInputProviderAcquireFocusEventArgs.cs
- ListenerSessionConnectionReader.cs
- StrokeNodeData.cs
- XhtmlBasicLiteralTextAdapter.cs
- BooleanFunctions.cs
- XmlWriterTraceListener.cs
- DocumentApplicationState.cs
- RectAnimation.cs
- UnsafeNativeMethods.cs
- AppDomainManager.cs
- ThemeInfoAttribute.cs
- StringValueSerializer.cs
- ContentElementAutomationPeer.cs
- InvokeMemberBinder.cs
- CollectionEditorDialog.cs
- ItemsControlAutomationPeer.cs
- StackOverflowException.cs
- ObservableCollection.cs
- XmlReaderSettings.cs
- CodeObject.cs
- _HelperAsyncResults.cs
- SynchronizationFilter.cs
- StringSource.cs
- FunctionDetailsReader.cs
- ActiveDesignSurfaceEvent.cs
- LocatorBase.cs
- HandleDictionary.cs
- OutputScopeManager.cs
- WinEventQueueItem.cs
- XmlCompatibilityReader.cs
- FormatStringEditor.cs
- CapabilitiesState.cs
- XmlSchemaIdentityConstraint.cs
- WebPartZone.cs
- Knowncolors.cs
- ActivityDesignerHelper.cs
- WriteLineDesigner.xaml.cs
- JsonReader.cs
- SamlSubject.cs
- Tuple.cs
- Translator.cs
- AbsoluteQuery.cs
- AuthenticationException.cs
- ErrorFormatterPage.cs
- WindowsAuthenticationModule.cs
- WindowsScrollBar.cs
- StringExpressionSet.cs
- AdPostCacheSubstitution.cs
- PersonalizationProviderCollection.cs
- MemberAccessException.cs
- ThicknessAnimation.cs
- Brush.cs
- Padding.cs
- SamlAdvice.cs
- TraceContext.cs
- SoapUnknownHeader.cs
- DataGridViewBindingCompleteEventArgs.cs
- MouseDevice.cs
- NTAccount.cs
- PbrsForward.cs
- ImageConverter.cs
- DocumentViewerHelper.cs
- FontSource.cs
- EntityException.cs
- ConstraintConverter.cs
- ToolboxComponentsCreatingEventArgs.cs
- Exception.cs
- ClrPerspective.cs
- DetailsViewActionList.cs
- DataGridHeaderBorder.cs
- FileDialog_Vista.cs
- SHA384.cs
- RSAPKCS1KeyExchangeDeformatter.cs