UIController Class

Represents a UIController in a classic Model View Controller pattern.

Definition

Namespace: Firefly.Box
Assembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
C#
public sealed class UIController : ITask
Inheritance
Object    UIController
Implements
ITask

Remarks

The UIController controls the interaction between the user ("View") and the application.
For information about the event flow, and the execution behavior of a UIController see the documentation of the Run method.
Controls from the Firefly.Box.UI namespace, that are placed on the , can only receive focus if they are associated to a column, that is part of the Columns property collection of the UIController.

Example

Simple UIController
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;
using System.Collections.Generic;
using System.Text;
using Firefly.Box;
using Firefly.Box.Testing;

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

            var uic = new UIController()
            {
                From = jobs,
                View = UITools.GenerateFormWithGridFor("Display Jobs",
                                                       "A simple grid showing all the rows in the jobs entity",
                                                       jobs.Id,
                                                       jobs.Description,
                                                       jobs.MinLevel,
                                                       jobs.MaxLevel)
            };
            uic.Run();
        }

    }
}

Constructors

UIControllerInitializes a new instance of the UIController class.
UIController(UIControllerAdvancedSettings)Initializes a new instance of the UIController class.

Properties

Activity Determines the main activity to be performed in this UIController
AllowActivitySwitch 
AllowBrowseGets or sets the value determining if the Browse activity is allowed
AllowDelete Determines if the user is allowed to use the DeleteRow, Command to delete the current row.
AllowIncrementalSearch Determines if the user is allowed to perform Incremental Search while the Activity is set to Browse.
AllowInsertGets or sets the value determining if the user is allowed to insert rows
AllowInsertInUpdateActivity Determines if the user can Insert a new row, while in UpdateActivity.
AllowSelectGets or sets the value determining If the SelectCommand is enabled for the UIController
AllowUpdateGets or sets the value determining if the Update activity is allowed
CachedRowsInfo 
ColumnsGets the columns that are used in this UIController
CurrentHandledCommand Return the currently handled command
CurrentHandledControl Return the currently handled control
CurrentHandledKey Return the currently handled key combination
EntitiesGets entities that are associated to this UIController by the From property and Relations property
ExitedBecauseThereAreNoRowsAndInsertActivityIsNotAllowed 
ForceSaveRow Forces the UIController to perform the SavingRow event, when the user leaves the row. Overrides the default SavingRow event rules
FromDetermines the Entity who's rows the UIController will perform it's iteration on.
GoToToNextRowAfterLastControlGets or sets the value determining if when the user is parked on the last column, and presses tab, he will automatically move to the next row.
HandlersGets the UIController's handlers
InTransactionGets the value determining if a transaction is currently open.
KeepViewVisibleAfterExitGets or sets the value determining if the UIController's form should remain visible after the UIController exits.
ModuleGets or sets the value determining the ModuleController to whom this UIController is associated
NoData 
NonDbWhere This Where will always be evaluated in memory and may have performance implications
OrderByGets or sets the value determining order in which the rows are ordered
PreloadData 
ReevaluateBindValueAndRelationsOnEnterRow 
RelationsGet this UIController relations
ReloadDataAfterSavingRowGets or sets the value determining if whenever a row is left, all the displays rows in the grid are reevaluated.
ReloadDataAfterUpdatingOrderByColumns 
ReloadDataOnReEntry 
RowChangedGets the value determining REEDITindicating that the current row was changed, and will be save to the database, after the SavingRow event will execute.
RowLockingGets or sets the value determining the UIController's row locking strategy
SortOnIncrementalSearchGets or sets the value determining if when the user uses the incremental search, the OrderBy will change to match to column the user is searching on.
StartFromFirstRowIfStartOnRowWhereFails 
StartFromLastRowGets or sets the value determining If the UIController should start from the last row.
StartOnRowWhereDetermines the row on which the UIController will start on.
SwitchToInsertWhenNoRowsGets or sets the value determining if when no rows are found, the UIController will switch to insert activity automatically.
TitleGets or sets the UIController's title
TransactionScopeGets or sets the value determining the UIController's transaction scope
TransactionType 
View The main form of this UIController. This Form will be displayed when the Run will be called.
WhereGets the value determining the filter that will be applied on the rows of this UIController.

Methods

AddAllColumnsAdds all the columns of the Entity determined in the From property, and all the entities specified in the Relations property to the Columns property collection.
BindAllowActivitySwitchSets an expression that will determine the value of the AllowActivitySwitch property.
BindAllowBrowseSets an expression that will determine the value of the AllowBrowse property.
BindAllowDeleteSets an expression that will determine the value of the AllowDelete property.
BindAllowIncrementalSearchSets an expression that will determine the value of the AllowIncrementalSearch property.
BindAllowInsertSets an expression that will determine the value of the AllowInsert property.
BindAllowUpdateSets an expression that will determine the value of the AllowUpdate property.
BindForceSaveRowSets an expression that will determine the value of the ForceSaveRow property.
BindGoToToNextRowAfterLastControlSets an expression that will determine the value of the GoToToNextRowAfterLastControl property.
BindKeepViewVisibleAfterExitSets an expression that will determine the value of the KeepViewVisibleAfterExit property.
BindReloadDataAfterSavingRowSets an expression that will determine the value of the ReloadDataAfterSavingRow property.
BindSortOnIncrementalSearchSets an expression that will determine the value of the SortOnIncrementalSearch property.
DeleteRowAfterLeavingItIfSets an expression that determines if the current row will be deleted once left.
DeltaOfReturns The delta between the value of expression before the EnterRow event, and the current value of expression
DenyUndoForCurrentRow 
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
ExitInstructs the UIController to exit.
Exit(ExitTiming)Instructs the UIController to exit.
Exit(ExitTiming, FuncBoolean)Instructs the UIController to exit.
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
Invoke(Action)Invokes a action that will be handled by an Handler.
Invoke(CommandWithArgs)Invokes a command that will be handled by an Handler.
Invoke(Command, Object)Invokes a command that will be handled by an Handler.
Invoke(Keys, Object)Invokes a keyCombination that will be handled by an Handler.
Invoke(String, Object)Invokes a customCommandKey that will be handled by an Handler.
InvokeT(Command, ArrayColumnT) 
InvokeT(Keys, ArrayColumnT) 
InvokeT(String, ArrayColumnT) 
LockCurrentRowLocks the current row for the Entity specified in the From property , and all the entities specified in the Relations property collection.
MarkRowAsChanged 
Raise(CommandWithArgs)Raises a command that will be handled by an Handler.
Raise(Command, Object)Raises a command that will be handled by an Handler.
Raise(Keys, Object)Raises a keyCombination that will be handled by an Handler.
Raise(String, Object)Raises a customCommandKey that will be handled by an Handler.
RaiseT(Command, ArrayColumnT) 
RaiseT(Keys, ArrayColumnT) 
RaiseT(String, ArrayColumnT) 
ReadAllRows 
RefreshWhere 
Run Runs the UIController.
SaveRowAndDo Saves the current row to the DB and performs the specified action after the row was saved successfully.
ToStringReturns a string that represents the current object.
(Overrides ObjectToString)
VisitFlow Used to determine the user navigation type, between the controls

Events

ActivatedOccurs whenever the UIController is Activated.
ActivityChangedExecutes whenever the Activity property of the UIController changes.
AfterSavingRow 
BeforeExit 
BeforeIncrementalSearch 
DatabaseErrorOccurredOccurs when a database error occurs and after all the DatabaseErrorHandler processed the error.
DeactivatedOccurs whenever the UIController is Deactivated.
Deleting Occurs when the user tries to delete a row.
EndOccurs when the UIController ends. Raised once for each Run method. Preserves the last row data.
EnterRowOccurs when a row is entered by this UIController and after that row was loaded from the database.
ExitingAfterFailedReactivatingInvalidatedControl Occurs when the the UIController is about to exit because a flow abort exception was thrown and there is no control to return keyboard focus to.
IllegalActivity 
IncrementalSearch 
LeaveRow Occurs whenever the user leaves a row, before the RowChanged property occurs
LoadOccurs when the UIController is executed, before the Start event and before the database query is constructed. Raised once for each Run method.
NoDataStateEntered 
PreviewDatabaseErrorOccurs when a database error occurs and before all the DatabaseErrorHandler process the error.
ProcessingCommand 
RowChanging 
SavingRow Occurs whenever the user leaves a row, and that row is about to be saved to the Database.
StartOccurs when starts and after the Load event. Raised once for each Run method.
StartOnRowWhereError 
Undoing Occurs when the user tries to undo the changed in a row.

See Also