Ejemplo n.º 1
0
        public static object GetArgument(this ToolStripItem item)
        {
            ToolStripItemCommandBinding binding = (ToolStripItemCommandBinding)item.Tag;

            if (binding != null)
            {
                return(binding.Argument);
            }

            return(null);
        }
Ejemplo n.º 2
0
        public static void RefreshCommand(this ToolStripItem item, bool refreshChildren = false)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            ToolStripItemCommandBinding binding = (ToolStripItemCommandBinding)item.Tag;

            if (binding != null)
            {
                binding.Refresh();
            }

            if (refreshChildren)
            {
                ToolStripMenuItem menuItem = item as ToolStripMenuItem;
                if (menuItem != null)
                {
                    RefreshCommands(menuItem.DropDown);
                }
            }
        }