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
- ProxyGenerator.cs
- CompoundFileDeflateTransform.cs
- ProcessProtocolHandler.cs
- DispatcherEventArgs.cs
- DataGridColumnCollection.cs
- XmlAnyElementAttributes.cs
- NotifyInputEventArgs.cs
- RuleSetDialog.cs
- SelectedGridItemChangedEvent.cs
- QueryCorrelationInitializer.cs
- TabPage.cs
- ComPersistableTypeElementCollection.cs
- UIPropertyMetadata.cs
- DataSourceExpressionCollection.cs
- Thread.cs
- BackgroundFormatInfo.cs
- Line.cs
- CompositeDuplexElement.cs
- ParserStreamGeometryContext.cs
- Cloud.cs
- QilInvokeEarlyBound.cs
- SystemIcons.cs
- StringKeyFrameCollection.cs
- UnauthorizedAccessException.cs
- BoolExpressionVisitors.cs
- ByteRangeDownloader.cs
- WindowsContainer.cs
- SerializationFieldInfo.cs
- TraceFilter.cs
- SqlConnectionStringBuilder.cs
- FacetValueContainer.cs
- MediaTimeline.cs
- FileLogRecordStream.cs
- DocumentGrid.cs
- GridViewRowEventArgs.cs
- validation.cs
- StorageFunctionMapping.cs
- TTSEngineProxy.cs
- Int32Rect.cs
- RenderDataDrawingContext.cs
- TextParagraphCache.cs
- NamespaceQuery.cs
- CalendarDesigner.cs
- FaultHandlingFilter.cs
- Speller.cs
- WebPermission.cs
- EndpointAddressProcessor.cs
- ByteAnimationUsingKeyFrames.cs
- ToolStripItemClickedEventArgs.cs
- TemplateKeyConverter.cs
- CFGGrammar.cs
- AsyncInvokeOperation.cs
- SqlBooleanMismatchVisitor.cs
- XPathAncestorIterator.cs
- Rect3DValueSerializer.cs
- Blend.cs
- ProcessHost.cs
- XPathAncestorQuery.cs
- RecordsAffectedEventArgs.cs
- WpfXamlLoader.cs
- HttpGetProtocolImporter.cs
- SQLInt16Storage.cs
- UnauthorizedWebPart.cs
- EncryptedKeyIdentifierClause.cs
- PasswordPropertyTextAttribute.cs
- handlecollector.cs
- XmlSerializableReader.cs
- RotateTransform.cs
- PrincipalPermission.cs
- CommandTreeTypeHelper.cs
- MenuItem.cs
- XsltOutput.cs
- DataGridBoundColumn.cs
- ImageClickEventArgs.cs
- PolicyException.cs
- LayoutTable.cs
- Int64Animation.cs
- _NtlmClient.cs
- BitmapSource.cs
- BinaryObjectWriter.cs
- DbCommandTree.cs
- SqlClientFactory.cs
- StorageEntityContainerMapping.cs
- AggregatePushdown.cs
- PeerToPeerException.cs
- TransactionState.cs
- ObjectTag.cs
- WebPartAuthorizationEventArgs.cs
- PagedDataSource.cs
- SkewTransform.cs
- ComplexObject.cs
- SqlEnums.cs
- ManagedFilter.cs
- ErrorTableItemStyle.cs
- XslAstAnalyzer.cs
- CompositeFontFamily.cs
- CachedFontFamily.cs
- TextServicesDisplayAttributePropertyRanges.cs
- DefaultTextStore.cs
- WmpBitmapDecoder.cs