예제 #1
0
        private void TestArgsDelegate(object sender, RoutedEventArgs e)
        {
            Assert.AreEqual(argsPassedToRaiseEvent, e);
            Assert.AreEqual(eventPassedToRaiseEvent, e.RoutedEvent);
            Assert.AreEqual(sourcePassedToRaiseEvent, e.Source);
            Assert.Throws<InvalidOperationException>(() => e.Source = null);
            Assert.Throws<InvalidOperationException>(() => e.RoutedEvent = null);
            Assert.AreEqual(false, e.Handled);

            enteredInTestArgsDelegate = true;
        }
예제 #2
0
파일: ModalElement.cs 프로젝트: cg123/xenko
        protected override void OnTouchUp(TouchEventArgs args)
        {
            base.OnTouchUp(args);

            if(!IsModal || args.Source != this)
                return;

            var position = args.WorldPosition - new Vector3(WorldMatrixInternal.M41, WorldMatrixInternal.M42, WorldMatrixInternal.M43);
            if (position.X < 0 || position.X > RenderSize.X
                || position.Y < 0 || position.Y > RenderSize.Y)
            {
                var eventArgs = new RoutedEventArgs(OutsideClickEvent);
                RaiseEvent(eventArgs);
            }
        }
예제 #3
0
 public abstract void Invoke(object sender, RoutedEventArgs args);
예제 #4
0
        public void TestRaiseEvent()
        {
            // Test ArgumentNullException
            Assert.Throws<ArgumentNullException>(() => RaiseEvent(null));

            AddHandler(eventPassedToRaiseEvent, TestArgsDelegate);

            // test that if RoutedEvent of argument is null nothing special happens
            RaiseEvent(new RoutedEventArgs());

            // test the values of the arguments in the delegate
            sourcePassedToRaiseEvent = this;
            argsPassedToRaiseEvent = new RoutedEventArgs(eventPassedToRaiseEvent);
            RaiseEvent(argsPassedToRaiseEvent);
            sourcePassedToRaiseEvent = new UIElementLayeringTests();
            argsPassedToRaiseEvent = new RoutedEventArgs(eventPassedToRaiseEvent, sourcePassedToRaiseEvent);
            RaiseEvent(argsPassedToRaiseEvent);

            // check that the delegate has been called
            Assert.AreEqual(true, enteredInTestArgsDelegate);

            // check that value of the event raised can be modified again after being raised
            Assert.DoesNotThrow(() => argsPassedToRaiseEvent.RoutedEvent = null);
            Assert.DoesNotThrow(() => argsPassedToRaiseEvent.Source = null);

            // test InvalidOperationException
            var eventMyTest = EventManager.RegisterRoutedEvent<MyTestRoutedEventArgs>("myEventTestRaise", RoutingStrategy.Direct, typeof(UIElementLayeringTests));
            Assert.Throws<InvalidOperationException>(() => RaiseEvent(new RoutedEventArgs(eventMyTest)));
        }
예제 #5
0
        private static void ValueChangedClassHandler(object sender, RoutedEventArgs args)
        {
            var slider = (Slider)sender;

            slider.OnValueChanged(args);
        }
예제 #6
0
파일: ButtonBase.cs 프로젝트: cg123/xenko
        private static void ClickClassHandler(object sender, RoutedEventArgs args)
        {
            var buttonBase = (ButtonBase)sender;

            buttonBase.OnClick(args);
        }
예제 #7
0
        /// <summary>
        /// The class handler of the event <see cref="TextChanged"/>.
        /// This method can be overridden in inherited classes to perform actions common to all instances of a class.
        /// </summary>
        /// <param name="args">The arguments of the event</param>
        protected virtual void OnTextChanged(RoutedEventArgs args)
        {

        }
예제 #8
0
파일: UIScript.cs 프로젝트: cg123/xenko
        // Function in charge of toggling on/off the lights shadow maps
        private static void ToggleShadowMap(Object sender, RoutedEventArgs args)
        {
            var button = (Button)sender;
            var light = button.DependencyProperties.Get(LightKey);

            var directLight = light != null ? light.Type as IDirectLight : null;
            if (directLight == null)
                return;

            // toggle the shadow and update button text
            directLight.Shadow.Enabled = !directLight.Shadow.Enabled;
            ((TextBlock)button.Content).Text = GetButtonTextOnOffShadow(light);
        }
예제 #9
0
 private void TestClassHandlerEventHandled(Object sender, RoutedEventArgs e)
 {
     testClassHandlerEventHandledTooCalled = true;
 }
예제 #10
0
 private void TestClassHandlerHandled(Object sender, RoutedEventArgs e)
 {
     classHandlerSenderList.Add(sender);
     e.Handled = true;
 }
예제 #11
0
 private void TestAddSenderToClassHandlerList(Object sender, RoutedEventArgs e)
 {
     classHandlerSenderList.Add(sender);
 }
예제 #12
0
 private void TestHandledHandler(Object sender, RoutedEventArgs e)
 {
     senderList.Add(sender);
     e.Handled = true;
 }
예제 #13
0
 private void TestAddSenderToList(Object sender, RoutedEventArgs e)
 {
     senderList.Add(sender);
 }
예제 #14
0
 private void ModalButton2OnClick(object sender, RoutedEventArgs routedEventArgs)
 {
     uniformGrid.Children.Remove(modal2);
 }
예제 #15
0
 private void Modal2OnOutsideClick(object sender, RoutedEventArgs routedEventArgs)
 {
     modalButton2Text.Text = "Click on the Button, please";
 }
예제 #16
0
 private void Edit2OnTextChanged(object sender, RoutedEventArgs routedEventArgs)
 {
     Logger.Info("The text of the edit2 box changed: text={0}", edit2.Text);
 }
예제 #17
0
파일: UIScript.cs 프로젝트: cg123/xenko
        // Function in charge of toggling on/off the light themselves
        private void ToggleLight(Object sender, RoutedEventArgs args)
        {
            var button = (Button)sender;
            var light = button.DependencyProperties.Get(LightKey);
            if (light == null)
                return;

            // toggle light and update button text
            light.Enabled = !light.Enabled;
            ((TextBlock)button.Content).Text = GetButtonTextOnOffLight(light);

            var buttonShadow = button.DependencyProperties.Get(ShadowButtonKey);
            if (buttonShadow == null)
                return;

            // disable shadow child button
            buttonShadow.Opacity = light.Enabled ? 1.0f : 0.3f;
            buttonShadow.CanBeHitByUser = light.Enabled;
        }
예제 #18
0
        private void TestUnregisterHandlerOnClick(object sender, RoutedEventArgs routedEventArgs)
        {
            ++testUnregisterHandlerCallCount;

            ((Button)sender).Click -= TestUnregisterHandlerOnClick;

            if(testUnregisterHandlerCallCount < 10) // avoid infinite looping on test fail
                ((Button)sender).RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
        }
예제 #19
0
        private static void TextChangedClassHandler(object sender, RoutedEventArgs e)
        {
            var editText = (EditText)sender;

            editText.OnTextChanged(e);
        }
예제 #20
0
 private void TestDelegate2(Object sender, RoutedEventArgs args)
 {
 }
예제 #21
0
        protected override void OnClick(RoutedEventArgs args)
        {
            base.OnClick(args);

            GoToNextState();
        }
예제 #22
0
 private void TestHandlerRaiseOrderOnClick4(object sender, RoutedEventArgs routedEventArgs)
 {
     Assert.AreEqual(3, lastHandlerCalledId);
     lastHandlerCalledId = 4;
 }
예제 #23
0
파일: ButtonBase.cs 프로젝트: cg123/xenko
        /// <summary>
        /// The class handler of the event <see cref="Click"/>.
        /// This method can be overridden in inherited classes to perform actions common to all instances of a class.
        /// </summary>
        /// <param name="args">The arguments of the event</param>
        protected virtual void OnClick(RoutedEventArgs args)
        {

        }
예제 #24
0
        private void TestReccursiveRaiseOnClick(object sender, RoutedEventArgs routedEventArgs)
        {
            ++clickCount;

            if (clickCount < 10)
                ((Button)sender).RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
        }
예제 #25
0
 private void TestRoutedEventHandler(Object sender, RoutedEventArgs e)
 {
 }
예제 #26
0
        /// <summary>
        /// The class handler of the event <see cref="ValueChanged"/>.
        /// This method can be overridden in inherited classes to perform actions common to all instances of a class.
        /// </summary>
        /// <param name="args">The arguments of the event</param>
        protected virtual void OnValueChanged(RoutedEventArgs args)
        {

        }