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

Determines the main activity to be performed in this UIController

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

Syntax

C#
public Activities Activity { get; set; }
Visual Basic (Declaration)
Public Property Activity As Activities
Visual C++
public:
virtual property Activities Activity {
	Activities get () sealed;
	void set (Activities value) sealed;
}

Implements

ITask..::.Activity

Remarks

Allowed values
Activityoperation
UpdateThe default. The user can navigate any row in the view, and perform changes as he see fit.
InsertThe user will be presented with an empty screen, and will be able to create new rows.
BrowseThe user will be able to browse the data without performing changes to it. If AllowIncrementalSearch is true, the user will be able to type values, and navigate to a row that matches the values he typed, see example below
The Delete activity is not allowed. A row can be deleted using the DeleteRow or the DeleteRowAfterLeavingItIf(Func<(Of <(Boolean>)>)).

Examples

incremental search
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.Text;

using Firefly.Box;
using Firefly.Box.Testing;

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

            var uic = new UIController()
            {
                From = jobs,
                Activity = Activities.Browse,
                AllowIncrementalSearch = true,//The default
                View = UITools.GenerateFormWithGridFor("Display Jobs",
                                                       "Try typing the first letters of a value from another row, and see how the grid automatically navigates to that row",
                                                       jobs.Description,
                                                       jobs.MinLevel,
                                                       jobs.MaxLevel)
            };
            uic.Run();

        }
    }
}

Examples

Deferent Activities
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 Firefly.Box;
using Firefly.Box.UI;

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

            var uic = new UIController
            {
                From = jobs,
                AllowBrowse = true,//the default
                AllowDelete = true,//the default
                AllowInsert = true,//the default
                AllowUpdate = true,//the default

                View = UITools.GenerateFormWithGridFor("Jobs and activities",
                                                       "Press the buttons below to switch between the deferent activities, notice that the title displays the current activity",
                                                       jobs.Columns.ToArray())
            };
            //Set the form title according to the activity
            uic.ActivityChanged += () => uic.View.Text = "The Activity is " + uic.Activity.ToString();

            var switchToInsert = new Button
            {
                Text = "Switch To Insert",
                Width = 100
            };
            switchToInsert.Click += (a, b) => uic.Raise(Command.SwitchToInsertActivity);

            var switchToBrowse = new Button
            {
                Text = "Switch To Browse",
                Width = 100
            };
            switchToBrowse.Click += (a, b) => uic.Raise(Command.SwitchToBrowseActivity);

            var switchToUpdate = new Button
            {
                Text = "Switch To Update",
                Width = 100
            };
            switchToUpdate.Click += (a, b) => uic.Raise(Command.SwitchToUpdateActivity);

            var insertRow = new Button { Text = "Insert Row" };
            insertRow.Click += (a, b) => uic.Raise(Command.InsertRow);

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

            UITools.AddControlsToForm(uic.View, switchToInsert, switchToBrowse, switchToUpdate, insertRow, deleteRow);

            uic.Run();
        }
    }
}

See Also