public CommandBar(View parentView, int toolbarResource, HandleCommandDelegate handleDelegate) { // Save the command handling delegate commandDelegate = handleDelegate; // Create the toolbar Toolbar = parentView.FindViewById <Toolbar>(toolbarResource); if (Toolbar != null) { // Iterate through the children of this toolbar looking for ImageButton for (int index = 0; index < Toolbar.ChildCount; ++index) { if (Toolbar.GetChildAt(index) is AppCompatImageButton imageButton) { // Get the name of the resource form the id and use it to form the name of the image resource string[] packageSplit = Application.Context.Resources.GetResourceName(imageButton.Id).Split(':'); string imageName = string.Format("{0}:drawable/{1}", packageSplit[0], packageSplit[1].Split('/')[1]); imageButton.SetImageResource(Application.Context.Resources.GetIdentifier(imageName, null, null)); // Store the button id and button in an hash table to enable them to be bound Buttons.Add(imageButton.Id, imageButton); imageButton.Click += ButtonClicked; } } // Hide the toolbar initially Toolbar.Visibility = ViewStates.Gone; } }
public ConsoleCommand(string cmd, string argHint, string desc, HandleCommandDelegate handler) { command = cmd; argsHint = argHint; description = desc; commandHandler = handler; }
public ChatCommand(CommandAttribute attribute, HandleCommandDelegate handler) { Name = attribute.Name; Permission = attribute.RBAC; AllowConsole = attribute.AllowConsole; Handler = handler; Help = attribute.Help; }
public void AddCommand(string commandName, HandleCommandDelegate handleCommandDelegate) { AddCommand(commandName, String.Empty, handleCommandDelegate); }
public CommandParser(HandleCommandDelegate handleCommandDelegate) { _handleCommandDelegate = handleCommandDelegate; }
public void AddCommand(string commandName, string shortcut, HandleCommandDelegate handleCommandDelegate) { AddCommand(commandName, shortcut, new CommandParser(handleCommandDelegate)); }