UIControllerDeleting Event

Occurs when the user tries to delete a row.

Definition

Namespace: Firefly.Box
Assembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
C#
public event CancelEventHandler Deleting

Value

CancelEventHandler

Remarks

An CancelEventArgs is provided. If the Cancel is set to true, the row will not be deleted.

Example

using the deleting event
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
C#
using System.Windows.Forms;
using Firefly.Box;

namespace TestFirefly.Box.Documentation
{
    class DeletingDemo
    {
        public void Run()
        {
            var jobs = new Pubs.Jobs();
            jobs.InitializeWithTestData();

            var uic = new UIController()
            {
                From = jobs,
                View = UITools.GenerateFormWithGridFor("Deleting demo",
                                                       "Click on the \"Delete\" button",
                                                       jobs.Id,
                                                       jobs.Description,
                                                       jobs.MinLevel,
                                                       jobs.MaxLevel)
            };

            var deleteButton = new Button
                                   {
                                       Text = "Delete"
                                   };
            deleteButton.Click += (a, b) => uic.Raise(Command.DeleteRow);

            UITools.AddControlsToForm(uic.View,deleteButton);

            uic.Deleting += (e) =>
                                {
                                    if (MessageBox.Show("Are you sure you want to delete this row?",
                                        "Confirm Delete",
                                        MessageBoxButtons.YesNo)!= DialogResult.Yes)
                                        e.Cancel = true;
                                };



            uic.Run();
        }
    }
}

See Also