예제 #1
0
        protected void autoadd_add_chg(ExecutedRoutedEventArgs e, int code)
        {
            bool ret = false;

            try
            {
                AutoAddData data = GetData();
                if (data != null && CheckAutoAddChange(e, code) == 0)
                {
                    if (code == 0)
                    {
                        ret = MenuUtil.AutoAddAdd(data.IntoList());
                        if (ret == true)
                        {
                            //割り当てられたIDが欲しいだけなのでEpgTimer内のもろもろは再構築せず、Srvからデータだけ取得する。
                            SetData(AutoAddData.GetAutoAddListSrv(typeof(S)).LastOrDefault() as S);
                            SetViewMode(AutoAddMode.Change);
                        }
                    }
                    else
                    {
                        ret = MenuUtil.AutoAddChange(data.IntoList());
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
            StatusManager.StatusNotifySet(ret, AutoAddString + "を" + cmdMsg[code]);
        }
예제 #2
0
        protected override void mc_ChgResMode(object sender, ExecutedRoutedEventArgs e)
        {
            if (dataList.Count == 0)
            {
                return;
            }

            var  data = CmdExeUtil.ReadObjData(e) as Type;
            uint id   = (uint)CmdExeUtil.ReadIdData(e);

            if (data == null)
            {
                //通常の変更
                IsCommandExecuted = MenuUtil.ReserveChangeResMode(dataList, id);
            }

            if (dataList.Count != 1)
            {
                return;                     //通常はここに引っかかることは無いはず
            }
            AutoAddData autoAdd = AutoAddData.AutoAddList(data, id);

            if (autoAdd != null)
            {
                IsCommandExecuted = MenuUtil.ReserveChangeResModeAutoAdded(dataList, autoAdd);
            }
        }
예제 #3
0
        protected override bool ReloadInfoData()
        {
            EpgCmds.DragCancel.Execute(null, dragMover);

            return(lstCtrl.ReloadInfoData(dataList =>
            {
                dataList.AddRange(AutoAddData.GetDBManagerList(typeof(T)).Select(info => (S)Activator.CreateInstance(typeof(S), info.DeepCloneObj())));
                dragMover.NotSaved = false;
                return true;
            }));
        }
예제 #4
0
 public static string ConvertAutoddTextMenu(AutoAddData data)
 {
     if (data is EpgAutoAddData)
     {
         return("キーワード予約:" + (data.DataTitle == "" ? "(空白)" : data.DataTitle));
     }
     else
     {
         var view = new ManualAutoAddDataItem(data as ManualAutoAddData);
         return("プログラム自動:" + string.Format("({0}){1} {2}", view.DayOfWeek, view.StartTimeShort, view.EventName == "" ? "(空白)" : view.EventName));
     }
 }
예제 #5
0
파일: CmdExe.cs 프로젝트: nekopanda/EDCB
        protected virtual void mc_ShowAutoAddDialog(object sender, ExecutedRoutedEventArgs e)
        {
            AutoAddData autoAdd = AutoAddData.AutoAddList(CmdExeUtil.ReadObjData(e) as Type, (uint)CmdExeUtil.ReadIdData(e));

            if (autoAdd is EpgAutoAddData)
            {
                IsCommandExecuted = true == MenuUtil.OpenChangeEpgAutoAddDialog(autoAdd as EpgAutoAddData);
            }
            else if (autoAdd is ManualAutoAddData)
            {
                IsCommandExecuted = true == MenuUtil.OpenChangeManualAutoAddDialog(autoAdd as ManualAutoAddData, this.Owner);
            }
        }
예제 #6
0
        public static bool?OpenChangeAutoAddDialog(Type t, uint id)
        {
            AutoAddData autoAdd = AutoAddData.AutoAddList(t, id);

            if (t == typeof(EpgAutoAddData))
            {
                return(OpenChangeEpgAutoAddDialog(autoAdd as EpgAutoAddData));
            }
            else if (t == typeof(ManualAutoAddData))
            {
                return(OpenChangeManualAutoAddDialog(autoAdd as ManualAutoAddData));
            }
            return(null);
        }
예제 #7
0
 public static AutoAddDataItem CreateIncetance(AutoAddData data)
 {
     if (data is EpgAutoAddData)
     {
         return(new EpgAutoDataItem(data as EpgAutoAddData));
     }
     else if (data is ManualAutoAddData)
     {
         return(new ManualAutoAddDataItem(data as ManualAutoAddData));
     }
     else
     {
         return(new AutoAddDataItem(data));
     }
 }
예제 #8
0
 public AutoAddDataItem(AutoAddData data)
 {
     Data = data;
 }
예제 #9
0
파일: CmdExe.cs 프로젝트: nekopanda/EDCB
        protected void mcs_chgMenuOpening(MenuItem menu)
        {
            if (menu.IsEnabled == false)
            {
                return;
            }

            var listr = dataList.OfType <IRecSetttingData>().ToList();
            List <RecSettingData> recSettings = listr.RecSettingList();
            var view = (menu.CommandParameter as EpgCmdParam).Code;

            Action <MenuItem, int> SetCheckmarkSubMenus = (subMenu, value) =>
            {
                foreach (var item in subMenu.Items.OfType <MenuItem>())
                {
                    item.IsChecked = ((item.CommandParameter as EpgCmdParam).ID == value);
                }
            };

            //選択アイテムが全て同じ設定の場合だけチェックを表示する
            foreach (var subMenu in menu.Items.OfType <MenuItem>())
            {
                if (subMenu.Tag == EpgCmdsEx.ChgKeyEnabledMenu)
                {
                    if (typeof(T).IsSubclassOf(typeof(AutoAddData)) == false)
                    {
                        subMenu.Visibility = Visibility.Collapsed;
                        continue;
                    }
                    subMenu.Visibility = Visibility.Visible;

                    var  list  = dataList.OfType <AutoAddData>().ToList();
                    bool?value = list.All(info => info.IsEnabled == list[0].IsEnabled) ? (bool?)list[0].IsEnabled : null;
                    subMenu.Header = string.Format("自動登録有効 : {0}", value == null ? "*" : (value == true ? "有効" : "無効"));
                    SetCheckmarkSubMenus(subMenu, value == true ? 0 : value == false ? 1 : int.MinValue);
                }
                else if (subMenu.Tag == EpgCmdsEx.ChgOnPresetMenu)
                {
                    mm.CtxmGenerateChgOnPresetItems(subMenu);

                    RecPresetItem pre_0 = listr[0].RecSettingInfo.LookUpPreset(listr[0].IsManual);
                    RecPresetItem value = listr.All(data => data.RecSettingInfo.LookUpPreset(data.IsManual).ID == pre_0.ID) ? pre_0 : null;
                    subMenu.Header = string.Format("プリセット : {0}", value == null ? "*" : value.DisplayName);
                    SetCheckmarkSubMenus(subMenu, value == null ? int.MinValue : (int)value.ID);
                }
                else if (subMenu.Tag == EpgCmdsEx.ChgResModeMenu)
                {
                    mm.CtxmGenerateChgResModeAutoAddItems(subMenu, itemCount == 1 ? dataList[0] as ReserveData : null);

                    if (typeof(T) != typeof(ReserveData))
                    {
                        subMenu.Visibility = Visibility.Collapsed;
                        continue;
                    }
                    subMenu.Visibility = Visibility.Visible;

                    var         list      = dataList.OfType <ReserveData>().ToList();
                    ReserveMode?resMode_0 = list[0].ReserveMode;
                    ReserveMode?value     = list.All(info => info.ReserveMode == resMode_0) ? resMode_0 : null;
                    subMenu.Header = string.Format("予約モード : {0}", value == null ? "*" : CommonManager.ConvertResModeText(value));
                    SetCheckmarkSubMenus(subMenu, value == ReserveMode.EPG ? 0 : value == ReserveMode.Program ? 1 : int.MinValue);

                    if (list[0].IsAutoAdded == false)
                    {
                        continue;
                    }

                    foreach (var item in subMenu.Items.OfType <MenuItem>())
                    {
                        Type        type    = (item.CommandParameter as EpgCmdParam).Data as Type;
                        int         id      = (item.CommandParameter as EpgCmdParam).ID;
                        AutoAddData autoAdd = AutoAddData.AutoAddList(type, (uint)id);
                        if (autoAdd != null)
                        {
                            item.IsChecked = autoAdd.GetReserveList().Any(info => info.ReserveID == list[0].ReserveID);
                        }
                    }
                }
                else if (subMenu.Tag == EpgCmds.ChgBulkRecSet)
                {
                    subMenu.Visibility = (recSettings.Count < 2 ? Visibility.Collapsed : Visibility.Visible);
                }
                else if (subMenu.Tag == EpgCmds.ChgGenre)
                {
                    if (typeof(T) != typeof(EpgAutoAddData))
                    {
                        subMenu.Visibility = Visibility.Collapsed;
                        continue;
                    }
                    subMenu.Visibility = (recSettings.Count < 2 ? Visibility.Collapsed : Visibility.Visible);
                }
                else if (subMenu.Tag == EpgCmdsEx.ChgRecmodeMenu)
                {
                    byte value = recSettings.All(info => info.RecMode == recSettings[0].RecMode) ? recSettings[0].RecMode : byte.MaxValue;
                    subMenu.Header = string.Format("録画モード : {0}", value == byte.MaxValue ? "*" : CommonManager.Instance.ConvertRecModeText(value));
                    SetCheckmarkSubMenus(subMenu, value);
                }
                else if (subMenu.Tag == EpgCmdsEx.ChgPriorityMenu)
                {
                    byte value = recSettings.All(info => info.Priority == recSettings[0].Priority) ? recSettings[0].Priority : byte.MaxValue;
                    subMenu.Header = string.Format("優先度 : {0}", value == byte.MaxValue ? "*" : value.ToString());
                    SetCheckmarkSubMenus(subMenu, value);
                }
                else if (subMenu.Tag == EpgCmdsEx.ChgRelayMenu || subMenu.Tag == EpgCmdsEx.ChgPittariMenu)
                {
                    if (typeof(T) != typeof(ReserveData) && typeof(T) != typeof(EpgAutoAddData))
                    {
                        subMenu.Visibility = Visibility.Collapsed;
                        continue;
                    }

                    byte   value;
                    string format;
                    if (subMenu.Tag == EpgCmdsEx.ChgRelayMenu)
                    {
                        value  = recSettings.All(info => info.TuijyuuFlag == recSettings[0].TuijyuuFlag) ? recSettings[0].TuijyuuFlag : byte.MaxValue;
                        format = "イベントリレー追従 : {0}";
                    }
                    else
                    {
                        value  = recSettings.All(info => info.PittariFlag == recSettings[0].PittariFlag) ? recSettings[0].PittariFlag : byte.MaxValue;
                        format = "ぴったり(?)録画 : {0}";
                    }
                    subMenu.Header = string.Format(format, value == byte.MaxValue ? "*" : CommonManager.Instance.YesNoDictionary[value].DisplayName);
                    SetCheckmarkSubMenus(subMenu, value);
                    subMenu.IsEnabled = listr.Any(info => info.IsManual == false);
                    subMenu.ToolTip   = (subMenu.IsEnabled != true ? "プログラム予約は対象外" : null);
                }
                else if (subMenu.Tag == EpgCmdsEx.ChgTunerMenu)
                {
                    uint tunerID = recSettings.All(info => info.TunerID == recSettings[0].TunerID) ? recSettings[0].TunerID : uint.MaxValue;
                    mm.CtxmGenerateTunerMenuItems(subMenu);
                    subMenu.Header = string.Format("チューナー : {0}", tunerID == uint.MaxValue ? "*" : CommonManager.Instance.ConvertTunerText(tunerID));
                    SetCheckmarkSubMenus(subMenu, (int)tunerID);
                }
                else if (subMenu.Tag == EpgCmdsEx.ChgMarginStartMenu)
                {
                    int value = recSettings.All(info => info.GetTrueMargin(true) == recSettings[0].GetTrueMargin(true)) ? recSettings[0].GetTrueMargin(true) : int.MaxValue;
                    subMenu.Header = string.Format("開始マージン : {0} 秒", value == int.MaxValue ? "*" : value.ToString());
                }
                else if (subMenu.Tag == EpgCmdsEx.ChgMarginEndMenu)
                {
                    int value = recSettings.All(info => info.GetTrueMargin(false) == recSettings[0].GetTrueMargin(false)) ? recSettings[0].GetTrueMargin(false) : int.MaxValue;
                    subMenu.Header = string.Format("終了マージン : {0} 秒", value == int.MaxValue ? "*" : value.ToString());
                }
            }
        }
예제 #10
0
 public static bool ReserveChangeResModeAutoAdded(List <ReserveData> itemList, AutoAddData autoAdd)
 {
     if (ReserveDelete(itemList, false) == false)
     {
         return(false);
     }
     return(AutoAddChange(CommonUtil.ToList(autoAdd), false, false, true, true));
 }