public override void OnMenuItemWxeFunctionCommandClick(WebMenuItem menuItem, WebTreeNode node)
        {
            if (menuItem != null && menuItem.Command != null)
            {
                if (menuItem is BocMenuItem)
                {
                    BocMenuItemCommand command        = (BocMenuItemCommand)menuItem.Command;
                    IBusinessObject    businessObject = null;
                    if (node is BusinessObjectTreeNode)
                    {
                        businessObject = ((BusinessObjectTreeNode)node).BusinessObject;
                    }

                    Page page = node.TreeView.Page;
                    if (page is IWxePage)
                    {
                        command.ExecuteWxeFunction((IWxePage)page, businessObject);
                    }
                    //else
                    //  command.ExecuteWxeFunction (Page, businessObject);
                }
                else
                {
                    base.OnMenuItemWxeFunctionCommandClick(menuItem, node);
                }
            }
        }
Beispiel #2
0
 /// <summary> Handles the click to a WXE function command or a row menu. </summary>
 /// <include file='..\..\doc\include\UI\Controls\BocList.xml' path='BocList/OnRowMenuItemWxeFunctionCommandClick/*' />
 protected virtual void OnRowMenuItemWxeFunctionCommandClick(WebMenuItem menuItem, IBusinessObject businessObject, int listIndex)
 {
     if (menuItem != null && menuItem.Command != null)
     {
         if (menuItem is BocMenuItem)
         {
             BocMenuItemCommand command = (BocMenuItemCommand)menuItem.Command;
             if (Page is IWxePage)
             {
                 command.ExecuteWxeFunction((IWxePage)Page, new[] { listIndex }, new[] { businessObject });
             }
             //else
             //  command.ExecuteWxeFunction (Page, new int[1] {listIndex}, new IBusinessObject[1] {businessObject});
         }
         else
         {
             Command command = menuItem.Command;
             if (Page is IWxePage)
             {
                 command.ExecuteWxeFunction((IWxePage)Page, null);
             }
             //else
             //  command.ExecuteWxeFunction (Page, null, new NameValueCollection (0));
         }
     }
 }
 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)
 {
 }
        /// <summary>
        ///   Calls the <see cref="BocMenuItemCommand.ExecuteWxeFunction(IWxePage,int[],IBusinessObject[])"/> method of the <paramref name="menuItem"/>'s
        ///   <see cref="BocMenuItem.Command"/>.
        /// </summary>
        /// <param name="menuItem"> The <see cref="BocMenuItem"/> that has been clicked. </param>
        /// <remarks> Only called for commands of type <see cref="CommandType.WxeFunction"/>. </remarks>
        protected virtual void OnMenuItemWxeFunctionCommandClick(WebMenuItem menuItem)
        {
            if (menuItem != null && menuItem.Command != null)
            {
                if (menuItem is BocMenuItem)
                {
                    int[]             indices = new int[0];
                    IBusinessObject[] businessObjects;
                    if (Value != null)
                    {
                        businessObjects = new IBusinessObject[] { Value }
                    }
                    ;
                    else
                    {
                        businessObjects = new IBusinessObject[0];
                    }

                    BocMenuItemCommand command = (BocMenuItemCommand)menuItem.Command;
                    if (Page is IWxePage)
                    {
                        command.ExecuteWxeFunction((IWxePage)Page, indices, businessObjects);
                    }
                    //else
                    //  command.ExecuteWxeFunction (Page, indices, businessObjects);
                }
                else
                {
                    Command command = menuItem.Command;
                    if (Page is IWxePage)
                    {
                        command.ExecuteWxeFunction((IWxePage)Page, null);
                    }
                    //else
                    //  command.ExecuteWxeFunction (Page, null, new NameValueCollection (0));
                }
            }
        }