UIControllerRun Method

Runs the UIController.


Namespace: Firefly.Box
Assembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
public void Run()


The run method is synchronous and will hold this thread until the user exists the UIController. Similar, thought not same as ShowDialog When the task is executed the following events take place:
  • The Load event is executed
  • The Start event is executed
  • The rows are loaded from the database
  • For each row the user navigates to, the EnterRow event is executed
  • When the user leaves a row, the following events are executed
    • In any case the LeaveRow event is executed
    • If the row was changed, the SavingRow event is executed and the changes are saved to the database. For an in depth explanation of leave row and it's subtleties, see SavingRow event
  • The End event is executed, when the user exits the UIController and after the row he parked on was left

Other events that happen are the Activated event and Deactivated event. Those events are triggered when the UIController receives focus, or loses focus.


UIController event flow
This example is based on test data. The code for the entities included in this test data can be found in the documentation of Entity
This example uses automatic tools to generate parts of the user interface. Those tools can be found in the example of the documentation of Form
using Firefly.Box;
using System.Windows.Forms;

namespace TestFirefly.Box.Documentation
    public class UIControllerEventFlow
        public void NormalEventFlow()
            var jobs = new Pubs.Jobs();

            var uic = new UIController
                From = jobs,
                View = UITools.GenerateFormWithGridFor("UIController events",
                                                       "notice that the SavingRow MessageBox only happens for rows that were changed" +
                                                       "\nAlso pay attention to the fact that the \"After The Run\" message " +
                                                       "will come only after the task ends",
            uic.Load += () => MessageBox.Show("Load");
            uic.Start += () => MessageBox.Show("Start");
            uic.EnterRow += () => MessageBox.Show("EnterRow");
            uic.LeaveRow += () => MessageBox.Show("LeaveRow");
            uic.SavingRow += (b) => MessageBox.Show("SavingRow");

            uic.End += () => MessageBox.Show("End");

            MessageBox.Show("Before The Run");
            MessageBox.Show("After The Run");

See Also