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
- TextReader.cs
- DiagnosticsConfiguration.cs
- AppDomainResourcePerfCounters.cs
- TextPattern.cs
- Tokenizer.cs
- Memoizer.cs
- ZeroOpNode.cs
- AttributeUsageAttribute.cs
- FixedDocumentPaginator.cs
- SecurityElement.cs
- ProvidePropertyAttribute.cs
- XLinq.cs
- DiscoveryMessageSequence.cs
- CodeTypeDeclarationCollection.cs
- Utils.cs
- TextRangeSerialization.cs
- XPathDocumentNavigator.cs
- EntityClassGenerator.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- DataServiceHostWrapper.cs
- BuilderPropertyEntry.cs
- QilUnary.cs
- TimeSpanSecondsConverter.cs
- ManagementQuery.cs
- LoadGrammarCompletedEventArgs.cs
- InternalConfigRoot.cs
- JapaneseCalendar.cs
- NativeRecognizer.cs
- ConfigurationElementCollection.cs
- UrlAuthFailedErrorFormatter.cs
- OuterGlowBitmapEffect.cs
- ActivityDefaults.cs
- HandleRef.cs
- Library.cs
- ResourceReferenceKeyNotFoundException.cs
- DesigntimeLicenseContextSerializer.cs
- TrustManagerMoreInformation.cs
- MappedMetaModel.cs
- Matrix.cs
- Application.cs
- ToolStripSettings.cs
- DesignerImageAdapter.cs
- XpsS0ValidatingLoader.cs
- QueryableFilterRepeater.cs
- ApplicationServiceManager.cs
- Exceptions.cs
- FilterableAttribute.cs
- XmlAttributes.cs
- ModulesEntry.cs
- NamespaceInfo.cs
- SqlStream.cs
- safelinkcollection.cs
- DataGridRow.cs
- StylusSystemGestureEventArgs.cs
- ReferenceConverter.cs
- HandlerFactoryCache.cs
- FileDetails.cs
- PagedDataSource.cs
- StreamReader.cs
- TypeDependencyAttribute.cs
- DeleteHelper.cs
- CodeSubDirectory.cs
- ColumnHeader.cs
- XmlReader.cs
- WorkflowPageSetupDialog.cs
- ReachVisualSerializer.cs
- ObjectSet.cs
- Rect3D.cs
- BuildProvider.cs
- ProcessInfo.cs
- XmlDataSource.cs
- ConnectionManagementElement.cs
- FontStyleConverter.cs
- TemplateInstanceAttribute.cs
- HasCopySemanticsAttribute.cs
- MetadataItemCollectionFactory.cs
- IndexedEnumerable.cs
- WebServiceAttribute.cs
- SkipStoryboardToFill.cs
- StringTraceRecord.cs
- XmlDataLoader.cs
- IgnoreSection.cs
- BitmapCodecInfo.cs
- xmlsaver.cs
- RichTextBoxConstants.cs
- InstanceContextMode.cs
- ExpressionNode.cs
- HttpListenerResponse.cs
- SqlDataReaderSmi.cs
- PluralizationService.cs
- ResourceReferenceExpression.cs
- RestHandlerFactory.cs
- OleDbSchemaGuid.cs
- Mouse.cs
- SurrogateSelector.cs
- FontFamily.cs
- ToolStripOverflow.cs
- LinearGradientBrush.cs
- PngBitmapDecoder.cs
- EntityDataSourceStatementEditorForm.cs