Ejemplo n.º 1
0
        private List <ICommand> GetCmdFromMenuItem(List <CtxmItemData> items)
        {
            var clist = new List <ICommand>();

            items.ForEach(item =>
            {
                if (item != null && EpgCmdsEx.IsDummyCmd(item.Command) == false)
                {
                    clist.Add(item.Command);
                }
                clist.AddRange(GetCmdFromMenuItem(item.Items));
            });
            return(clist);
        }
Ejemplo n.º 2
0
        private void CtxmConvertToMenuItems(List <CtxmItemData> src, ItemCollection dest, CtxmCode code, bool shortcutTextforListType)
        {
            dest.Clear();

            src.ForEach(data =>
            {
                Control item;
                if (data.Command == EpgCmdsEx.Separator)
                {
                    item = new Separator();
                }
                else
                {
                    var menu     = new MenuItem();
                    menu.Header  = data.Header;
                    menu.Command = (EpgCmdsEx.IsDummyCmd(data.Command) ? null : data.Command);
                    if (menu.Command != null)
                    {
                        if ((shortcutTextforListType == true || (MC.WorkCmdOptions[data.Command].GesTrg & MenuCmds.GestureTrg.ToView) == MenuCmds.GestureTrg.ToView) &&
                            (MC.WorkCmdOptions.ContainsKey(data.Command) == false || MC.WorkCmdOptions[data.Command].IsGestureEnabled == true) &&
                            data.ID == 0)
                        {
                            menu.InputGestureText = MenuBinds.GetInputGestureText(data.Command);
                        }
                    }
                    menu.CommandParameter = new EpgCmdParam(typeof(MenuItem), code, data.ID);
                    if (data.Items.Count != 0)
                    {
                        CtxmConvertToMenuItems(data.Items, menu.Items, code, shortcutTextforListType);
                    }
                    item = menu;
                }
                item.Tag     = data.Command;
                item.ToolTip = GetCtxmTooltip(data.Command);
                ToolTipService.SetShowOnDisabled(item, true);

                dest.Add(item);
            });
        }