private void mc_Delete(object sender, ExecutedRoutedEventArgs e) { if (listView_result.SelectedItem == null) { return; } // List <IRecWorkMainData> dataList = lstCtrl.GetSelectedItemsList().Select(data => data.Data).ToList(); dataList.RemoveAll(d => d is RecFileInfo && (d as RecFileInfo).ProtectFlag != 0); if (CmdExeUtil.CheckDeleteCancel(e, dataList) == true) { return; } if (CmdExeRecinfo.mcs_DeleteCheckDelFile(dataList.OfType <RecFileInfo>()) == false) { return; } if (MenuUtil.CautionManyMessage(dataList.Count, "削除の確認") == false) { return; } MenuUtil.ReserveDelete(dataList.OfType <ReserveData>().ToList(), false); MenuUtil.RecinfoDelete(dataList.OfType <RecFileInfo>().ToList(), false); MenuUtil.AutoAddDelete(dataList.OfType <AutoAddData>().ToList(), false); StatusManager.StatusNotifySet(true, mc.GetCmdMessageFormat("削除を実行", dataList.Count)); }
public RecInfoView() { InitializeComponent(); try { //リストビュー関連の設定 lstCtrl = new ListViewController <RecInfoItem>(this); lstCtrl.SetSavePath(CommonUtil.GetMemberName(() => Settings.Instance.RecInfoListColumn) , CommonUtil.GetMemberName(() => Settings.Instance.RecInfoColumnHead) , CommonUtil.GetMemberName(() => Settings.Instance.RecInfoSortDirection)); lstCtrl.SetViewSetting(listView_recinfo, gridView_recinfo, true, true); lstCtrl.SetSelectedItemDoubleClick((sender, e) => { var cmd = Settings.Instance.PlayDClick == true ? EpgCmds.Play : EpgCmds.ShowDialog; cmd.Execute(sender, listView_recinfo); }); //ステータス変更の設定 lstCtrl.SetSelectionChangedEventHandler((sender, e) => this.UpdateStatus(1)); //最初にコマンド集の初期化 mc = new CmdExeRecinfo(this); mc.SetFuncGetDataList(isAll => (isAll == true ? lstCtrl.dataList : lstCtrl.GetSelectedItemsList()).RecInfoList()); mc.SetFuncSelectSingleData((noChange) => { var item = lstCtrl.SelectSingleItem(noChange); return(item == null ? null : item.RecInfo); }); mc.SetFuncReleaseSelectedData(() => listView_recinfo.UnselectAll()); //コマンド集に無いもの mc.AddReplaceCommand(EpgCmds.ChgOnOffCheck, (sender, e) => lstCtrl.ChgOnOffFromCheckbox(e.Parameter, EpgCmds.ProtectChange)); //コマンド集からコマンドを登録 mc.ResetCommandBindings(this, listView_recinfo.ContextMenu); //コンテキストメニューを開く時の設定 listView_recinfo.ContextMenu.Opened += new RoutedEventHandler(mc.SupportContextMenuLoading); //ボタンの設定 mBinds.View = CtxmCode.RecInfoView; mBinds.SetCommandToButton(button_del, EpgCmds.Delete); mBinds.SetCommandToButton(button_delAll, EpgCmds.DeleteAll); mBinds.SetCommandToButton(button_play, EpgCmds.Play); //メニューの作成、ショートカットの登録 //RefreshMenu(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public RecInfoDescWindow(RecFileInfo info = null) { InitializeComponent(); try { base.SetParam(false, checkBox_windowPinned, checkBox_dataReplace); //最初にコマンド集の初期化 mc = new CmdExeRecinfo(this); mc.SetFuncGetDataList(isAll => recInfo.IntoList()); //コマンド集に無いもの,変更するもの mc.AddReplaceCommand(EpgCmds.Play, (sender, e) => CommonManager.Instance.FilePlay(recInfo.RecFilePath), (sender, e) => e.CanExecute = recInfo.ID != 0); mc.AddReplaceCommand(EpgCmds.Cancel, (sender, e) => this.Close()); mc.AddReplaceCommand(EpgCmds.BackItem, (sender, e) => MoveViewNextItem(-1)); mc.AddReplaceCommand(EpgCmds.NextItem, (sender, e) => MoveViewNextItem(1)); mc.AddReplaceCommand(EpgCmds.Search, (sender, e) => MoveViewRecinfoTarget(), (sender, e) => e.CanExecute = DataView is EpgViewBase); mc.AddReplaceCommand(EpgCmds.DeleteInDialog, info_del, (sender, e) => e.CanExecute = recInfo.ID != 0 && recInfo.ProtectFlag == 0); mc.AddReplaceCommand(EpgCmds.ChgOnOffCheck, (sender, e) => EpgCmds.ProtectChange.Execute(null, this)); //コマンド集からコマンドを登録 mc.ResetCommandBindings(this); //ボタンの設定 mBinds.View = CtxmCode.RecInfoView; mBinds.SetCommandToButton(button_play, EpgCmds.Play); mBinds.SetCommandToButton(button_cancel, EpgCmds.Cancel); mBinds.SetCommandToButton(button_up, EpgCmds.BackItem); mBinds.SetCommandToButton(button_down, EpgCmds.NextItem); mBinds.SetCommandToButton(button_chk, EpgCmds.Search); mBinds.SetCommandToButton(button_del, EpgCmds.DeleteInDialog); mBinds.AddInputCommand(EpgCmds.ProtectChange);//ショートカット登録 RefreshMenu(); button_del.ToolTipOpening += (sender, e) => button_del.ToolTip = (button_del.ToolTip as string + (IniFileHandler.GetPrivateProfileBool("SET", "RecInfoDelFile", false, SettingPath.CommonIniPath) ? "\r\n録画ファイルが存在する場合は一緒に削除されます。" : "")).Trim(); grid_protect.ToolTipOpening += (sender, e) => grid_protect.ToolTip = ("" + MenuBinds.GetInputGestureTextView(EpgCmds.ProtectChange, mBinds.View) + "\r\nプロテクト設定/解除").Trim(); //ステータスバーの設定 this.statusBar.Status.Visibility = Visibility.Collapsed; StatusManager.RegisterStatusbar(this.statusBar, this); ChangeData(info); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
protected override void mc_Delete(object sender, ExecutedRoutedEventArgs e) { List <ReserveData> resList = dataList.ToList(); if (e.Command == EpgCmds.DeleteAll) { recinfoList.Clear(); } recinfoList = recinfoList.GetNoProtectedList(); dataList.AddRange(recinfoList.Select(info => new ReserveDataEnd { Title = "[録画済み] " + info.Title })); if (mcs_DeleteCheck(e) == false || CmdExeRecinfo.mcs_DeleteCheckDelFile(recinfoList) == false) { return; } IsCommandExecuted = MenuUtil.ReserveDelete(resList) && MenuUtil.RecinfoDelete(recinfoList); }