Command Class

Provides a standard set of application related commands.

Definition

Namespace: Firefly.Box
Assembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
C#
public class Command
Inheritance
Object    Command
Derived

Remarks

The Command class is the base class of all the framework commands. These commands represent basic framework behavior like GoToFirstControl They can be invoked by the programmer using the Raise method. The default behavior of these commands can be overridden by using the Add(ComColumnUTP, String, HandlerScope) method.

Example

Raising and handling of delete command
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.Drawing;
using System.Windows.Forms;
using Firefly.Box;

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

            var uic = new UIController
            {
                From = jobs,
                View = UITools.GenerateFormWithGridFor("Display Jobs",
                                                       "Click the Delete button to delete the current row",
                                                       jobs.Id,
                                                       jobs.Description,
                                                       jobs.MinLevel,
                                                       jobs.MaxLevel)
            };

            var deleteButton = new Button
            {
                Text = "Delete",
            };
            UITools.AddControlsToForm(uic.View, deleteButton);

            //raise the delete command by the button
            deleteButton.Click += (a, b) => uic.Raise(Command.DeleteRow);
            uic.Run();
        }
        public void HandlingDelete()
        {
            var jobs = new Pubs.Jobs();
            jobs.InitializeWithTestData();

            var uic = new UIController
            {
                From = jobs,
                View = UITools.GenerateFormWithGridFor("Display Jobs",
                                                       "Click the delete button, and see how the custom handler for the delete command"+
                                                       " takes affect",
                                                       jobs.Id,
                                                       jobs.Description,
                                                       jobs.MinLevel,
                                                       jobs.MaxLevel)
            };

            var deleteButton = new Button
            {
                Text = "Delete",
            };
            UITools.AddControlsToForm(uic.View, deleteButton);

            //raise the delete command by the button
            deleteButton.Click += (a, b) => uic.Raise(Command.DeleteRow);

            uic.Handlers.Add(Command.DeleteRow).Invokes += e =>
            {
                if (MessageBox.Show(
                        "Are you sure you want to delete this row",
                        "Confirm Delete",
                        MessageBoxButtons.YesNo) == DialogResult.Yes)
                    e.Handled = false;
            };
            uic.Run();
        }
    }
}

Constructors

CommandInitializes a new instance of the Command class

Properties

AdditionalShortcuts Gets or sets an array of additional shortcut keys for this command.
Enabled Gets a value indicating whether the Command is Enabled.
IgnoreIfUnhandledWithinBusinessProcess 
Name The Command Name
Shortcut Gets or sets a value indicating the shortcut key for this command.

Methods

AllowParentViewAccordingToHandlerContext 
BindMenuItem(ToolStripButton)Used to bind between the Command and a menuItem.
BindMenuItem(ToolStripMenuItem)Used to bind between the Command and a menuItem.
CreateTimer Creates an time based listener to be used by the [!:HandlerCollection.Add(CommandBase)]
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Expression Creates an expression listener to be used by the [!:HandlerCollection.Add(CommandBase)]
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as a hash function for a particular type.
(Overrides ObjectGetHashCode)
GetTypeGets the Type of the current instance.
(Inherited from Object)
InputText 
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
RefreshBoundMenus 
SendObjectColumnEventName 
ToStringReturns a string that represents the current object.
(Overrides ObjectToString)
UnbindMenuItem 
UnhandledWithinBusinessProcess 

Events

EnabledChanged Occurs when the Enabled property has changed.

Operators

Fields

AcceptButtonClick 
AlignRichTextBoxCenter 
AlignRichTextBoxLeft 
AlignRichTextBoxRight 
BeforeControlClick Happens when the mouse is down and before the navigation to the clicked control.
BeforeWindowClick Happens when the mouse is down and before the navigation to the clicked window. ///
BeginEditingTreeNodeCaption Begins editing the caption of the currently selected TreeView node
ButtonClick 
CancelMultiSelection 
ChangeColor 
ChangeFont 
Click Happens after the [!:Firefly.Box.UI.Advanced.ControlBase.MouseUp] event
CloseForm The user tries to close the form
CollapseTreeNode Occurs when a TreeView node is collapsed
ControlValueChanged 
Copy Performs copy
Cut Performs Cut
DeleteNextCharacter Deletes the following character of a textbox
DeletePreviousCharacter 
DeleteRow Deletes the current parked row
DoubleClick Happens after the [!:Firefly.Box.UI.Advanced.ControlBase.DoubleClick] event
DragDrop 
DragStart 
Exit Ends the task
ExitApplication Exit all open tasks and terminate the application.
Expand Used to display additional data on a certain control, or to display a selection list.
ExpandTextBox Displays a small form enabling the user to edit the textbox with more room.
ExpandTreeNode Occurs when a TreeView node is expanded
GoToBottomGridRow 
GoToFirstChildNode Selects the first child node of the current row in a TreeView
GoToFirstControl Navigates to the first control acording to the TabIndex
GoToFirstRow Moves the cursor to the first row that fits the Where
GoToFirstRowWhileMultiSelecting 
GoToLastControl Navigates to the last control acording to the TabIndex
GoToLastRow Moves the cursor to the last row that fits the Where
GoToLastRowWhileMultiSelecting 
GoToNextControl Navigates to the next control acording to the TabIndex
GoToNextPage Moves the cursor to the last row on the grid. If already parked on that row, advances to view by the number of visible rows on the grid
GoToNextPageWhileMultiSelecting 
GoToNextRow Moves the cursor to the next row that fits the Where
GoToNextRowWhileMultiSelecting 
GoToPreviousControl Navigates to the previous control acording to the TabIndex
GoToPreviousPage Moves the cursor to the first row on the grid. If already parked on that row, advances to view by the number of visible rows on the grid
GoToPreviousPageWhileMultiSelecting 
GoToPreviousRow Moves the cursor to the previous row that fits the Where
GoToPreviousRowWhileMultiSelecting 
GoToTopGridRow 
GridColumnClick 
Help 
Indent 
InsertChildNode Inserts a new row as a child of the current row in a TreeView
InsertNewLineInMultiline 
InsertRow Inserts a new row after the currently parked row
MouseEnter Happens after the [!:Firefly.Box.UI.Advanced.ControlBase.MouseEnter] event
MouseLeave Happens after the [!:Firefly.Box.UI.Advanced.ControlBase.MouseLeave] event
MultiSelectAllRows 
MultiSelectToNextPage 
MultiSelectToNextRow 
MultiSelectToPreviousPage 
MultiSelectToPreviousRow 
NoData 
Paste Performs Paste
PlaceCursorAfterNextCharacter Places the cursor after the next character of a textbox
PlaceCursorAtEndOfLine Places the cursor after the last character of the current line in a multiline textbox
PlaceCursorAtEndOfTextBox Places the cursor after the last character of a textbox
PlaceCursorAtNextLineInMultiline 
PlaceCursorAtPreviousLineInMultiline 
PlaceCursorAtStartOfLine Places the cursor before the first character of the current line in a multiline textbox
PlaceCursorAtStartOfTextBox Places the cursor before the first character of a textbox
PlaceCursorBeforeNextWord Places the cursor before the next word of a textbox
PlaceCursorBeforePreviousCharacter Places the cursor before the previous character of a textbox
PlaceCursorBeforeWord Places the cursor before the current word of a textbox
RefreshDisplayedData Reloads all the rows displayed on the current form.
RefreshSubForm 
ReloadData Reload the data of the task from the database.
RepaintForm Causes the Form to invalidate, and it's entire content redrawn.
SaveCurrentRow Saves the current row to the database
Select 
SelectAll Selects all the characters in a textbox
SelectNextCharacter Selects the following character of a textbox
SelectNextTabPage Selects the next tab page of a TabControl that is on the current Form
SelectPreviousTabPage Selects the previous tab page of a TabControl that is on the current Form
SelectToFirstCharacter Selects all characters of a textbox until the current carret position
SelectToLastCharacter Selects all characters of a textbox from the current carret position until the last character
SetFocusedControlValueSameAsInPreviousRow Copies the value of a column in a new row, from the previous row.
SetFocusedControlValueToNull Sets the value of the currently edited control to null.
SwitchToBrowseActivity Switches the current Activity to Browse
SwitchToInsertActivity Switches the current Activity to Insert
SwitchToUpdateActivity Switches the current Activity to Update
ToggleCurrentRowMultiSelection 
ToggleRichTextBoxBullet 
UndoChangesInRow Undo all the changes performed to the current row, since it was loaded.
UndoChangesInRowAndExit Undo all the changes and ends the task.
UndoEditing Returns the data in the control to the state it was before the control was entered
WindowMove 
WindowResize 

See Also