Trigger Invoke Method Delta Engine Documentation

Namespace: DeltaEngine.Commands
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void Invoke()
Remarks

Tests: DeltaEngine.Input.Tests.TouchPositionTriggerTests
Remarks

Tests: DeltaEngine.Input.Tests.TouchDoubleTapTriggerTests
Remarks

Tests: DeltaEngine.Input.Tests.TouchTapTriggerTests
Examples

1 unit tests call DeltaEngine.Commands.Trigger.Invoke
[Test]
public void InvokeTouch()
{
    var touch = Resolve<Touch>() as MockTouch;
    if (touch == null)
        return; //ncrunch: no coverage 
    var trigger = new TouchPositionTrigger(State.Pressed);
    bool wasInvoked = false;
    new Command(() => wasInvoked = true).Add(trigger);
    touch.SetTouchState(0, State.Pressed, Vector2D.Half);
    AdvanceTimeAndUpdateEntities();
    Assert.IsTrue(wasInvoked);
}
Examples

1 unit tests call DeltaEngine.Commands.Trigger.Invoke
[Test]
public void InvokeDoubleTap()
{
    var touch = Resolve<Touch>() as MockTouch;
    if (touch == null)
        return; //ncrunch: no coverage 
    var trigger = new TouchDoubleTapTrigger();
    bool wasInvoked = false;
    new Command(() => wasInvoked = true).Add(trigger);
    touch.SetTouchState(0, State.Pressing, Vector2D.Half);
    AdvanceTimeAndUpdateEntities();
    touch.SetTouchState(0, State.Releasing, Vector2D.Half);
    AdvanceTimeAndUpdateEntities();
    touch.SetTouchState(0, State.Pressing, Vector2D.Half);
    AdvanceTimeAndUpdateEntities();
    touch.SetTouchState(0, State.Releasing, Vector2D.Half);
    AdvanceTimeAndUpdateEntities();
    Assert.IsTrue(wasInvoked);
}
Examples

1 unit tests call DeltaEngine.Commands.Trigger.Invoke
[Test]
public void InvokeTouch()
{
    var touch = Resolve<Touch>() as MockTouch;
    if (touch == null)
        return; //ncrunch: no coverage 
    var trigger = new TouchTapTrigger();
    bool wasInvoked = false;
    new Command(() => wasInvoked = true).Add(trigger);
    touch.SetTouchState(0, State.Pressing, Vector2D.Half);
    AdvanceTimeAndUpdateEntities();
    touch.SetTouchState(0, State.Releasing, Vector2D.Half);
    AdvanceTimeAndUpdateEntities();
    Assert.IsTrue(wasInvoked);
}
See Also