public WebMenuItem( string itemID, string category, string text, IconInfo icon, IconInfo disabledIcon, WebMenuItemStyle style, RequiredSelection requiredSelection, bool isDisabled, Command command) { _itemID = itemID; _category = category; _text = text; Icon = icon; DisabledIcon = disabledIcon; _style = style; _requiredSelection = requiredSelection; _isDisabled = isDisabled; _command = new SingleControlItemCollection(command, new[] { typeof(Command) }); _commandClick = new CommandClickEventHandler(Command_Click); if (_command.ControlItem != null) { ((Command)_command.ControlItem).Click += _commandClick; } }
public Ability(Ability a) { name = a.name; describtion = a.describtion; cooldown = a.cooldown; cooldownCurrently = a.cooldownCurrently; requiredSelection = a.requiredSelection; ability = a.ability; }
public BocMenuItem( string id, string category, string text, IconInfo icon, IconInfo disabledIcon, RequiredSelection requiredSelection, bool isDisabled, BocMenuItemCommand command) : this(id, category, text, icon, disabledIcon, WebMenuItemStyle.IconAndText, requiredSelection, isDisabled, command) { }
private void AddItem(int index, string category, CommandType commandType, bool isDisabled, bool isVisible) { string id = "item" + index; string text = "Item" + index; const string height = "16"; const string width = "16"; const string iconUrl = "~/Images/Icon.gif"; const string disabledIconUrl = "~/Images/DisabledIcon.gif"; const RequiredSelection requiredSelection = RequiredSelection.Any; Command command = new Command(commandType); if (commandType == CommandType.Href) { command.HrefCommand.Href = "~/Target.aspx?index={0}&itemID={1}"; command.HrefCommand.Target = "_blank"; } _control.MenuItems.Add( new WebMenuItem( id, category, text, new IconInfo(iconUrl, text, text, width, height), new IconInfo(disabledIconUrl, text, text, width, height), WebMenuItemStyle.IconAndText, requiredSelection, isDisabled, command) { IsVisible = isVisible }); if (commandType == CommandType.Href) { } else { if (isVisible && _control.Enabled) { _control.Page.ClientScript.Expect( mock => mock.GetPostBackClientHyperlink(Arg.Is <IControl> (_control), Arg.Text.Like(index.ToString()))) .Return("PostBackHyperLink:" + index); } } }
private void AddMenuItem( string itemID, string category, string text, WebMenuItemStyle style, RequiredSelection selection, CommandType commandType) { WebMenuItem item = new WebMenuItem( itemID, category, text, new IconInfo("~/Images/ClassicBlue/NullIcon.gif"), new IconInfo("~/Images/ClassicBlue/NullIcon.gif"), style, selection, false, new Command(commandType)); _control.MenuItems.Add(item); }
private void AddItem(int index, string category, CommandType commandType, bool isDisabled, bool isVisible) { string id = "item" + index; string text = "Item" + index; const string height = "16"; const string width = "16"; const string iconUrl = "~/Images/Icon.gif"; const string disabledIconUrl = "~/Images/DisabledIcon.gif"; const RequiredSelection requiredSelection = RequiredSelection.Any; Command command = new Command(commandType); if (commandType == CommandType.Href) { command.HrefCommand.Href = "~/Target.aspx?index={0}&itemID={1}"; command.HrefCommand.Target = "_blank"; } _control.MenuItems.Add( new WebMenuItem( id, category, text, new IconInfo(iconUrl, text, text, width, height), new IconInfo(disabledIconUrl, text, text, width, height), WebMenuItemStyle.IconAndText, requiredSelection, isDisabled, command) { IsVisible = isVisible }); string link; if (commandType == CommandType.Href) { link = string.Format("/Target.aspx?index={0}&itemID={1}", null, null); } else { if (isVisible && _control.Enabled) { _control.Page.ClientScript.Expect( mock => mock.GetPostBackClientHyperlink(Arg.Is <IControl> (_control), Arg.Text.Like(index.ToString()))) .Return("PostBackHyperLink:" + index); } link = "PostBackHyperLink:" + index; } if (isVisible) { _itemInfos.Add( string.Format( "\t\tnew DropDownMenu_ItemInfo ('{0}', '{1}', '{2}', '{3}', '{4}', {5}, {6}, '{7}', {8})", index, category, text, iconUrl.TrimStart('~'), disabledIconUrl.TrimStart('~'), (int)requiredSelection, isDisabled ? "true" : "false", link.TrimStart('~'), (commandType == CommandType.Href) ? "'_blank'" : "null")); } }