Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of <see cref="SearchTextParseResult"/> with the specified <see cref="FilterRule"/>.
        /// </summary>
        /// <param name="rule">The rule that resulted from parsing the search text.</param>
        /// <exception cref="ArgumentNullException">The specified value is a null reference.</exception>
        public SearchTextParseResult(FilterRule rule)
        {
            if (rule == null)
            {
                throw new ArgumentNullException("rule");
            }

            this.FilterRule = rule;
        }
        /// <summary>
        /// Initializes a new instance of the FilterExpressionOperandNode
        /// class.
        /// </summary>
        /// <param name="rule">
        /// The FilterRule to hold for evaluation.
        /// </param>
        public FilterExpressionOperandNode(FilterRule rule)
        {
            if (null == rule)
            {
                throw new ArgumentNullException("rule");
            }

            this.Rule = rule;
        }
Esempio n. 3
0
        /// <summary>
        /// Called when the SelectedValue within AvailableRules changes.
        /// </summary>
        /// <param name="oldValue">
        /// The old FilterRule.
        /// </param>
        /// <param name="newValue">
        /// The new FilterRule.
        /// </param>
        protected void OnSelectedValueChanged(FilterRule oldValue, FilterRule newValue)
        {
            FilterRuleCustomizationFactory.FactoryInstance.ClearValues(newValue);
            FilterRuleCustomizationFactory.FactoryInstance.TransferValues(oldValue, newValue);
            FilterRuleCustomizationFactory.FactoryInstance.ClearValues(oldValue);

            newValue.EvaluationResultInvalidated += new EventHandler(this.SelectedValue_EvaluationResultInvalidated);
            oldValue.EvaluationResultInvalidated -= new EventHandler(this.SelectedValue_EvaluationResultInvalidated);

            this.NotifyEvaluationResultInvalidated();
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the FilterRulePanelItem class.
        /// </summary>
        /// <param name="rule">
        /// The FilterRule to store in this FilterRulePanelItem.
        /// </param>
        /// <param name="groupId">
        /// A string which identifies which group this 
        /// item belongs to.
        /// </param>
        public FilterRulePanelItem(FilterRule rule, string groupId)
        {
            if (null == rule)
            {
                throw new ArgumentNullException("rule");
            }

            if (String.IsNullOrEmpty(groupId))
            {
                throw new ArgumentNullException("groupId");
            }

            this.Rule = rule;
            this.GroupId = groupId;
        }
Esempio n. 5
0
        /// <summary>
        /// Adds the specified rule, using the rule's display name as its group name.
        /// </summary>
        /// <param name="rule">The rule to add.</param>
        /// <exception cref="ArgumentNullException">The specified value is a null reference.</exception>
        public void AddRule(FilterRule rule)
        {
            if (rule == null)
            {
                throw new ArgumentNullException("rule");
            }

            this.AddFilterRulePicker.ShortcutFilterRules.Add(new AddFilterRulePickerItem(new FilterRulePanelItem(rule, rule.DisplayName)));
        }
Esempio n. 6
0
 /// <summary>
 /// Clears the values from the filter rule.
 /// </summary>
 /// <param name="rule">
 /// The rule to clear.
 /// </param>
 public abstract void ClearValues(FilterRule rule);
Esempio n. 7
0
 /// <summary>
 /// Transfers the values from the old rule into the new rule.
 /// </summary>
 /// <param name="oldRule">
 /// The old filter rule.
 /// </param>
 /// <param name="newRule">
 /// The new filter rule.
 /// </param>
 public abstract void TransferValues(FilterRule oldRule, FilterRule newRule);
        private bool TryTransferValuesAsSingleValueComparableValueFilterRule(FilterRule oldRule, FilterRule newRule)
        {
            Debug.Assert(oldRule != null && newRule != null, "oldrule and newrule are not null");

            bool areCorrectType = this.IsSingleValueComparableValueFilterRule(oldRule) && this.IsSingleValueComparableValueFilterRule(newRule);

            if (!areCorrectType)
            {
                return(false);
            }

            object value = this.GetValueFromValidatingValue(oldRule, "Value");

            this.SetValueOnValidatingValue(newRule, "Value", value);

            return(true);
        }