ActionCommand.Execute C# (CSharp) Method

Execute() public method

Defines the method to be called when the command is invoked.
public Execute ( object parameter ) : void
parameter object Data used by the command. /// If the command does not require data to be passed, /// this object can be set to null.
return void
    public void Execute(object parameter)
    {
        if (CanExecute(parameter))
            _executeAction();
    }

Usage Example

        private void CreateNewTypePermission(ICommandAdapter adapter, string targetType)
        {
            var actionCommand = new ActionCommand();

            actionCommand.Parameters.MainParameter  = new MainParameter("Type Permissions");
            actionCommand.Parameters.ExtraParameter = new MainParameter();
            actionCommand.Execute(adapter);
            actionCommand.Parameters.MainParameter  = new MainParameter("Type Permissions.New");
            actionCommand.Parameters.ExtraParameter = new MainParameter();
            actionCommand.Execute(adapter);

            var fillFormCommand = new FillFormCommand();

            fillFormCommand.Parameters.Add(new Parameter("Target Type", targetType, true, StartPosition));
            fillFormCommand.Parameters.Add(new Parameter("Read", this.ParameterValue("Read", "Allow"), true, StartPosition));
            fillFormCommand.Parameters.Add(new Parameter("Write", this.ParameterValue("Write", "Allow"), true, StartPosition));
            fillFormCommand.Parameters.Add(new Parameter("Delete", this.ParameterValue("Delete", "Allow"), true, StartPosition));
            fillFormCommand.Parameters.Add(new Parameter("Create", this.ParameterValue("Create", "Allow"), true, StartPosition));
            fillFormCommand.Parameters.Add(new Parameter("Navigate", this.ParameterValue("Navigate", "Allow"), true, StartPosition));
            fillFormCommand.Execute(adapter);

            var saveAndCloseCommand = new SaveAndCloseCommand();

            saveAndCloseCommand.Execute(adapter);

            saveAndCloseCommand = new SaveAndCloseCommand();
            saveAndCloseCommand.Execute(adapter);
        }
All Usage Examples Of ActionCommand::Execute