UIControllerSavingRow Event
Occurs whenever the user leaves a row, and that row is about to be saved to the Database.
Namespace: Firefly.BoxAssembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
public event SavingRowEventHandler SavingRow
Public Event SavingRow As SavingRowEventHandler
member SavingRow : IEvent<SavingRowEventHandler,
EventArgs>
Value
SavingRowEventHandler When the user leaves a row, and that row needs to be saved the
UIController will perform the following steps:
- InputValidation for all the controls on the form according to the tab order, starting from the currently focused control.
- The row is saved to the database.
- Notice that The LeaveRow event is being raised as well, just before the SavingRow event occures.
The will happen, when the user leaves a row, in one of the following scenarios:
- The RowChanged property is true. For more information on the causes, see RowChanged property
- The ForceSaveRow property is set to true.
- The SelectCommand was raised and the AllowSelect property is set to true
- The row was deleted using one of the following methods:
Notice that in this scenario, if the row was changed, the will happen twice, once for the row change, and once for the deletion of the row.
If none of these scenarios occurred the changes to the row
will not be saved to the database.
Also if the row is a new row, and none of the mentioned scenarios occurred, the row
will not be inserted to the database.
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
EntityThis example uses automatic tools to generate parts of the user interface. Those tools can be found in the example of the documentation of
Formusing Firefly.Box;
using System.Windows.Forms;
namespace TestFirefly.Box.Documentation
{
public class UIControllerEventFlow
{
public void NormalEventFlow()
{
var jobs = new Pubs.Jobs();
jobs.InitializeWithTestData();
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",
jobs.Id,
jobs.Description)
};
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");
uic.Run();
MessageBox.Show("After The Run");
}
}
}
Reference
DeleteRowAfterLeavingIt