コード例 #1
0
        // Token: 0x06005F40 RID: 24384 RVA: 0x001AB66C File Offset: 0x001A986C
        private static void OnMinimumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RangeBase rangeBase = (RangeBase)d;
            RangeBaseAutomationPeer rangeBaseAutomationPeer = UIElementAutomationPeer.FromElement(rangeBase) as RangeBaseAutomationPeer;

            if (rangeBaseAutomationPeer != null)
            {
                rangeBaseAutomationPeer.RaiseMinimumPropertyChangedEvent((double)e.OldValue, (double)e.NewValue);
            }
            rangeBase.CoerceValue(RangeBase.MaximumProperty);
            rangeBase.CoerceValue(RangeBase.ValueProperty);
            rangeBase.OnMinimumChanged((double)e.OldValue, (double)e.NewValue);
        }
コード例 #2
0
        /// <summary>
        ///     Called when MinimumProperty is changed on "d."
        /// </summary>
        private static void OnMinimumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RangeBase ctrl = (RangeBase)d;

            RangeBaseAutomationPeer peer = UIElementAutomationPeer.FromElement(ctrl) as RangeBaseAutomationPeer;

            if (peer != null)
            {
                peer.RaiseMinimumPropertyChangedEvent((double)e.OldValue, (double)e.NewValue);
            }

            ctrl.CoerceValue(MaximumProperty);
            ctrl.CoerceValue(ValueProperty);
            ctrl.OnMinimumChanged((double)e.OldValue, (double)e.NewValue);
        }
コード例 #3
0
ファイル: RangeBase.cs プロジェクト: ynkbt/moon
        /// <summary>
        /// MinimumProperty property changed handler.
        /// </summary>
        /// <param name="d">RangeBase that changed its Minimum.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs.</param>
        ///
        private static void OnMinimumPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RangeBase range = d as RangeBase;

            Debug.Assert(range != null);

            // Ensure it's a valid value
            if (!IsValidDoubleValue(e.NewValue))
            {
                throw new ArgumentException();
            }

            // Note: this section is a workaround, containing my
            // logic to hold all calls to the property changed
            // methods until after all coercion has completed
            // ----------
            if (range._levelsFromRootCall == 0)
            {
                range._initialMax = range.Maximum;
                range._initialVal = range.Value;
            }
            range._levelsFromRootCall++;
            // ----------

            range.CoerceMaximum();
            range.CoerceValue();

            // Note: this section completes my workaround to call
            // the property changed logic if all coercion has completed
            // ----------
            range._levelsFromRootCall--;
            if (range._levelsFromRootCall == 0)
            {
                range.OnMinimumChanged((double)e.OldValue, (double)e.NewValue);
                // UIA event
                range.RaiseChangeEvent(Change.Minimum, (double)e.OldValue, (double)e.NewValue);
                double maximum = range.Maximum;
                if (range._initialMax != maximum)
                {
                    range.OnMaximumChanged(range._initialMax, maximum);
                    // UIA event
                    range.RaiseChangeEvent(Change.Maximum, range._initialMax, maximum);
                }
                double value = range.Value;
                if (range._initialVal != value)
                {
                    range.OnValueChanged(range._initialVal, value);
                }
            }
            // ----------
        }
コード例 #4
0
ファイル: RangeBase.cs プロジェクト: ynkbt/moon
        /// <summary>
        /// ValueProperty property changed handler.
        /// </summary>
        /// <param name="d">RangeBase that changed its Value.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs.</param>
        private static void OnValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RangeBase range = d as RangeBase;

            Debug.Assert(range != null);

            // Ensure it's a valid value
            if (!IsValidDoubleValue(e.NewValue))
            {
                throw new ArgumentException();
            }

            // Note: this section is a workaround, containing my
            // logic to hold all calls to the property changed
            // methods until after all coercion has completed
            // ----------
            if (range._levelsFromRootCall == 0)
            {
                range._requestedVal = (double)e.NewValue;
                range._initialVal   = (double)e.OldValue;
            }
            range._levelsFromRootCall++;
            // ----------

            range.CoerceValue();

            // Note: this section completes my workaround to call
            // the property changed logic if all coercion has completed
            // ----------
            range._levelsFromRootCall--;
            if (range._levelsFromRootCall == 0)
            {
                double value = range.Value;
                if (range._initialVal != value)
                {
                    range.OnValueChanged(range._initialVal, value);

                    // Raises UIA event
                    if (range.AutomationPeer != null)
                    {
                        range.AutomationPeer.RaisePropertyChangedEvent(RangeValuePatternIdentifiers.ValueProperty,
                                                                       e.OldValue,
                                                                       e.NewValue);
                    }
                }
            }
            // ----------
        }