コード例 #1
0
ファイル: MenuManager.cs プロジェクト: nexus7ici/tkntrec
        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);
                });
            }
        }
コード例 #2
0
        private void CtxmGenerateChgAutoAddMenuItem(MenuItem menu, IAutoAddTargetData info, ICommand cmd, bool?IsAutoAddEnabled, bool ByFasy, int str_max = 35)
        {
            if (info != null)
            {
                Action <AutoAddData, string, uint> addSubMenuItem = (autoAdd, title, id) =>
                {
                    var menuItem = new MenuItem();
                    if (info is RecFileInfo && autoAdd is EpgAutoAddData)
                    {
                        menuItem.IsChecked = autoAdd.GetReserveList().FirstOrDefault(data => data.Create64Key() == info.Create64Key()) != null;
                    }
                    else
                    {
                        menuItem.IsChecked = autoAdd.CheckPgHit(info);
                    }
                    string header = title;
                    if (header.Length > str_max)
                    {
                        header           = header.Substring(0, str_max - 3) + "..."; // 長すぎる場合は省略
                        menuItem.ToolTip = title;
                    }
                    if (Settings.Instance.MenuSet.AutoAddSerachToolTip == true)
                    {
                        menuItem.ToolTip = AutoAddDataItemEx.CreateIncetance(autoAdd).ToolTipViewAutoAddSearch;
                    }
                    menuItem.Header           = header;
                    menuItem.Command          = cmd;
                    menuItem.CommandParameter = new EpgCmdParam(menu.CommandParameter as EpgCmdParam);
                    (menuItem.CommandParameter as EpgCmdParam).Data = autoAdd.GetType();//オブジェクト入れると残るので
                    (menuItem.CommandParameter as EpgCmdParam).ID   = (int)id;
                    menuItem.Tag = menuItem.Command;

                    menu.Items.Add(menuItem);
                };

                foreach (var data in info.SearchEpgAutoAddList(IsAutoAddEnabled, ByFasy).OrderBy(data => data.DataID))
                {
                    addSubMenuItem(data, data.DataTitle == "" ? "(空白)" : data.DataTitle, data.dataID);
                }
                foreach (var data in info.GetManualAutoAddList(IsAutoAddEnabled).OrderBy(data => data.DataID))
                {
                    var view = new ManualAutoAddDataItem(data);
                    addSubMenuItem(data, string.Format("({0}){1} {2}", view.DayOfWeek, view.StartTimeShort, data.DataTitle == "" ? "(空白)" : data.DataTitle), data.dataID);
                }
            }
        }
コード例 #3
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));

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

                    menuItem.Header = new InfoSearchItem(autoAdd).ViewItemName + " : " + ToMenuString(autoAdd);
                    SetLimitLenHeader(menuItem, null, false, 42, 28);
                    var header     = menuItem.Header as Label;
                    header.Content = MenuUtil.ToAccessKeyForm(header.Content as string).Insert(7, "(_" + ToAccessKey(idx++) + ")");

                    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);
                });
            }
        }