using System; namespace UniversalEditor.UserInterface { public class Command { public class CommandCollection : System.Collections.ObjectModel.Collection { public Command this[string ID] { get { foreach (Command command in this) { if (command.ID == ID) return command; } return null; } } } private bool mvarEnableTearoff = false; public bool EnableTearoff { get { return mvarEnableTearoff; } set { mvarEnableTearoff = value; } } private bool mvarChecked = false; /// /// Determines whether this command displays as checked. /// public bool Checked { get { return mvarChecked; } set { mvarChecked = value; } } private string mvarID = String.Empty; /// /// The ID of the command, used to reference it in . /// public string ID { get { return mvarID; } set { mvarID = value; } } private string mvarTitle = String.Empty; /// /// The title of the command (including mnemonic prefix, if applicable). /// public string Title { get { return mvarTitle; } set { mvarTitle = value; } } private string mvarDefaultCommandID = String.Empty; public string DefaultCommandID { get { return mvarDefaultCommandID; } set { mvarDefaultCommandID = value; } } private CommandShortcutKey mvarShortcutKey = new CommandShortcutKey(); public CommandShortcutKey ShortcutKey { get { return mvarShortcutKey; } set { mvarShortcutKey = value; } } private StockCommandType mvarStockCommandType = StockCommandType.None; /// /// A that represents a predefined, platform-themed command. /// public StockCommandType StockCommandType { get { return mvarStockCommandType; } set { mvarStockCommandType = value; } } private string mvarImageFileName = String.Empty; /// /// The file name of the image to be displayed on the command. /// public string ImageFileName { get { return mvarImageFileName; } set { mvarImageFileName = value; } } private CommandItem.CommandItemCollection mvarItems = new CommandItem.CommandItemCollection(); /// /// The child s that are contained within this . /// public CommandItem.CommandItemCollection Items { get { return mvarItems; } } /// /// The event that is fired when the command is executed. /// public event EventHandler Executed; /// /// Executes this . /// public void Execute() { if (Executed != null) Executed(this, EventArgs.Empty); } } }