コード例 #1
0
        CommandBase GetCurrentValue(ObservableObject observableObject)
        {
            try
            {
                var value = propertyAccessor.Getter(observableObject);

                isValueValid = true;
                return(value);
            }
            catch (Exception e)
            {
                if (isValueValid)
                {
                    EventSource.Log.UnableSubsequentlyToReadProperty(propertyAccessor.ObjectTypeName, propertyAccessor.Name, e.ToString());
                }

                isValueValid = false;
                return(default);
コード例 #2
0
        internal ParameterizedCommandValueBag(
            [NotNull] ObservableObject observableObject,
            [NotNull] ParameterizedCommandPropertyAccessor propertyAccessor)
        {
            this.propertyAccessor = propertyAccessor;

            try
            {
                currentValue = propertyAccessor.Getter(observableObject);
                isValueValid = true;
            }
            catch (Exception e)
            {
                EventSource.Log.UnableInitiallyToReadProperty(propertyAccessor.ObjectTypeName, propertyAccessor.Name, e.ToString());
            }

            if (currentValue != null)
            {
                currentIsExecuting = currentValue.RunningExecution != null;
                isIsExecutingValid = true;
            }
        }
コード例 #3
0
        public override void UpdateNewValue(ObservableObject observableObject)
        {
            try
            {
                newValue     = propertyAccessor.Getter(observableObject);
                isValueValid = true;
            }
            catch (Exception e)
            {
                if (isValueValid)
                {
                    EventSource.Log.UnableSubsequentlyToReadProperty(propertyAccessor.ObjectTypeName, propertyAccessor.Name, e.ToString());
                }

                isValueValid = false;
            }

            if (isValueValid && newValue != null)
            {
                newIsExecuting = newValue.RunningExecution != null;

                isIsExecutingValid = true;
            }
        }