Пример #1
0
        private void CtxmGenerateChgAutoAddMenuItem(MenuItem menu, IAutoAddTargetData info, ICommand cmd, bool?IsAutoAddEnabled, bool ByFazy)
        {
            if (info != null)
            {
                var addList = new List <AutoAddData>();
                addList.AddRange(info.SearchEpgAutoAddList(IsAutoAddEnabled, ByFazy));
                addList.AddRange(info.SearchManualAutoAddList(IsAutoAddEnabled));

                var chkList = new List <AutoAddData>();
                chkList.AddRange(info.GetEpgAutoAddList(true));
                chkList.AddRange(info.GetManualAutoAddList(true));

                addList.ForEach(autoAdd =>
                {
                    var menuItem       = new MenuItem();
                    menuItem.IsChecked = chkList.Contains(autoAdd) && (info is ReserveData ? (info as ReserveData).IsAutoAdded : true);

                    menuItem.Header = MenuUtil.ConvertAutoddTextMenu(autoAdd);
                    LimitLenHeader(menuItem);
                    if (Settings.Instance.MenuSet.AutoAddSearchToolTip == true)
                    {
                        menuItem.ToolTip = AutoAddDataItemEx.CreateIncetance(autoAdd).ToolTipViewAlways;
                    }
                    menuItem.Command          = cmd;
                    menuItem.CommandParameter = new EpgCmdParam(menu.CommandParameter as EpgCmdParam);
                    (menuItem.CommandParameter as EpgCmdParam).Data = autoAdd.GetType();//オブジェクト入れると残るので
                    (menuItem.CommandParameter as EpgCmdParam).ID   = (int)(autoAdd.DataID);
                    menuItem.Tag = menuItem.Command;

                    menu.Items.Add(menuItem);
                });
            }
        }