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
- HostingEnvironmentException.cs
- Point3DCollectionValueSerializer.cs
- CompilerErrorCollection.cs
- DataService.cs
- SortKey.cs
- PassportIdentity.cs
- TypeBuilderInstantiation.cs
- glyphs.cs
- DataGridItemAutomationPeer.cs
- ScrollChrome.cs
- Operators.cs
- CursorConverter.cs
- EntityConnectionStringBuilderItem.cs
- HttpServerProtocol.cs
- AssertSection.cs
- CodePageEncoding.cs
- Options.cs
- GridViewColumnHeader.cs
- InstanceOwnerException.cs
- StatusBarItemAutomationPeer.cs
- DiffuseMaterial.cs
- _BufferOffsetSize.cs
- XmlAttributeProperties.cs
- WebPart.cs
- SafeEventLogWriteHandle.cs
- ExpressionPrinter.cs
- MasterPage.cs
- FromReply.cs
- followingquery.cs
- BuilderPropertyEntry.cs
- NameObjectCollectionBase.cs
- Padding.cs
- XmlWrappingReader.cs
- PersonalizationEntry.cs
- EncryptedData.cs
- DataRelation.cs
- DataGridTablesFactory.cs
- DrawingContext.cs
- Frame.cs
- ISFTagAndGuidCache.cs
- DefaultShape.cs
- Solver.cs
- PathTooLongException.cs
- ExecutionEngineException.cs
- ListDictionaryInternal.cs
- ExportOptions.cs
- StylusPointProperty.cs
- LogicalCallContext.cs
- ContentFilePart.cs
- ExecutionEngineException.cs
- ContainerCodeDomSerializer.cs
- EntityDataSourceQueryBuilder.cs
- DataColumn.cs
- COM2IDispatchConverter.cs
- HebrewCalendar.cs
- XmlCDATASection.cs
- ConnectorDragDropGlyph.cs
- EventDescriptorCollection.cs
- BrowserCapabilitiesFactory.cs
- UIElement.cs
- Logging.cs
- ServiceCredentialsSecurityTokenManager.cs
- Tokenizer.cs
- ExpressionSelection.cs
- SafeNativeMethods.cs
- followingquery.cs
- TextDecorationCollectionConverter.cs
- ImageSourceConverter.cs
- BitmapEffect.cs
- MimeParameterWriter.cs
- FontCacheUtil.cs
- ChildrenQuery.cs
- HostProtectionPermission.cs
- TitleStyle.cs
- DesignerValidatorAdapter.cs
- PageBreakRecord.cs
- HostingPreferredMapPath.cs
- IgnoreFileBuildProvider.cs
- CompilationLock.cs
- ReceiveSecurityHeaderElementManager.cs
- DuplicateDetector.cs
- SqlRetyper.cs
- GridViewCellAutomationPeer.cs
- XmlAttributeCache.cs
- TabItem.cs
- RemoteWebConfigurationHost.cs
- XPathConvert.cs
- SystemNetworkInterface.cs
- RNGCryptoServiceProvider.cs
- CaseDesigner.xaml.cs
- StructuralCache.cs
- ReflectionPermission.cs
- XmlSchemaAttributeGroupRef.cs
- fixedPageContentExtractor.cs
- MsmqAppDomainProtocolHandler.cs
- ReadOnlyHierarchicalDataSource.cs
- BaseUriHelper.cs
- IndependentlyAnimatedPropertyMetadata.cs
- DesignerAdapterAttribute.cs
- StylusPointProperty.cs