UIControllerActivated Event
Namespace: Firefly.BoxAssembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
public event Action Activated
Public Event Activated As Action
member Activated : IEvent<Action,
EventArgs>
Value
Action 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
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 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();
}
}
}