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
- PtsCache.cs
- BoolLiteral.cs
- SerializableAttribute.cs
- SByteStorage.cs
- ApplicationFileParser.cs
- AssemblyNameProxy.cs
- WebPartUserCapability.cs
- DateTimeOffsetStorage.cs
- TextServicesHost.cs
- ListViewItem.cs
- DateRangeEvent.cs
- ProfessionalColorTable.cs
- BrowserTree.cs
- SocketException.cs
- WinFormsSecurity.cs
- PassportAuthenticationModule.cs
- XmlSortKey.cs
- Switch.cs
- ProtocolsSection.cs
- CompiledQuery.cs
- StoreAnnotationsMap.cs
- ExpressionBindings.cs
- StrokeNode.cs
- StatusBar.cs
- NotifyParentPropertyAttribute.cs
- WindowsTitleBar.cs
- CollectionEditVerbManager.cs
- EventLogHandle.cs
- PrintPageEvent.cs
- FixedSOMLineCollection.cs
- DataGridViewCellValueEventArgs.cs
- ConditionCollection.cs
- keycontainerpermission.cs
- StrokeIntersection.cs
- FixUpCollection.cs
- InfoCardClaimCollection.cs
- TreeNode.cs
- SocketElement.cs
- IsolatedStorageException.cs
- CapabilitiesSection.cs
- Journal.cs
- EventItfInfo.cs
- ParameterDataSourceExpression.cs
- KeyProperty.cs
- DataRowExtensions.cs
- nulltextnavigator.cs
- BulletedListEventArgs.cs
- DataGridRow.cs
- LiteralControl.cs
- DiscreteKeyFrames.cs
- StickyNoteAnnotations.cs
- PageRequestManager.cs
- XPathNodePointer.cs
- X509ChainElement.cs
- FrameworkElementFactory.cs
- TypedDataSourceCodeGenerator.cs
- Rfc2898DeriveBytes.cs
- SqlClientPermission.cs
- RelatedEnd.cs
- AncestorChangedEventArgs.cs
- HtmlHistory.cs
- BoundField.cs
- ObjRef.cs
- OutgoingWebRequestContext.cs
- CustomLineCap.cs
- SqlBulkCopyColumnMappingCollection.cs
- AnnotationService.cs
- OraclePermission.cs
- KeyedQueue.cs
- DataGridViewControlCollection.cs
- SqlFactory.cs
- XsdBuildProvider.cs
- MessageSecurityVersionConverter.cs
- TextDocumentView.cs
- XmlRawWriter.cs
- COM2ExtendedBrowsingHandler.cs
- GeneralTransform3DTo2D.cs
- X509RecipientCertificateClientElement.cs
- ButtonBase.cs
- CookieProtection.cs
- HtmlWindowCollection.cs
- FontNamesConverter.cs
- ZipIOCentralDirectoryFileHeader.cs
- PagesChangedEventArgs.cs
- WindowsRebar.cs
- ControlDesigner.cs
- PolicyDesigner.cs
- PolicyChain.cs
- QueryAccessibilityHelpEvent.cs
- Int16KeyFrameCollection.cs
- SchemaInfo.cs
- EntityDataSourceState.cs
- ParallelTimeline.cs
- DbProviderConfigurationHandler.cs
- DrawingDrawingContext.cs
- CheckBoxField.cs
- Msec.cs
- ScriptModule.cs
- KeyValuePairs.cs
- ResponseBodyWriter.cs