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
- MultiViewDesigner.cs
- DBConnectionString.cs
- SmtpDigestAuthenticationModule.cs
- TabControlAutomationPeer.cs
- SafeLocalAllocation.cs
- DifferencingCollection.cs
- ViewManager.cs
- MethodBuilderInstantiation.cs
- typedescriptorpermissionattribute.cs
- DropDownButton.cs
- XmlImplementation.cs
- StyleSelector.cs
- FormsAuthenticationUserCollection.cs
- SizeF.cs
- InfoCardKeyedHashAlgorithm.cs
- CompilerParameters.cs
- ColumnMapCopier.cs
- ColumnClickEvent.cs
- EndpointReference.cs
- GeneralTransform3DTo2DTo3D.cs
- SessionViewState.cs
- DataSetMappper.cs
- FloaterParagraph.cs
- PagedDataSource.cs
- EditingCoordinator.cs
- ActivityCodeDomReferenceService.cs
- DynamicPropertyHolder.cs
- ObjectParameterCollection.cs
- XPathNodeInfoAtom.cs
- FrameSecurityDescriptor.cs
- NoClickablePointException.cs
- DesignerTransaction.cs
- MobileUITypeEditor.cs
- PartialClassGenerationTask.cs
- DataGridViewTextBoxEditingControl.cs
- ExecutionEngineException.cs
- OleStrCAMarshaler.cs
- Encoder.cs
- StringAttributeCollection.cs
- SqlTypeConverter.cs
- NewArrayExpression.cs
- WebResponse.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- ArglessEventHandlerProxy.cs
- ConcurrencyBehavior.cs
- ExpressionTable.cs
- QuaternionIndependentAnimationStorage.cs
- DataPagerFieldCommandEventArgs.cs
- ManagementEventWatcher.cs
- SqlAliasesReferenced.cs
- SchemaEntity.cs
- ImagingCache.cs
- ThumbAutomationPeer.cs
- Util.cs
- InvokeDelegate.cs
- DataSetUtil.cs
- StylusDownEventArgs.cs
- BasicViewGenerator.cs
- ToolStripRenderEventArgs.cs
- GridViewSelectEventArgs.cs
- MailSettingsSection.cs
- FileLevelControlBuilderAttribute.cs
- PersonalizablePropertyEntry.cs
- XmlTextWriter.cs
- PrivilegeNotHeldException.cs
- ElementsClipboardData.cs
- CngAlgorithm.cs
- Point.cs
- Item.cs
- UICuesEvent.cs
- XmlArrayItemAttribute.cs
- SerializationUtilities.cs
- GridViewPageEventArgs.cs
- NamespaceMapping.cs
- SQLByte.cs
- CodeComment.cs
- AudioFormatConverter.cs
- TextLineResult.cs
- EventSinkHelperWriter.cs
- PKCS1MaskGenerationMethod.cs
- ProfileSettingsCollection.cs
- BaseDataListComponentEditor.cs
- WizardStepCollectionEditor.cs
- ReachIDocumentPaginatorSerializer.cs
- RTLAwareMessageBox.cs
- XmlQueryRuntime.cs
- DataSet.cs
- PeerTransportSecuritySettings.cs
- XmlUTF8TextReader.cs
- ClientSession.cs
- FontFamily.cs
- Pair.cs
- SerTrace.cs
- SequenceQuery.cs
- Validator.cs
- EventLogQuery.cs
- Pipe.cs
- InputScopeAttribute.cs
- CookieProtection.cs
- WebColorConverter.cs