Beispiel #1
0
        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;
        }
Beispiel #2
0
        public RecInfoDescWindow(RecFileInfo info = null)
        {
            InitializeComponent();

            if (CommonManager.Instance.NWMode == true)
            {
                label_recFilePath.IsEnabled = false;
                textBox_recFilePath.SetReadOnlyWithEffect(true);
                button_rename.ToolTip = "EpgTimerNWでは使用不可";
            }

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

                button_rename_opne.Click += ViewUtil.OpenFileNameDialog(textBox_recFilePath, false, "", "", true, "", false);
                if (CommonManager.Instance.NWMode == false)
                {
                    textBox_recFilePath.TextChanged += textBox_recFilePath_TextChanged;
                    button_rename.Click             += button_rename_Click;
                }

                //ステータスバーの設定
                this.statusBar.Status.Visibility = Visibility.Collapsed;
                StatusManager.RegisterStatusbar(this.statusBar, this);

                ChangeData(info);
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
        }
Beispiel #3
0
        public SearchWindow(EpgAutoAddData data = null, AutoAddMode mode = AutoAddMode.Find)
            : base(data, mode)
        {
            InitializeComponent();

            try
            {
                buttonID = "検索";
                base.SetParam(true, checkBox_windowPinned, checkBox_dataReplace);

                //スプリッタ位置設定。操作不可能な値をセットしないよう努める。
                if (Settings.Instance.SearchWndTabsHeight > grid_Tabs.Height.Value)
                {
                    grid_Tabs.Height = new GridLength(Math.Min(Settings.Instance.SearchWndTabsHeight, Height));
                }
                if (Settings.Instance.SearchWndJunreHeight >= 0)
                {
                    searchKeyView.grid_Junre.Height = new GridLength(Settings.Instance.SearchWndJunreHeight);
                }

                //リストビュー関連の設定
                var list_columns = Resources["ReserveItemViewColumns"] as GridViewColumnList;
                list_columns.AddRange(Resources["RecSettingViewColumns"] as GridViewColumnList);

                lstCtrl = new ListViewController <SearchItem>(this);
                lstCtrl.SetSavePath(CommonUtil.NameOf(() => Settings.Instance.SearchWndColumn)
                                    , CommonUtil.NameOf(() => Settings.Instance.SearchColumnHead)
                                    , CommonUtil.NameOf(() => Settings.Instance.SearchSortDirection));
                lstCtrl.SetViewSetting(listView_result, gridView_result, true, true, list_columns);
                lstCtrl.SetSelectedItemDoubleClick(EpgCmds.ShowDialog);

                //ステータス変更の設定
                lstCtrl.SetSelectionChangedEventHandler((sender, e) => this.UpdateStatus(1));

                //最初にコマンド集の初期化
                mc = new CmdExeReserve(this);
                mc.SetFuncGetSearchList(isAll => (isAll == true ? lstCtrl.dataList.ToList() : lstCtrl.GetSelectedItemsList()));
                mc.SetFuncSelectSingleSearchData((noChange) => lstCtrl.SelectSingleItem(noChange));
                mc.SetFuncReleaseSelectedData(() => listView_result.UnselectAll());
                mc.SetFuncGetRecSetting(() => recSettingView.GetRecSetting());
                mc.SetFuncGetSearchKey(() => searchKeyView.GetSearchKey());

                //コマンド集に無いもの
                mc.AddReplaceCommand(EpgCmds.ReSearch, mc_Research);
                mc.AddReplaceCommand(EpgCmds.ReSearch2, mc_Research);
                mc.AddReplaceCommand(EpgCmds.Search, button_search_Click);
                mc.AddReplaceCommand(EpgCmds.AddInDialog, autoadd_add);
                mc.AddReplaceCommand(EpgCmds.ChangeInDialog, autoadd_chg, (sender, e) => e.CanExecute   = winMode == AutoAddMode.Change);
                mc.AddReplaceCommand(EpgCmds.DeleteInDialog, autoadd_del1, (sender, e) => e.CanExecute  = winMode == AutoAddMode.Change);
                mc.AddReplaceCommand(EpgCmds.Delete2InDialog, autoadd_del2, (sender, e) => e.CanExecute = winMode == AutoAddMode.Change);
                mc.AddReplaceCommand(EpgCmds.BackItem, (sender, e) => MoveViewNextItem(-1));
                mc.AddReplaceCommand(EpgCmds.NextItem, (sender, e) => MoveViewNextItem(1));
                mc.AddReplaceCommand(EpgCmds.Cancel, (sender, e) => this.Close());
                mc.AddReplaceCommand(EpgCmds.ChgOnOffCheck, (sender, e) => lstCtrl.ChgOnOffFromCheckbox(e.Parameter, EpgCmds.ChgOnOff));

                //コマンド集を振り替えるもの
                mc.AddReplaceCommand(EpgCmds.JumpReserve, (sender, e) => mc_JumpTab(CtxmCode.ReserveView));
                mc.AddReplaceCommand(EpgCmds.JumpRecInfo, (sender, e) => mc_JumpTab(lstCtrl.SelectSingleItem(true).IsReserved ? CtxmCode.ReserveView : CtxmCode.RecInfoView));
                mc.AddReplaceCommand(EpgCmds.JumpTuner, (sender, e) => mc_JumpTab(CtxmCode.TunerReserveView));
                mc.AddReplaceCommand(EpgCmds.JumpTable, (sender, e) => mc_JumpTab(CtxmCode.EpgView));

                //コマンド集からコマンドを登録。
                mc.ResetCommandBindings(this, listView_result.ContextMenu);

                //コンテキストメニューを開く時の設定
                listView_result.ContextMenu.Opened += new RoutedEventHandler(mc.SupportContextMenuLoading);

                //ボタンの設定
                mBinds.View = CtxmCode.SearchWindow;
                mBinds.SetCommandToButton(button_search, EpgCmds.Search);
                mBinds.SetCommandToButton(button_add_reserve, EpgCmds.AddReserve);
                mBinds.SetCommandToButton(button_delall_reserve, EpgCmds.DeleteAll);
                mBinds.SetCommandToButton(button_add_epgAutoAdd, EpgCmds.AddInDialog);
                mBinds.SetCommandToButton(button_chg_epgAutoAdd, EpgCmds.ChangeInDialog);
                mBinds.SetCommandToButton(button_del_epgAutoAdd, EpgCmds.DeleteInDialog);
                mBinds.SetCommandToButton(button_del2_epgAutoAdd, EpgCmds.Delete2InDialog);
                mBinds.SetCommandToButton(button_up_epgAutoAdd, EpgCmds.BackItem);
                mBinds.SetCommandToButton(button_down_epgAutoAdd, EpgCmds.NextItem);
                mBinds.SetCommandToButton(button_cancel, EpgCmds.Cancel);

                //メニューの作成、ショートカットの登録
                RefreshMenu();

                //予約ウィンドウからのリスト検索、ジャンプ関連の対応
                DataListView = new AutoAddWinListView(listView_result);
                this.grid_main.Children.Add(DataListView);

                //その他のショートカット(検索ダイアログ固有の設定)。コマンドだとコンボボックスアイテムの処理と協調しにくいので‥。
                //searchKeyView.InputBindings.Add(new InputBinding(EpgCmds.Search, new KeyGesture(Key.Enter)));
                searchKeyView.KeyUp += (sender, e) =>
                {
                    if (e.Handled == false && Keyboard.Modifiers == ModifierKeys.None && e.Key == Key.Enter && e.IsRepeat == false)
                    {
                        e.Handled = true;
                        button_search_Click(null, null);
                    }
                    ;
                };
                listView_result.PreviewKeyDown += (sender, e) => ViewUtil.OnKeyMoveNextReserve(sender, e, DataListView);

                //録画設定タブ関係の設定
                recSettingView.SelectedPresetChanged   += SetRecSettingTabHeader;
                recSettingTabHeader.MouseRightButtonUp += recSettingView.OpenPresetSelectMenuOnMouseEvent;

                //過去番組検索
                SetSearchPeriod();

                //ステータスバーの登録
                StatusManager.RegisterStatusbar(this.statusBar, this);
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
        }
        public InfoSearchWindow()
        {
            InitializeComponent();

            try
            {
                buttonID = "予約情報検索";
                base.SetParam(false, checkBox_windowPinned);

                //リストビュー関連の設定
                var list_columns = Resources["ReserveItemViewColumns"] as GridViewColumnList;
                list_columns.AddRange(Resources["RecSettingViewColumns"] as GridViewColumnList);
                list_columns.RenameHeader("StartTime", "日時/次の予約");
                list_columns.RenameHeader("EventName", "番組名/ANDキーワード");
                list_columns.RenameHeader("ProgramContent", "番組内容/その他情報");
                list_columns.RenameHeader("IsEnabled", "有効・プロテクト", "有効・無効/プロテクト切替え");
                list_columns.RenameHeader("Comment", "予約/録画状況");
                list_columns.RenameHeader("RecFileName", "予定/録画ファイル名");

                lstCtrl = new ListViewController <InfoSearchItem>(this);
                lstCtrl.SetSavePath(CommonUtil.NameOf(() => Settings.Instance.InfoSearchWndColumn)
                                    , CommonUtil.NameOf(() => Settings.Instance.InfoSearchColumnHead)
                                    , CommonUtil.NameOf(() => Settings.Instance.InfoSearchSortDirection));
                lstCtrl.SetViewSetting(listView_result, gridView_result, true, true, list_columns);
                lstCtrl.SetSelectedItemDoubleClick((sender, e) =>
                {
                    var cmd = (selectedType == typeof(RecFileInfo) && Settings.Instance.PlayDClick == true) ? EpgCmds.Play : EpgCmds.ShowDialog;
                    cmd.Execute(sender, listView_result);
                });

                //ステータス変更の設定
                lstCtrl.SetSelectionChangedEventHandler((sender, e) => this.UpdateStatus(1));

                //最初にコマンド集の初期化
                mc = new CmdExe <InfoSearchItem>(this);
                mc.SetFuncGetDataList(isAll => isAll == true ? lstCtrl.dataList : lstCtrl.GetSelectedItemsList());
                mc.SetFuncSelectSingleData((noChange) => lstCtrl.SelectSingleItem(noChange));
                mc.SetFuncReleaseSelectedData(() => listView_result.UnselectAll());

                //コマンド集に無いもの
                mc.AddReplaceCommand(EpgCmds.JumpListView, mc_JumpListView);
                mc.AddReplaceCommand(EpgCmds.ReSearch, mc_ReSearch);
                mc.AddReplaceCommand(EpgCmds.ReSearch2, mc_ReSearch);
                mc.AddReplaceCommand(EpgCmds.Search, mc_Search);
                mc.AddReplaceCommand(EpgCmds.Cancel, (sender, e) => this.Close());
                mc.AddReplaceCommand(EpgCmds.ChgOnOffCheck, (sender, e) => lstCtrl.ChgOnOffFromCheckbox(e.Parameter, EpgCmds.ChgOnOff));

                //コマンド集を振り替えるもの
                mc.AddReplaceCommand(EpgCmds.ShowDialog, mc_ShowDialog);//Enterキーからの実行が無ければ省略できる
                mc.AddReplaceCommand(EpgCmds.ChgOnOff, mc_ChgOnOff);
                mc.AddReplaceCommand(EpgCmds.Delete, mc_Delete);

                //ボタンの設定
                mBinds.View = CtxmCode.InfoSearchWindow;
                mBinds.SetCommandToButton(button_search, EpgCmds.Search);
                mBinds.AddInputCommand(EpgCmds.Cancel);//ショートカット登録

                //コンテキストメニューを開く時の設定
                listView_result.ContextMenu.Opened += (sender, e) => dic_mc[selectedType].SupportContextMenuLoading(sender, e);

                //タイプごとの個別コマンド処理用データの設定
                dic_mc.Add(typeof(InfoSearchItem), mc);
                dic_mc.Add(typeof(ReserveData), new CmdExeReserve(this));
                dic_mc.Add(typeof(RecFileInfo), new CmdExeRecinfo(this));
                dic_mc.Add(typeof(EpgAutoAddData), new CmdExeEpgAutoAdd(this));
                dic_mc.Add(typeof(ManualAutoAddData), new CmdExeManualAutoAdd(this));
                foreach (var data in dic_mc.Values.Skip(1))
                {
                    data.SetFuncGetDataList(isAll =>
                    {
                        return((isAll == true ? lstCtrl.dataList : lstCtrl.GetSelectedItemsList()).Select(d => d.Data));
                    });
                    data.SetFuncSelectSingleData(noChange =>
                    {
                        InfoSearchItem item = lstCtrl.SelectSingleItem(noChange);
                        return(item == null ? null : item.Data);
                    });
                    data.SetFuncReleaseSelectedData(() => listView_result.UnselectAll());
                    data.AddReplaceCommand(EpgCmds.ChgOnOff, mc_ChgOnOff);
                    data.AddReplaceCommand(EpgCmds.JumpReserve, (sender, e) => mc_JumpTab(CtxmCode.ReserveView));
                    data.AddReplaceCommand(EpgCmds.JumpTuner, (sender, e) => mc_JumpTab(CtxmCode.TunerReserveView));
                    data.AddReplaceCommand(EpgCmds.JumpTable, (sender, e) => mc_JumpTab(CtxmCode.EpgView));
                }

                //タイプごとのショートカット情報を登録
                dic_mBinds.Add(typeof(InfoSearchItem), mBinds);
                dic_mBinds.Add(typeof(ReserveData), new MenuBinds {
                    View = CtxmCode.ReserveView
                });
                dic_mBinds.Add(typeof(RecFileInfo), new MenuBinds {
                    View = CtxmCode.RecInfoView
                });
                dic_mBinds.Add(typeof(EpgAutoAddData), new MenuBinds {
                    View = CtxmCode.EpgAutoAddView
                });
                dic_mBinds.Add(typeof(ManualAutoAddData), new MenuBinds {
                    View = CtxmCode.ManualAutoAddView
                });

                //メニューの作成、ショートカットの登録
                this.RefreshMenu();

                //選択状態に合わせてコマンドなどをセットするようにする。
                //lstCtrl.SetSelectionChangedEventHandler()は遅延実行なので使わない。
                this.listView_result.SelectionChanged += (sender, e) => ResetMenu();

                //その他設定
                TextBox_SearchWord.Text              = Settings.Instance.InfoSearchLastWord;
                checkBox_TitleOnly.IsChecked         = Settings.Instance.InfoSearchTitleOnly;
                checkBox_ShowToolTip.IsChecked       = Settings.Instance.InfoSearchItemTooltip;
                checkBox_ReserveInfo.IsChecked       = Settings.Instance.InfoSearchReserveInfo;
                checkBox_RecInfo.IsChecked           = Settings.Instance.InfoSearchRecInfo;
                checkBox_EpgAutoAddInfo.IsChecked    = Settings.Instance.InfoSearchEpgAutoAddInfo;
                checkBox_ManualAutoAddInfo.IsChecked = Settings.Instance.InfoSearchManualAutoAddInfo;

                //ステータスバーの登録
                StatusManager.RegisterStatusbar(this.statusBar, this);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
        }
 private void mc_Search(object sender, ExecutedRoutedEventArgs e)
 {
     Search();
     StatusManager.StatusNotifySet(true, "検索を実行");
 }
Beispiel #6
0
        public ChgReserveWindow(ReserveData info = null, int epgInfoOpenMode = 0, RecSettingData setInfo = null)
        {
            InitializeComponent();

            base.SetParam(false, checkBox_windowPinned, checkBox_dataReplace);
            recSettingView.PresetResCompare = true;

            //コマンドの登録
            this.CommandBindings.Add(new CommandBinding(EpgCmds.Cancel, (sender, e) => this.Close()));
            this.CommandBindings.Add(new CommandBinding(EpgCmds.AddInDialog, reserve_add));
            this.CommandBindings.Add(new CommandBinding(EpgCmds.ChangeInDialog, reserve_chg, (sender, e) => e.CanExecute = addMode == AddMode.Change));
            this.CommandBindings.Add(new CommandBinding(EpgCmds.DeleteInDialog, reserve_del, (sender, e) => e.CanExecute = addMode == AddMode.Change));
            this.CommandBindings.Add(new CommandBinding(EpgCmds.BackItem, (sender, e) => MoveViewNextItem(-1), (sender, e) => e.CanExecute  = KeepWin == true));
            this.CommandBindings.Add(new CommandBinding(EpgCmds.NextItem, (sender, e) => MoveViewNextItem(1), (sender, e) => e.CanExecute   = KeepWin == true));
            this.CommandBindings.Add(new CommandBinding(EpgCmds.Search, (sender, e) => MoveViewReserveTarget(), (sender, e) => e.CanExecute = KeepWin == true && DataView is EpgViewBase || DataView is TunerReserveMainView));

            //ボタンの設定
            mBinds.SetCommandToButton(button_cancel, EpgCmds.Cancel);
            mBinds.SetCommandToButton(button_add_reserve, EpgCmds.AddInDialog);
            mBinds.SetCommandToButton(button_chg_reserve, EpgCmds.ChangeInDialog);
            mBinds.SetCommandToButton(button_del_reserve, EpgCmds.DeleteInDialog);
            mBinds.SetCommandToButton(button_up, EpgCmds.BackItem);
            mBinds.SetCommandToButton(button_down, EpgCmds.NextItem);
            mBinds.SetCommandToButton(button_chk, EpgCmds.Search);
            RefreshMenu();

            //録画設定タブ関係の設定
            recSettingView.SelectedPresetChanged += SetReserveTabHeader;
            reserveTabHeader.MouseRightButtonUp  += recSettingView.OpenPresetSelectMenuOnMouseEvent;

            //その他設定
            //深夜時間関係は、comboBoxの表示だけ変更する手もあるが、
            //オプション変更タイミングなどいろいろ面倒なので、実際の値で処理することにする。
            comboBox_service.ItemsSource = ChSet5.ChListSelected;
            comboBox_sh.ItemsSource      = CommonManager.CustomHourList;
            comboBox_eh.ItemsSource      = CommonManager.CustomHourList;
            comboBox_sm.ItemsSource      = Enumerable.Range(0, 60);
            comboBox_em.ItemsSource      = Enumerable.Range(0, 60);
            comboBox_ss.ItemsSource      = Enumerable.Range(0, 60);
            comboBox_es.ItemsSource      = Enumerable.Range(0, 60);
            ViewUtil.Set_ComboBox_LostFocus_SelectItemUInt(stack_start);
            ViewUtil.Set_ComboBox_LostFocus_SelectItemUInt(stack_end);

            if (info == null)
            {
                info = new ReserveData();
                var sTime = CommonUtil.EdcbNow.AddMinutes(5);
                info.StartTime      = sTime.AddSeconds(-sTime.Second);
                info.StartTimeEpg   = info.StartTime;
                info.DurationSecond = 1800;
                info.EventID        = 0xFFFF;
                info.RecSetting     = setInfo ?? Settings.Instance.RecPresetList[0].Data.DeepClone();
                reserveInfo         = info;
            }
            selectedTab = epgInfoOpenMode == 1 ? 0 : 1;
            if (KeepWin == true)
            {
                button_cancel.Content = "閉じる";
                //ステータスバーの設定
                this.statusBar.Status.Visibility = Visibility.Collapsed;
                StatusManager.RegisterStatusbar(this.statusBar, this);
            }
            else
            {
                button_up.Visibility   = Visibility.Collapsed;
                button_down.Visibility = Visibility.Collapsed;
                button_chk.Visibility  = Visibility.Collapsed;
            }
            ChangeData(info);
            initOpen = false;
            CheckMultiReserve();
        }
Beispiel #7
0
        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(eventInfoNow.IntoList()) == null)
                        {
                            return;
                        }
                        eventInfoNow.ToReserveData(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(resInfo.IntoList());
                    StatusManager.StatusNotifySet(ret, "録画予約を追加");
                }
                else
                {
                    ret = MenuUtil.ReserveChange(resInfo.IntoList());
                    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); }
        }