public override bool RestoreOrder() { bool ret = View.ReloadInfoData(); StatusManager.StatusNotifySet(ret, "並べ替えを復元"); return(ret); }
protected void autoadd_del(ExecutedRoutedEventArgs e, int code) { bool ret = false; try { if (CheckAutoAddChange(e, code) == 0) { if (code == 2) { ret = MenuUtil.AutoAddDelete(autoAddData.IntoList()); } else { ret = MenuUtil.AutoAddDelete(autoAddData.IntoList(), true, true); } if (ret == true) { SetViewMode(AutoAddMode.NewAdd); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } StatusManager.StatusNotifySet(ret, AutoAddString + "を" + cmdMsg[code]); }
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)); }
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]); }
private void button_search_Click(object sender, ExecutedRoutedEventArgs e) { SearchPg(true); if (Settings.Instance.UseLastSearchKey == true) { Settings.Instance.DefSearchKey = GetSearchKey(); SettingWindow.UpdatesInfo("検索/キーワード予約ダイアログの前回検索条件変更"); } StatusManager.StatusNotifySet(true, "検索を実行"); }
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 override bool SaveChange(Dictionary <ulong, ulong> changeIDTable) { var newList = View.lstCtrl.dataList.AutoAddInfoList().DeepClone(); newList.ForEach(item => item.DataID = changeIDTable[item.DataID]); bool ret = MenuUtil.AutoAddChange(newList, false, false, false, true); StatusManager.StatusNotifySet(ret, "並べ替えを保存"); if (ret == true) { //dataListと検索ダイアログへのIDの反映。dataListは既にコピーだが、SaveChange成功後に行う View.lstCtrl.dataList.ForEach(item => item.Data.DataID = changeIDTable[item.Data.DataID]); View.PostProcSaveOrder(changeIDTable); } return(ret); }
protected virtual void mc_RestoreItem(object sender, ExecutedRoutedEventArgs e) { int count = 0; int id = CmdExeUtil.ReadIdData(e); try//Historysは操作以外で削除されないが、直接実行なので念のため { count = CmdHistorys.Historys[id].Items.Count; IsCommandExecuted = true == MenuUtil.RecWorkMainDataAdd(CmdHistorys.Historys[id].Items); if (IsCommandExecuted == true) { CmdHistorys.Historys.RemoveAt(id); } } catch { } StatusManager.StatusNotifySet(IsCommandExecuted, GetCmdMessageFormat("アイテムの復元", count)); }
protected ExecutedRoutedEventHandler GetExecute(cmdOption cmdPrm) { if (cmdPrm.Exe == null) { return(null); } return(new ExecutedRoutedEventHandler((sender, e) => { try { IsCommandExecuted = false; if (cmdPrm.ExeType == cmdExeType.SingleItem) { SelectSingleData(); } if (cmdPrm.ExeType != cmdExeType.NoSetItem) { SetData(cmdPrm.ExeType == cmdExeType.AllItem); } if (cmdPrm.IsNeedClone == true) { CopyDataList(); } if (cmdPrm.IsReleaseItem == true) { ReleaseSelectedData(); } if (cmdPrm.Exe != null && (cmdPrm.IsNeedItem == false || this.ItemCount != 0)) { cmdPrm.Exe(sender, e); if (Settings.Instance.DisplayStatus == true && Settings.Instance.DisplayStatusNotify == true && e != null && e.Command != null) { StatusManager.StatusNotifySet(IsCommandExecuted, GetCmdMessage(e.Command)); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } ClearData(); })); }
private void reserve_proc(ExecutedRoutedEventArgs e, int proc) { if (CmdExeUtil.IsMessageBeforeCommand(e) == true) { if (MessageBox.Show("予約を" + cmdMsg[proc] + "します。\r\nよろしいですか?", cmdMsg[proc] + "の確認", MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } } bool ret = false; if (proc == 0) { ret = MenuUtil.ReserveAdd(CommonUtil.ToList(eventInfo), recSettingView); } else { List <ReserveData> list = GetReserveList(); if (proc == 1) { RecSettingData recSet = recSettingView.GetRecSetting(); list.ForEach(data => data.RecSetting = recSet); ret = MenuUtil.ReserveChange(list); } else { ret = MenuUtil.ReserveDelete(list); } } StatusManager.StatusNotifySet(ret, "録画予約を" + cmdMsg[proc]); if (ret == false) { return; } if (KeepWin == false) { this.Close(); } }
private void mc_ChgOnOff(object sender, ExecutedRoutedEventArgs e) { if (listView_result.SelectedItem == null) { return; } // List <IRecWorkMainData> dataList = lstCtrl.GetSelectedItemsList().Select(data => data.Data).ToList(); if (MenuUtil.CautionManyMessage(dataList.Count, "変更の確認") == false) { return; } MenuUtil.ReserveChangeOnOff(dataList.OfType <ReserveData>().DeepClone(), null, false); MenuUtil.RecinfoChgProtect(dataList.OfType <RecFileInfo>().DeepClone(), false); MenuUtil.AutoAddChangeKeyEnabled(dataList.OfType <AutoAddData>().DeepClone()); StatusManager.StatusNotifySet(true, mc.GetCmdMessageFormat("状態切替を実行", dataList.Count)); }
private void reserve_del(object sender, ExecutedRoutedEventArgs e) { if (CheckReserveChange(e, 2) == false) { return; } bool ret = MenuUtil.ReserveDelete(CommonUtil.ToList(reserveInfo)); StatusManager.StatusNotifySet(ret, "録画予約を削除"); if (ret == false) { return; } if (KeepWin == false) { this.Close(); return; } SetAddMode(AddMode.Re_Add); SetReserveTabHeader(false); }
private void mc_SetRecTag(object sender, ExecutedRoutedEventArgs e) { if (listView_result.SelectedItem == null) { return; } // List <IRecWorkMainData> dataList = lstCtrl.GetSelectedItemsList().Select(data => data.Data).Where(data => data is IRecSetttingData).ToList(); if (CmdExeUtil.CheckSetFromClipBoardCancel(e, dataList, "録画タグ") == true) { return; } if (MenuUtil.CautionManyMessage(dataList.Count, "変更の確認") == false) { return; } MenuUtil.ReserveChangeRecTag(dataList.OfType <ReserveData>().DeepClone(), Clipboard.GetText(), false); MenuUtil.AutoAddChangeRecTag(dataList.OfType <AutoAddData>().DeepClone(), Clipboard.GetText(), false); StatusManager.StatusNotifySet(true, mc.GetCmdMessageFormat("状態切替を実行", dataList.Count)); }
private void reserve_add_chg(ExecutedRoutedEventArgs e, int proc) { try { if (CheckReserveChange(e, proc) == false) { return; } var resInfo = reserveInfo.DeepClone(); if (resModeProgram == true) { if (GetReserveTimeInfo(ref resInfo) == -2) { MessageBox.Show("終了日時が開始日時より前です"); return; } //サービスや時間が変わったら、個別予約扱いにする。タイトルのみ変更は見ない。 if (resInfo.EventID != 0xFFFF || reserveInfo.IsSamePg(resInfo) == false) { resInfo.EventID = 0xFFFF; resInfo.ReleaseAutoAdd(); } } else { //EPG予約に変える場合、またはEPG予約で別の番組に変わる場合 if (eventInfoNow != null && (reserveInfo.IsManual == true || reserveInfo.IsSamePg(eventInfoNow) == false)) { //基本的にAddReserveEpgWindowと同じ処理内容 if (MenuUtil.CheckReservable(CommonUtil.ToList(eventInfoNow)) == null) { return; } eventInfoNow.ConvertToReserveData(ref resInfo); resInfo.ReleaseAutoAdd(); } } if (checkBox_releaseAutoAdd.IsChecked == true) { resInfo.ReleaseAutoAdd(); } resInfo.RecSetting = recSettingView.GetRecSetting(); bool ret = false; HashSet <uint> oldset = null; if (proc == 0) { resInfo.Comment = ""; oldset = new HashSet <uint>(CommonManager.Instance.DB.ReserveList.Keys); ret = MenuUtil.ReserveAdd(CommonUtil.ToList(resInfo)); StatusManager.StatusNotifySet(ret, "録画予約を追加"); } else { ret = MenuUtil.ReserveChange(CommonUtil.ToList(resInfo)); StatusManager.StatusNotifySet(ret, "録画予約を変更"); } if (ret == false) { return; } if (KeepWin == false) { this.Close(); return; } if (proc == 0) { var list = new List <ReserveData>(); CommonManager.CreateSrvCtrl().SendEnumReserve(ref list); var newlist = list.Where(rs => oldset.Contains(rs.ReserveID) == false).ToList(); if (newlist.Count == 1) { ChangeData(newlist[0]); } } SetReserveTabHeader(false); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void mc_Search(object sender, ExecutedRoutedEventArgs e) { Search(); StatusManager.StatusNotifySet(true, "検索を実行"); }
private void button_rename_Click(object sender, RoutedEventArgs e) { if (recInfo != null && recInfo.RecFilePath.Length > 0) { string destPath = null; try { // 絶対パスであること string path = textBox_recFilePath.Text; if (Path.GetFullPath(path).Equals(path, StringComparison.OrdinalIgnoreCase)) { // 拡張子は変更できない if (Path.GetExtension(path).Equals(Path.GetExtension(recInfo.RecFilePath), StringComparison.OrdinalIgnoreCase)) { // 移動先のディレクトリは存在しなければならない if (Directory.Exists(Path.GetDirectoryName(path))) { destPath = path; } } } } catch { } if (destPath == null) { MessageBox.Show("拡張子または移動先が不正です。", "", MessageBoxButton.OK, MessageBoxImage.Error); textBox_recFilePath.Text = recInfo.RecFilePath; } else { // データベースを変更 ErrCode err = ErrCode.CMD_ERR; string originalPath = recInfo.RecFilePath; recInfo.RecFilePath = destPath; try { err = CommonManager.CreateSrvCtrl().SendChgPathRecInfo(new List <RecFileInfo>() { recInfo }); StatusManager.StatusNotifySet(err == ErrCode.CMD_SUCCESS, "録画ファイル名を変更"); if (err != ErrCode.CMD_SUCCESS) { MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "録画ファイル名の変更に失敗しました。", "録画ファイル名の変更", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } if (err != ErrCode.CMD_SUCCESS) { textBox_recFilePath.Text = recInfo.RecFilePath = originalPath; } else { // ファイルが存在すれば移動する var errFileList = new List <string>(); try { File.Move(originalPath, destPath); } catch (FileNotFoundException) { } catch { errFileList.Add(originalPath); } try { // 拡張子が付加されたファイルも移動する foreach (string path in Directory.GetFiles(Path.GetDirectoryName(originalPath), Path.GetFileName(originalPath) + ".*")) { if (path.Length > originalPath.Length && string.Compare(path, 0, originalPath, 0, originalPath.Length, StringComparison.OrdinalIgnoreCase) == 0) { try { File.Move(path, destPath + path.Substring(originalPath.Length)); } catch { errFileList.Add(path); } } } } catch { } if (errFileList.Any()) { StatusManager.StatusNotifyAppend("リネームに失敗 < "); MessageBox.Show("録画済み一覧の情報は更新されましたが、リネームまたは移動に失敗したファイルがあります。\r\n\r\n" + string.Join("\r\n", errFileList), "録画ファイル名の変更", MessageBoxButton.OK, MessageBoxImage.Warning); } } } } button_rename.IsEnabled = false; }