public override object GetValue(object component)
            {
                WorkflowDataContext dataContext = (WorkflowDataContext)component;

                ActivityContext activityContext = dataContext.ResolutionContext;

                try
                {
                    return(this.reference.GetLocation(activityContext).Value);
                }
                finally
                {
                    activityContext.Dispose();
                }
            }
            public override void SetValue(object component, object value)
            {
                if (IsReadOnly)
                {
                    throw FxTrace.Exception.AsError(new NotSupportedException(SR.PropertyReadOnlyInWorkflowDataContext(this.Name)));
                }

                WorkflowDataContext dataContext = (WorkflowDataContext)component;

                ActivityContext activityContext = dataContext.ResolutionContext;

                try
                {
                    Location location = this.reference.GetLocation(activityContext);
                    location.Value = value;
                }
                finally
                {
                    activityContext.Dispose();
                }
            }
Exemple #3
0
        private void AddNotifyHandler(PropertyDescriptorImpl property)
        {
            ActivityContext activityContext = this.ResolutionContext;

            try
            {
                Location location = property.LocationReference.GetLocation(activityContext);
                if (location is INotifyPropertyChanged notify)
                {
                    notify.PropertyChanged += PropertyChangedEventHandler;

                    if (this.locationMapping == null)
                    {
                        this.locationMapping = new Dictionary <Location, PropertyDescriptorImpl>();
                    }
                    this.locationMapping.Add(location, property);
                }
            }
            finally
            {
                activityContext.Dispose();
            }
        }