protected virtual void mc_RestoreClear(object sender, ExecutedRoutedEventArgs e) { if (MessageBox.Show("履歴をクリアします。\r\nよろしいですか?", "アイテムの復元" , MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK) { CmdHistorys.Clear(); IsCommandExecuted = true; } StatusManager.StatusNotifySet(IsCommandExecuted, "アイテムの復元履歴をクリア"); }
public static bool ReserveDelete(List <ReserveData> itemlist, bool cautionMany = true, bool noHistory = false) { if (CheckReserveOnRec(itemlist, "削除") == false) { return(false); } List <uint> list = itemlist.Select(item => item.ReserveID).ToList(); bool ret = ReserveCmdSend(list, CommonManager.CreateSrvCtrl().SendDelReserve, "予約削除", cautionMany); if (Settings.Instance.MenuSet.RestoreNoUse == false && noHistory == false && ret == true) { CmdHistorys.Add(EpgCmds.Delete, itemlist.DeepClone()); } return(ret); }
public static bool ReserveChange(List <ReserveData> itemlist, bool cautionMany = true, bool noHistory = false) { if (CheckReserveOnRec(itemlist, "変更") == false) { return(false); } List <ReserveData> rhist = null; if (Settings.Instance.MenuSet.RestoreNoUse == false && noHistory == false) { //変更時は一応Send前に元データを確保 rhist = itemlist.Where(item => CommonManager.Instance.DB.ReserveList.ContainsKey(item.ReserveID)).Select(item => CommonManager.Instance.DB.ReserveList[item.ReserveID]).DeepClone(); } bool ret = ReserveCmdSend(itemlist, CommonManager.CreateSrvCtrl().SendChgReserve, "予約変更", cautionMany); if (rhist != null && ret == true) { CmdHistorys.Add(EpgCmdsEx.ChgMenu, rhist); } return(ret); }
//mode 0:追加、1:変更、2:削除 private static bool AutoAddCmdSendWork(IEnumerable <AutoAddData> itemlist, int mode, List <ReserveData> delReserveList = null, List <ReserveData> chgReserveList = null, bool cautionMany = true, bool isViewOrder = true, bool noHistory = false) { var message = "自動予約登録の" + (new List <string> { "追加", "変更", "削除" }[(int)mode]); if (cautionMany == true && CautionManyMessage(itemlist.Count(), message) == false) { return(false); } var epgList = itemlist.OfType <EpgAutoAddData>().ToList(); var manualList = itemlist.OfType <ManualAutoAddData>().ToList(); List <EpgAutoAddData> ehist = null; List <ManualAutoAddData> mhist = null; noHistory |= Settings.Instance.MenuSet.RestoreNoUse; if (mode == 1 && noHistory == false) { //変更時は、一応Send・並び順変更前に元データを確保。 ehist = epgList.Where(item => CommonManager.Instance.DB.EpgAutoAddList.ContainsKey(item.dataID)).Select(item => CommonManager.Instance.DB.EpgAutoAddList[item.dataID]).DeepClone(); mhist = manualList.Where(item => CommonManager.Instance.DB.ManualAutoAddList.ContainsKey(item.dataID)).Select(item => CommonManager.Instance.DB.ManualAutoAddList[item.dataID]).DeepClone(); } if (isViewOrder == true) { //自動予約登録データ変更の前に、並び順を自動保存する。 if ((AutoAddOrderAutoSave(ref epgList, mode != 0) && AutoAddOrderAutoSave(ref manualList, mode != 0)) == false) { MessageBox.Show("自動登録の並べ替え保存中に問題が発生しました。\r\n処理を中止します。", message, MessageBoxButton.OK, MessageBoxImage.Exclamation); return(false); } } var cmd = CommonManager.CreateSrvCtrl();//これは単なる表記の省略 bool ret = false, retE = false, retM = false; switch (mode) { case 0: return(ReserveCmdSend(epgList, cmd.SendAddEpgAutoAdd, "キーワード予約の追加", false) && ReserveCmdSend(manualList, cmd.SendAddManualAdd, "プログラム自動予約の追加", false)); case 1: ret = (delReserveList == null ? true : ReserveDelete(delReserveList, false, true)) && (retE = ReserveCmdSend(epgList, cmd.SendChgEpgAutoAdd, "キーワード予約の変更", false)) && (retM = ReserveCmdSend(manualList, cmd.SendChgManualAdd, "プログラム自動予約の変更", false)) && (chgReserveList == null ? true : ReserveChange(chgReserveList, false, true)); break; case 2: ret = (retE = ReserveCmdSend(epgList.Select(item => (uint)item.DataID).ToList(), cmd.SendDelEpgAutoAdd, "キーワード予約の削除", false)) && (retM = ReserveCmdSend(manualList.Select(item => (uint)item.DataID).ToList(), cmd.SendDelManualAdd, "プログラム自動予約の削除", false)) && (delReserveList == null ? true : ReserveDelete(delReserveList, false, true)); break; } if (noHistory == false && (retE == true || retM == true)) { var list = new List <AutoAddData>(); if (retE == true) { list.AddRange(ehist ?? epgList.DeepClone()); } if (retM == true) { list.AddRange(mhist ?? manualList.DeepClone()); } CmdHistorys.Add(mode == 1 ? EpgCmdsEx.ChgMenu : EpgCmds.Delete, list); } return(ret); }