예제 #1
0
        public IPathNode NewItem(IContext context, string path, string itemTypeName, object newItemValue)
        {
            itemTypeName = itemTypeName ?? ButtonTypeName;

            var    p       = context.DynamicParameters as NewItemDynamicParameters;
            string caption = p.Caption ?? path;

            CommandBarControl ctl = null;

            switch (itemTypeName.ToLowerInvariant())
            {
            case (PopupTypeName):
            {
                object id    = p.Id != 0 ? p.Id : Type.Missing;
                object param = p.Parameter ?? Type.Missing;
                object index = p.Index != 0 ? p.Index : Type.Missing;

                ctl = NewPopup(context, caption, id, param, index);
                break;
            }

            case (ButtonTypeName):
            default:
            {
                ctl = NewButton(context, caption, p.Index, p.Binding, newItemValue);
                break;
            }
            }

            return(CommandBarControlNodeFactory.Create(ctl).GetNodeValue());
        }
예제 #2
0
        public override IEnumerable <INodeFactory> GetNodeChildren(IContext context)
        {
            List <INodeFactory> factories = new List <INodeFactory>();

            foreach (CommandBarControl control in _commandBar.Controls)
            {
                factories.Add(CommandBarControlNodeFactory.Create(control));
            }

            return(factories);
        }