Very simple :)
// Get action service IActionService actionService = ClientContext.ClientAPIService.GetService<IActionService>(); // Create client task action target IClientTaskActionTarget clientTaskActionTarget = actionService.CreateActionTarget<IClientTaskActionTarget>(); clientTaskActionTarget.ClientTask = "Pivotal.Client.FormTask"; clientTaskActionTarget.ClientTaskMethod = "CustomButtonClickHandler"; // Create action IAction action = actionService.CreateAction("CustomButtonClickActionName", ActionCommand.Show, ActionContent.ClientTask, clientTaskActionTarget); // Create custom button (requires Pivotal.Engine.UI.DataTypes.dll) ButtonBarButton button = new ButtonBarButton(){ Name = "CustomButton", DisplayName = "My Custom Button", Enabled = true }; // Set custom button action button.SetAction(action); // Add custom button to a center content buttons bar this.ButtonBar.Buttons.Add(button);
No comments:
Post a Comment