[This is preliminary documentation and is subject to change.]

Instructs the UIController to exit.

Namespace:  Firefly.Box
Assembly:  Firefly.Box (in Firefly.Box.dll) Version: 3.4.23.6473 (3.4.23.6473)

Syntax

C#
public void Exit()
Visual Basic (Declaration)
Public Sub Exit
Visual C++
public:
void Exit()

Remarks

Behaves as if BeforeRow timing was specified for the first parameter

Examples

This example demonstrates the usage of Exit
This example is in the form of Unit Tests. It references the NUnit framework. This framework can be downloaded from www.NUnit.org. For more information about unit testing visit: www.NUnit.org.
CopyC#
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Firefly.Box;
using Firefly.Box.Testing;

namespace TestFirefly.Box.Documentation
{
    [TestFixture]
    public class Exit
    {
        [Test]
        public void UsingExitWithoutParameters()
        {
            var bp = new BusinessProcess();
            int cycles = 0;
            bp.LeaveRow += () =>
                             {
                                 cycles++;
                                 if (cycles > 5)
                                     bp.Exit();
                             };
            bp.Run();
            cycles.ShouldBe(6);
        }
        [Test]
        public void UsingExitBeforeTheTaskRuns()
        {
            var bp = new BusinessProcess();
            bool startEventHappened = false;
            bool enterRowEventHappened = false;
            bp.Start += () => startEventHappened = true;
            bp.EnterRow += () => enterRowEventHappened = true;
            bp.Exit();
            bp.Run();
            startEventHappened.ShouldBe(true);//The start event happens regardless of the exit command, 
            //as the exit command is evaluated at the row level.
            enterRowEventHappened.ShouldBe(false);//The enter row event didn't happen, because the task was instructed to exit.
        }
        [Test]
        public void UsingExitWithBeforeEnterRowTiming()
        {
            var bp = new BusinessProcess();
            bool startEventHappened = false;
            bool enterRowEventHappened = false;
            bp.Start += () => startEventHappened = true;
            bp.EnterRow += () => enterRowEventHappened = true;
            bp.Exit(ExitTiming.BeforeRow); //The default value, acts the same as without any parameters
            bp.Run();
            startEventHappened.ShouldBe(true);//The start event happens regardless of the exit command, 
            //as the exit command is evaluated at the row level.
            enterRowEventHappened.ShouldBe(false);//The enter row event didn't happen, because the task was instructed to exit.
        }
        [Test]
        public void UsingExitWithAflterLeaveRowTiming()
        {
            var bp = new BusinessProcess();
            bool leaveRowHappened = false;
            bp.LeaveRow += () => leaveRowHappened = true;
            bp.Exit(ExitTiming.AfterRow);
            bp.Run();
            leaveRowHappened.ShouldBe(true);
        }
        [Test]
        public void UsingExitWithAflterLeaveRowTimingAndACondition()
        {
            var bp = new BusinessProcess();
            int cycles = 0;
            bp.LeaveRow += () =>
                {
                    cycles++;
                };
            bp.Exit(ExitTiming.AfterRow, () => cycles > 5);
            bp.Run();
            cycles.ShouldBe(6);
        }
    }
}

See Also