コード例 #1
0
ファイル: InfoWindow.xaml.cs プロジェクト: nekopanda/EDCB
        public InfoWindow(InfoWindowViewModel dataContext)
        {
            InitializeComponent();

            notifyIcon.Icon        = Properties.Resources.TaskIconInfo;
            notifyIcon.Text        = "予約簡易表示 (EpgTimer)";
            notifyIcon.MouseClick += NotifyIcon_MouseClick;
            notifyIcon.Visible     = true;

            // notify icon用メニューの設定
            var menu = new System.Windows.Forms.ContextMenuStrip();

            ToolStripMenuItem topmostMenu = new ToolStripMenuItem();

            topmostMenu.Text    = "最前面に表示";
            topmostMenu.Checked = dataContext.IsTopMost;
            topmostMenu.Click  += (s, e) => { dataContext.IsTopMost = !dataContext.IsTopMost; };
            menu.Items.Add(topmostMenu);

            ToolStripMenuItem bottommostMenu = new ToolStripMenuItem();

            bottommostMenu.Text    = "最背面に表示";
            bottommostMenu.Checked = dataContext.IsBottomMost;
            bottommostMenu.Click  += (s, e) => { dataContext.IsBottomMost = !dataContext.IsBottomMost; };
            menu.Items.Add(bottommostMenu);

            ToolStripMenuItem closeMenu = new ToolStripMenuItem();

            closeMenu.Text   = "消す";
            closeMenu.Click += (s, e) => TrueClose();
            menu.Items.Add(closeMenu);
            notifyIcon.ContextMenuStrip = menu;

            // notify icon用メニュー内の checkbox 更新用イベントハンドラ追加
            dataContextChanged = (object sender, PropertyChangedEventArgs e) =>
            {
                switch (e.PropertyName)
                {
                case "IsTopMost": topmostMenu.Checked = dataContext.IsTopMost; break;

                case "IsBottomMost": bottommostMenu.Checked = dataContext.IsBottomMost; break;
                }
            };
            dataContext.PropertyChanged += dataContextChanged;

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

            lstCtrl = new ListViewController <ReserveItem>(this);
            lstCtrl.SetSavePath(CommonUtil.GetMemberName(() => Settings.Instance.InfoWindowListColumn));
            lstCtrl.SetViewSetting(listView_InfoWindow, girdView_InfoWindow, false, false, progress_list_columns, null, false);

            MouseLeftButtonDown += (s, e) => { DragMove(); };
            UpdateWindowState();

            DataContext = dataContext;
        }
コード例 #2
0
ファイル: ReserveView.xaml.cs プロジェクト: nekopanda/EDCB
        private CmdExeReserve mc; //予約系コマンド集

        public ReserveView()
        {
            InitializeComponent();

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

                lstCtrl = new ListViewController <ReserveItem>(this);
                lstCtrl.SetSavePath(CommonUtil.GetMemberName(() => Settings.Instance.ReserveListColumn)
                                    , CommonUtil.GetMemberName(() => Settings.Instance.ResColumnHead)
                                    , CommonUtil.GetMemberName(() => Settings.Instance.ResSortDirection));
                lstCtrl.SetViewSetting(listView_reserve, gridView_reserve, true, true, list_columns);
                lstCtrl.SetSelectedItemDoubleClick(EpgCmds.ShowDialog);

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

                //最初にコマンド集の初期化
                mc = new CmdExeReserve(this);
                mc.SetFuncGetDataList(isAll => (isAll == true ? lstCtrl.dataList : lstCtrl.GetSelectedItemsList()).GetReserveList());
                mc.SetFuncSelectSingleData((noChange) =>
                {
                    var item = lstCtrl.SelectSingleItem(noChange);
                    return(item == null ? null : item.ReserveInfo);
                });
                mc.SetFuncReleaseSelectedData(() => listView_reserve.UnselectAll());

                //コマンド集に無いもの
                mc.AddReplaceCommand(EpgCmds.ChgOnOffCheck, (sender, e) => lstCtrl.ChgOnOffFromCheckbox(e.Parameter, EpgCmds.ChgOnOff));

                //コマンド集からコマンドを登録。多少冗長だが、持っているコマンドは全部登録してしまう。
                //フォーカスによってコンテキストメニューからウィンドウにコマンドが繋がらない場合があるので、
                //コンテキストメニューにもコマンドを登録する。
                mc.ResetCommandBindings(this, listView_reserve.ContextMenu);

                //ボタンの設定。XML側でコマンド指定しておけば、ループでまとめ処理できるけど、
                //インテリセンス効かないし(一応エラーチェックは入る)、コード側に一覧として書き出す。
                mBinds.View = CtxmCode.ReserveView;
                mBinds.SetCommandToButton(button_on_off, EpgCmds.ChgOnOff);
                mBinds.SetCommandToButton(button_change, EpgCmds.ShowDialog);
                mBinds.SetCommandToButton(button_del, EpgCmds.Delete);
                mBinds.SetCommandToButton(button_add_manual, EpgCmds.ShowAddDialog);
                mBinds.SetCommandToButton(button_timeShiftPlay, EpgCmds.Play);

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

                //コンテキストメニューを開く時の設定
                listView_reserve.ContextMenu.Opened += new RoutedEventHandler(mc.SupportContextMenuLoading);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
        }
コード例 #3
0
ファイル: RecInfoView.xaml.cs プロジェクト: nekopanda/EDCB
        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); }
        }
コード例 #4
0
        public virtual void InitAutoAddView()
        {
            try
            {
                //リストビュー関連の設定
                lstCtrl = new ListViewController <S>(this);
                lstCtrl.SetSavePath(ColumnSavePath);
                lstCtrl.SetViewSetting(listView_key, gridView_key, true, false
                                       , ColumnList, (sender, e) => dragMover.NotSaved |= lstCtrl.GridViewHeaderClickSort(e));
                ColumnList = null;
                lstCtrl.SetSelectedItemDoubleClick(EpgCmds.ShowDialog);

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

                //ドラッグ移動関係
                this.dragMover.SetData(this, listView_key, lstCtrl.dataList, new lvDragData(this));

                //最初にコマンド集の初期化
                //mc = (R)Activator.CreateInstance(typeof(R), this);
                mc.SetFuncGetDataList(isAll => (isAll == true ? lstCtrl.dataList : lstCtrl.GetSelectedItemsList()).AutoAddInfoList());
                mc.SetFuncSelectSingleData((noChange) =>
                {
                    var item = lstCtrl.SelectSingleItem(noChange);
                    return(item == null ? null : item.Data as T);
                });
                mc.SetFuncReleaseSelectedData(() => listView_key.UnselectAll());

                //コマンド集に無いもの
                mc.AddReplaceCommand(EpgCmds.ChgOnOffCheck, (sender, e) => lstCtrl.ChgOnOffFromCheckbox(e.Parameter, EpgCmds.ChgOnOffKeyEnabled));

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

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

                //ボタンの設定
                mBinds.View = viewCode;
                mBinds.SetCommandToButton(button_add, EpgCmds.ShowAddDialog);
                mBinds.SetCommandToButton(button_change, EpgCmds.ShowDialog);
                mBinds.SetCommandToButton(button_del, EpgCmds.Delete);
                mBinds.SetCommandToButton(button_del2, EpgCmds.Delete2);

                //メニューの作成、ショートカットの登録
                //RefreshMenu();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
        }
コード例 #5
0
        public EpgListMainView()
        {
            InitializeComponent();

            //リストビュー関連の設定
            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.EpgListColumn)
                                , CommonUtil.NameOf(() => Settings.Instance.EpgListColumnHead)
                                , CommonUtil.NameOf(() => Settings.Instance.EpgListSortDirection));
            lstCtrl.SetViewSetting(listView_event, gridView_event, true, true, list_columns);
            lstCtrl.SetSelectedItemDoubleClick(EpgCmds.ShowDialog);

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

            //過去番組移動ボタン関係
            SetControlsPeriod(timeJumpView, timeMoveView, button_now);

            base.InitCommand();

            //コマンド集の初期化の続き
            mc.SetFuncGetSearchList(isAll => (isAll == true ? lstCtrl.dataList.ToList() : lstCtrl.GetSelectedItemsList()));
            mc.SetFuncSelectSingleSearchData((noChange) => lstCtrl.SelectSingleItem(noChange));
            mc.SetFuncReleaseSelectedData(() => listView_event.UnselectAll());

            //コマンド集に無いもの
            mc.AddReplaceCommand(EpgCmds.ChgOnOffCheck, (sender, e) => lstCtrl.ChgOnOffFromCheckbox(e.Parameter, EpgCmds.ChgOnOff));

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

            //コンテキストメニューの設定
            listView_event.ContextMenu.Tag     = (int)2;//setViewInfo.ViewMode;
            listView_event.ContextMenu.Opened += new RoutedEventHandler(mc.SupportContextMenuLoading);

            //その他の設定
            SelectableItem.Set_CheckBox_PreviewChanged(listBox_service, listBox_service_Click_SelectChange);
            this.IsVisibleChanged += (sender, e) => { if (IsVisible)
                                                      {
                                                          lastActivateClass = this.GetHashCode();
                                                      }
            };
        }
コード例 #6
0
        public EpgListMainView()
        {
            InitializeComponent();

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

            list_columns.AddRange(Resources["RecSettingViewColumns"] as GridViewColumnList);

            lstCtrl = new ListViewController <SearchItem>(this);
            lstCtrl.SetSavePath(CommonUtil.GetMemberName(() => Settings.Instance.EpgListColumn)
                                , CommonUtil.GetMemberName(() => Settings.Instance.EpgListColumnHead)
                                , CommonUtil.GetMemberName(() => Settings.Instance.EpgListSortDirection));
            lstCtrl.SetViewSetting(listView_event, gridView_event, true, true, list_columns);
            lstCtrl.SetSelectedItemDoubleClick(EpgCmds.ShowDialog);

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

            InitCommand();
        }
コード例 #7
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 CmdExeSearch(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.Add);
                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.Message + "\r\n" + ex.StackTrace); }
        }
コード例 #8
0
ファイル: SearchWindow.xaml.cs プロジェクト: nekopanda/EDCB
        public SearchWindow()
        {
            InitializeComponent();

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

                lstCtrl = new ListViewController <SearchItem>(this);
                lstCtrl.SetSavePath(CommonUtil.GetMemberName(() => Settings.Instance.SearchWndColumn)
                                    , CommonUtil.GetMemberName(() => Settings.Instance.SearchColumnHead)
                                    , CommonUtil.GetMemberName(() => 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(lstCtrl.SelectSingleItem);
                mc.SetFuncReleaseSelectedData(() => listView_result.UnselectAll());
                mc.recSettingView = this.recSettingView;

                //コマンド集に無いもの
                mc.AddReplaceCommand(EpgCmds.ReSearch, mc_Research);
                mc.AddReplaceCommand(EpgCmds.ReSearch2, mc_Research);
                mc.AddReplaceCommand(EpgCmds.Search, (sender, e) => SearchPg(true));
                mc.AddReplaceCommand(EpgCmds.AddInDialog, button_add_epgAutoAdd_Click);
                mc.AddReplaceCommand(EpgCmds.ChangeInDialog, button_chg_epgAutoAdd_Click, (sender, e) => e.CanExecute = winMode == SearchMode.Change);
                mc.AddReplaceCommand(EpgCmds.DeleteInDialog, button_del_epgAutoAdd_Click, (sender, e) => e.CanExecute = winMode == SearchMode.Change);
                mc.AddReplaceCommand(EpgCmds.UpItem, (sender, e) => button_up_down_Click(-1));
                mc.AddReplaceCommand(EpgCmds.DownItem, (sender, e) => button_up_down_Click(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, true));
                mc.AddReplaceCommand(EpgCmds.JumpTuner, (sender, e) => mc_JumpTab(CtxmCode.TunerReserveView, true, Settings.Instance.TunerDisplayOffReserve == false));
                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.Add);
                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_up_epgAutoAdd, EpgCmds.UpItem);
                mBinds.SetCommandToButton(button_down_epgAutoAdd, EpgCmds.DownItem);
                mBinds.AddInputCommand(EpgCmds.Cancel);//ショートカット登録

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

                //その他のショートカット(検索ダイアログ固有の設定)
                searchKeyView.InputBindings.Add(new InputBinding(EpgCmds.Search, new KeyGesture(Key.Enter)));

                //録画プリセット変更時の対応
                recSettingView.SelectedPresetChanged += new EventHandler(SetRecSettingTabHeader);

                //ウインドウ位置の復元
                if (Settings.Instance.SearchWndTop != -100)
                {
                    this.Top = Settings.Instance.SearchWndTop;
                }
                if (Settings.Instance.SearchWndLeft != -100)
                {
                    this.Left = Settings.Instance.SearchWndLeft;
                }
                if (Settings.Instance.SearchWndWidth > 0)
                {
                    this.Width = Settings.Instance.SearchWndWidth;
                }
                if (Settings.Instance.SearchWndHeight > 0)
                {
                    this.Height = Settings.Instance.SearchWndHeight;
                }
                checkBox_windowPinned.IsChecked = Settings.Instance.SearchWndPinned;

                SetSearchKey(Settings.Instance.DefSearchKey);
                SetRecSetting(Settings.Instance.RecPresetList[0].RecPresetData);

                //notify残ってれば更新。通常残ってないはず。
                ViewUtil.ReloadReserveData();

                //EPG自動予約登録と、登録された予約、および録画済みファイルとの関連付けを実装
                CommonManager.Instance.DB.EpgAutoAddUpdated += DB_EpgAutoAddUpdated;
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
        }
コード例 #9
0
        public void InitWindow(InfoSearchSettingData searchInfo, string searchWord = null, bool noSave = false)
        {
            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);
                mc.AddReplaceCommand(EpgCmds.SetRecTag, mc_SetRecTag);

                //ボタンの設定
                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();

                //その他設定
                checkBox_ShowToolTip.IsChecked = Settings.Instance.InfoSearchItemTooltip;
                DataContext = (searchInfo ?? Settings.Instance.InfoSearchData).DeepCloneObj();
                if (searchWord != null)
                {
                    SearchInfo.SearchWord = searchWord;
                }
                startSearch         = searchInfo != null || searchWord != null;
                noSearchSettingSave = noSave;

                //ステータスバーの登録
                StatusManager.RegisterStatusbar(this.statusBar, this);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
        }