コード例 #1
0
        // Token: 0x06005F4A RID: 24394 RVA: 0x001AB80C File Offset: 0x001A9A0C
        private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RangeBase rangeBase = (RangeBase)d;
            RangeBaseAutomationPeer rangeBaseAutomationPeer = UIElementAutomationPeer.FromElement(rangeBase) as RangeBaseAutomationPeer;

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

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

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

            ctrl.CoerceValue(ValueProperty);
            ctrl.OnMaximumChanged((double)e.OldValue, (double)e.NewValue);
        }
コード例 #3
0
        public void RangeValueProvider_Methods()
        {
            RangeBaseConcrete   s    = new RangeBaseConcrete();
            IRangeValueProvider rbap = new RangeBaseAutomationPeer(s);

            Assert.AreEqual(s.LargeChange, rbap.LargeChange, "LargeChange #0");
            s.LargeChange = 5;
            Assert.AreEqual(s.LargeChange, rbap.LargeChange, "LargeChange #1");

            Assert.AreEqual(s.Maximum, rbap.Maximum, "Maximum #0");
            s.Maximum = 100;
            Assert.AreEqual(s.Maximum, rbap.Maximum, "Maximum #1");

            Assert.AreEqual(s.Minimum, rbap.Minimum, "Minimum #0");
            s.Minimum = 0.1;
            Assert.AreEqual(s.Minimum, rbap.Minimum, "Minimum #1");

            Assert.AreEqual(s.SmallChange, rbap.SmallChange, "SmallChange #0");
            s.SmallChange = 3;
            Assert.AreEqual(s.SmallChange, rbap.SmallChange, "SmallChange #1");

            Assert.AreEqual(s.Value, rbap.Value, "Value #0");
            s.Value = 50;
            Assert.AreEqual(s.Value, rbap.Value, "Value #1");

            rbap.SetValue(0.5);
            Assert.AreEqual(0.5, s.Value, "RangeBaseConcrete.Value");
            Assert.AreEqual(0.5, rbap.Value, "IRangeValueProvider.Value");

            s.LargeChange = 0.9;
            Assert.AreEqual(0.9, rbap.LargeChange, "LargeChange #3");
            s.Maximum = 0.9;
            Assert.AreEqual(0.9, rbap.Maximum, "Maximum #3");
            s.Minimum = 0.1;
            Assert.AreEqual(0.1, rbap.Minimum, "Minimum #3");
            s.SmallChange = 0.1;
            Assert.AreEqual(0.1, rbap.SmallChange, "SmallChange #3");

            s.IsEnabled = true;
            Assert.IsFalse(rbap.IsReadOnly, "IsReadOnly #0");
            s.IsEnabled = false;
            Assert.IsTrue(rbap.IsReadOnly, "IsReadOnly #1");

            Assert.Throws <ElementNotEnabledException> (delegate {
                rbap.SetValue(.8);
            });
            s.IsEnabled = true;
            rbap.SetValue(.5);
        }