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

Occurs whenever the UIController is Activated.

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

Syntax

C#
public event Action Activated
Visual Basic (Declaration)
Public Event Activated As Action
Visual C++
public:
 event Action^ Activated {
	void add (Action^ value);
	void remove (Action^ value);
}

Remarks

When ever another UIController is called, then the current UIControllerDeactivated event is executed, and the called UIControllerActivated event is executed

Examples

Activated and Deactivated events
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
CopyC#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Firefly.Box;

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



            var uicJobs = new UIController()
            {
                From = jobs,
                View = UITools.GenerateFormWithGridFor(
                    "Activated and deactivated",
                    "As you have seen, the activated event was fired for the job's UIController.\n" +
                    "Now click on the \"Show Employees\" button, to call the Employees UIController.\n" +
                    "When you are done, exit this UIController, and you'll see the Deactivated event\n" +
                    "triggered",
                    jobs.Id,
                    jobs.Description,
                    jobs.MinLevel,
                    jobs.MaxLevel)
            };
            var showEmployees = new Button
            {
                Text = "Show Employees"
            };
            showEmployees.Click += (a, b) =>
            {
                var uicEmployees = new UIController
                {
                    From = employees,
                    View =
                        UITools.GenerateFormWithGridFor(
                        "Employees for job " + jobs.Description.Trim(),
                        "As you can see the jobs deactivated event was executed and the employees\n" +
                        "activated event was triggered. Now exit this screen and you'll see the it's\n" +
                        "deactivated event is triggered and the jobs activated event is triggered. ",
                        employees.Id,
                        employees.LastName,
                        employees.FirstName)
                };
                uicEmployees.Where.Add(employees.JobId.IsEqualTo(jobs.Id));
                uicEmployees.Activated += () => MessageBox.Show("Employees Activated");
                uicEmployees.Deactivated += () => MessageBox.Show("Employees Deactivated");
                uicEmployees.Run();
            };
            UITools.AddControlsToForm(uicJobs.View, showEmployees);

            uicJobs.Activated += () => MessageBox.Show("Jobs Activated");
            uicJobs.Deactivated += () => MessageBox.Show("Jobs Deactivated");

            uicJobs.Run();
        }
    }
}

See Also