EpgWeekMainView.xaml の相互作用ロジック
Inheritance: EpgTimer.EpgView.EpgMainViewBase
Ejemplo n.º 1
0
        public void SetContent(bool reloadInfo = false)
        {
            for (int mode = 0; mode < 3; mode++)
            {
                if (vItems.ContainsKey(mode) == false && isStockView(mode) == true)
                {
                    switch (mode)
                    {
                    case 1:    //1週間表示
                        vItems[mode] = new EpgWeekMainView();
                        break;

                    case 2:    //リスト表示
                        vItems[mode] = new EpgListMainView();
                        break;

                    default:    //標準ラテ欄表示
                        vItems[mode] = new EpgMainView();
                        break;
                    }
                    vItems[mode].SetViewData(viewData, mode);
                    vItems[mode].SetViewState(vStates[mode]);
                    vStates[mode] = null;
                    if (reloadInfo == false)
                    {
                        vItems[mode].UpdateInfo();
                    }
                }
            }
            if (reloadInfo == true)
            {
                CleanUpContent();
                viewData.ClearEventList();
                foreach (var v in vItems)
                {
                    v.Value.UpdateInfo();
                }
            }

            //ストックするものとRenderさせるものは異なる。PrebuildEpgAllのときだけ全てのRenderを走らせる。
            //この際タブの表示オプションに応じて選択する必要があるが、実際のRender(UpdateInfo())時には
            //不要なものは排除されているので細かく考慮する必要が無い。(PrebuildEpg==false時も同様)
            foreach (var v in vItems.Values)
            {
                v.Visibility = v == view ? Visibility.Visible : Visibility.Hidden;
                if (Settings.Instance.PrebuildEpgAll == true || IsSelected == true && v == view)
                {
                    if (grid.Children.Contains(v) == false)
                    {
                        grid.Children.Add(v);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void item_ViewModeChangeRequested(object sender, CustomEpgTabInfo info, DateTime baseTime, object scrollToTarget)
 {
     foreach (TabItem tabItem in tabControl.Items)
     {
         if (tabItem.Content == sender)
         {
             //情報クリア
             if (tabItem.Content is EpgListMainView)
             {
                 ((EpgListMainView)tabItem.Content).ClearInfo();
             }
             else if (tabItem.Content is EpgMainView)
             {
                 ((EpgMainView)tabItem.Content).ClearInfo();
             }
             else if (tabItem.Content is EpgWeekMainView)
             {
                 ((EpgWeekMainView)tabItem.Content).ClearInfo();
             }
             if (info.ViewMode == 1)
             {
                 //1週間表示
                 var epgView = new EpgWeekMainView(info, baseTime);
                 epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                 tabItem.Content = epgView;
                 epgView.ScrollTo(scrollToTarget, false);
             }
             else if (info.ViewMode == 2)
             {
                 //リスト表示
                 var epgView = new EpgListMainView(info, baseTime);
                 epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                 tabItem.Content = epgView;
             }
             else
             {
                 //標準ラテ欄表示
                 var epgView = new EpgMainView(info, baseTime);
                 epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                 tabItem.Content = epgView;
                 epgView.ScrollTo(scrollToTarget, false);
             }
             break;
         }
     }
 }
Ejemplo n.º 3
0
 public void UpdateEpgData()
 {
     if (viewCtrl != null)
     {
         if (viewCtrl.GetType() == typeof(EpgListMainView))
         {
             EpgListMainView item = viewCtrl as EpgListMainView;
             item.UpdateEpgData();
         }
         else if (viewCtrl.GetType() == typeof(EpgMainView))
         {
             EpgMainView item = viewCtrl as EpgMainView;
             item.UpdateEpgData();
         }
         else if (viewCtrl.GetType() == typeof(EpgWeekMainView))
         {
             EpgWeekMainView item = viewCtrl as EpgWeekMainView;
             item.UpdateEpgData();
         }
     }
 }
Ejemplo n.º 4
0
 public void ClearInfo()
 {
     //情報クリア
     if (viewCtrl != null)
     {
         if (viewCtrl.GetType() == typeof(EpgListMainView))
         {
             EpgListMainView item = viewCtrl as EpgListMainView;
             item.ClearInfo();
         }
         else if (viewCtrl.GetType() == typeof(EpgMainView))
         {
             EpgMainView item = viewCtrl as EpgMainView;
             item.ClearInfo();
         }
         else if (viewCtrl.GetType() == typeof(EpgWeekMainView))
         {
             EpgWeekMainView item = viewCtrl as EpgWeekMainView;
             item.ClearInfo();
         }
     }
     grid_main.Children.Clear();
     viewCtrl = null;
 }
Ejemplo n.º 5
0
 public StateWeekMain(EpgWeekMainView view) : base(view)
 {
     selectID = view.GetSelectID();
 }
Ejemplo n.º 6
0
        /// <summary>
        /// EPGデータの表示モードを設定する
        /// </summary>
        /// <param name="setInfo">[IN]表示モードの設定値</param>
        public void SetViewMode(CustomEpgTabInfo setInfo)
        {
            if (viewInfo != null && viewCtrl != null)
            {
                if (viewInfo.ViewMode == setInfo.ViewMode)
                {
                    //表示モード一緒で、絞り込み内容変化
                    if (viewCtrl.GetType() == typeof(EpgListMainView))
                    {
                        EpgListMainView item = viewCtrl as EpgListMainView;
                        item.SetViewMode(setInfo);
                    }
                    else if (viewCtrl.GetType() == typeof(EpgMainView))
                    {
                        EpgMainView item = viewCtrl as EpgMainView;
                        item.SetViewMode(setInfo);
                    }
                    else if (viewCtrl.GetType() == typeof(EpgWeekMainView))
                    {
                        EpgWeekMainView item = viewCtrl as EpgWeekMainView;
                        item.SetViewMode(setInfo);
                    }

                    viewInfo = setInfo;
                    return;
                }
            }
            viewInfo = setInfo;

            //情報クリア
            if (viewCtrl != null)
            {
                if (viewCtrl.GetType() == typeof(EpgListMainView))
                {
                    EpgListMainView item = viewCtrl as EpgListMainView;
                    item.ClearInfo();
                }
                else if (viewCtrl.GetType() == typeof(EpgMainView))
                {
                    EpgMainView item = viewCtrl as EpgMainView;
                    item.ClearInfo();
                }
                else if (viewCtrl.GetType() == typeof(EpgWeekMainView))
                {
                    EpgWeekMainView item = viewCtrl as EpgWeekMainView;
                    item.ClearInfo();
                }
            }
            grid_main.Children.Clear();
            viewCtrl = null;


            switch (setInfo.ViewMode)
            {
                case 1:
                    //1週間表示
                    {
                        EpgWeekMainView item = new EpgWeekMainView();
                        item.ViewSettingClick += new ViewSettingClickHandler(item_ViewSettingClick);
                        item.SetViewMode(setInfo);
                        grid_main.Children.Add(item);
                        viewCtrl = item;
                    }
                    break;
                case 2:
                    //リスト表示
                    {
                        EpgListMainView item = new EpgListMainView();
                        item.ViewSettingClick += new ViewSettingClickHandler(item_ViewSettingClick);
                        item.SetViewMode(setInfo);
                        grid_main.Children.Add(item);
                        viewCtrl = item;
                    }
                    break;
                default:
                    //標準ラテ欄表示
                    {
                        EpgMainView item = new EpgMainView();
                        item.ViewSettingClick += new ViewSettingClickHandler(item_ViewSettingClick);
                        item.SetViewMode(setInfo);
                        grid_main.Children.Add(item);
                        viewCtrl = item;
                    }
                    break;
            }
        }
Ejemplo n.º 7
0
        public void CreateContent(CustomEpgTabInfo setInfo = null, EpgViewState state = null, int?viewMode = null)
        {
            bool update = setInfo != null;

            if (setInfo != null)
            {
                Info = setInfo;
            }
            if (viewMode != null)
            {
                Info.ViewMode = (int)viewMode;
            }

            //表示中のものはデータを保存して非表示に
            if (view != null)
            {
                view.SaveViewData();
            }
            if (view != null)
            {
                view.Visibility = Visibility.Collapsed;
            }

            //Updateかかる場合はストックをクリア
            if (setInfo != null)
            {
                UpdateInfo();
            }

            if (vItems.ContainsKey(Info.ViewMode) == true)
            {
                view = vItems[Info.ViewMode];
            }
            else
            {
                switch (Info.ViewMode)
                {
                case 1:    //1週間表示
                    view = new EpgWeekMainView();
                    break;

                case 2:    //リスト表示
                    view = new EpgListMainView();
                    break;

                default:    //標準ラテ欄表示
                    view = new EpgMainView();
                    break;
                }
                if (state == null)
                {
                    vStates.TryGetValue(Info.ViewMode, out state);
                }
                view.SetViewState(state);
                view.ViewSettingClick += viewSettingClick;
                view.SetViewData(viewData);
                vItems[Info.ViewMode] = view;
                vStates.Remove(Info.ViewMode);
            }
            AddViewDataToGrid();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// タブ生成
        /// </summary>
        private bool CreateTabItem()
        {
            {
                List <CustomEpgTabInfo> defaultList = null;
                if (Settings.Instance.UseCustomEpgView == false)
                {
                    defaultList = new List <CustomEpgTabInfo>();
                    if (CommonManager.Instance.NWMode && CommonManager.Instance.NWConnectedIP == null)
                    {
                        return(false);
                    }
                    ErrCode err = CommonManager.Instance.DB.ReloadEpgData();
                    if (err != ErrCode.CMD_SUCCESS)
                    {
                        if (IsVisible && err != ErrCode.CMD_ERR_BUSY)
                        {
                            Dispatcher.BeginInvoke(new Action(() => MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "EPGデータの取得でエラーが発生しました。")));
                        }
                        return(false);
                    }

                    //デフォルト表示
                    for (int i = 0; i < 5; i++)
                    {
                        var setInfo = new CustomEpgTabInfo();
                        foreach (EpgServiceInfo info in CommonManager.Instance.DB.ServiceEventList.Values.Select(allInfo => allInfo.serviceInfo))
                        {
                            if (Settings.Instance.ShowEpgCapServiceOnly &&
                                (ChSet5.Instance.ChList.ContainsKey(CommonManager.Create64Key(info.ONID, info.TSID, info.SID)) == false ||
                                 ChSet5.Instance.ChList[CommonManager.Create64Key(info.ONID, info.TSID, info.SID)].EpgCapFlag == false))
                            {
                                continue;
                            }
                            if (i == 0 && ChSet5.IsDttv(info.ONID))
                            {
                                setInfo.TabName = "地デジ";
                                setInfo.ViewServiceList.Add((ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceDttv);
                            }
                            else if (i == 1 && ChSet5.IsBS(info.ONID))
                            {
                                setInfo.TabName = "BS";
                                setInfo.ViewServiceList.Add((ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceBS);
                            }
                            else if (i == 2 && ChSet5.IsCS(info.ONID) && ChSet5.IsCS3(info.ONID) == false)
                            {
                                setInfo.TabName = "CS";
                                setInfo.ViewServiceList.Add((ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceCS);
                            }
                            else if (i == 3 && ChSet5.IsCS3(info.ONID))
                            {
                                setInfo.TabName = "CS3";
                                setInfo.ViewServiceList.Add((ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceCS3);
                            }
                            else if (i == 4 && ChSet5.IsOther(info.ONID))
                            {
                                setInfo.TabName = "その他";
                                setInfo.ViewServiceList.Add((ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceOther);
                            }
                            else
                            {
                                continue;
                            }
                            defaultList.Add(setInfo);
                            break;
                        }
                    }
                }
                foreach (CustomEpgTabInfo info in defaultList ?? Settings.Instance.CustomEpgTabList)
                {
                    var tabItem = new TabItem();
                    tabItem.Header = info.TabName;
                    if (info.ViewMode == 1)
                    {
                        //1週間表示
                        var epgView = new EpgWeekMainView(info, DateTime.MaxValue);
                        epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                        tabItem.Content = epgView;
                    }
                    else if (info.ViewMode == 2)
                    {
                        //リスト表示
                        var epgView = new EpgListMainView(info, DateTime.MaxValue);
                        epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                        tabItem.Content = epgView;
                    }
                    else
                    {
                        //標準ラテ欄表示
                        var epgView = new EpgMainView(info, DateTime.MaxValue);
                        epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                        tabItem.Content = epgView;
                    }
                    tabControl.Items.Add(tabItem);
                }
                if (tabControl.Items.Count > 0)
                {
                    tabControl.SelectedIndex = 0;
                }
            }
            return(true);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// EPGデータの表示モードを設定する
        /// </summary>
        /// <param name="setInfo">[IN]表示モードの設定値</param>
        public void SetViewMode(CustomEpgTabInfo setInfo)
        {
            if (viewInfo != null && viewCtrl != null)
            {
                if (viewInfo.ViewMode == setInfo.ViewMode)
                {
                    //表示モード一緒で、絞り込み内容変化
                    if (viewCtrl.GetType() == typeof(EpgListMainView))
                    {
                        EpgListMainView item = viewCtrl as EpgListMainView;
                        item.SetViewMode(setInfo);
                    }
                    else if (viewCtrl.GetType() == typeof(EpgMainView))
                    {
                        EpgMainView item = viewCtrl as EpgMainView;
                        item.SetViewMode(setInfo);
                    }
                    else if (viewCtrl.GetType() == typeof(EpgWeekMainView))
                    {
                        EpgWeekMainView item = viewCtrl as EpgWeekMainView;
                        item.SetViewMode(setInfo);
                    }

                    viewInfo = setInfo;
                    return;
                }
            }
            viewInfo = setInfo;

            //情報クリア
            if (viewCtrl != null)
            {
                if (viewCtrl.GetType() == typeof(EpgListMainView))
                {
                    EpgListMainView item = viewCtrl as EpgListMainView;
                    item.ClearInfo();
                }
                else if (viewCtrl.GetType() == typeof(EpgMainView))
                {
                    EpgMainView item = viewCtrl as EpgMainView;
                    item.ClearInfo();
                }
                else if (viewCtrl.GetType() == typeof(EpgWeekMainView))
                {
                    EpgWeekMainView item = viewCtrl as EpgWeekMainView;
                    item.ClearInfo();
                }
            }
            grid_main.Children.Clear();
            viewCtrl = null;


            switch (setInfo.ViewMode)
            {
            case 1:
                //1週間表示
            {
                EpgWeekMainView item = new EpgWeekMainView();
                item.ViewSettingClick += new ViewSettingClickHandler(item_ViewSettingClick);
                item.SetViewMode(setInfo);
                grid_main.Children.Add(item);
                viewCtrl = item;
            }
            break;

            case 2:
                //リスト表示
            {
                EpgListMainView item = new EpgListMainView();
                item.ViewSettingClick += new ViewSettingClickHandler(item_ViewSettingClick);
                item.SetViewMode(setInfo);
                grid_main.Children.Add(item);
                viewCtrl = item;
            }
            break;

            default:
                //標準ラテ欄表示
            {
                EpgMainView item = new EpgMainView();
                item.ViewSettingClick += new ViewSettingClickHandler(item_ViewSettingClick);
                item.SetViewMode(setInfo);
                grid_main.Children.Add(item);
                viewCtrl = item;
            }
            break;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// タブ生成
        /// </summary>
        private bool CreateTabItem()
        {
            {
                List <CustomEpgTabInfo> defaultList = null;
                if (Settings.Instance.UseCustomEpgView == false)
                {
                    defaultList = new List <CustomEpgTabInfo>();
                    if (CommonManager.Instance.NWMode && CommonManager.Instance.NWConnectedIP == null)
                    {
                        return(false);
                    }
                    ErrCode err = CommonManager.Instance.DB.ReloadEpgData();
                    if (err != ErrCode.CMD_SUCCESS)
                    {
                        if (IsVisible && err != ErrCode.CMD_ERR_BUSY)
                        {
                            Dispatcher.BeginInvoke(new Action(() =>
                            {
                                MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "EPGデータの取得でエラーが発生しました。EPGデータが読み込まれていない可能性があります。");
                            }));
                        }
                        return(false);
                    }

                    //デフォルト表示
                    bool ignoreEpgCap = Settings.Instance.ShowEpgCapServiceOnly == false;
                    IEnumerable <EpgServiceInfo> sel = CommonManager.Instance.DB.ServiceEventList.Values.Select(info => info.serviceInfo).Where(info => {
                        ulong key = CommonManager.Create64Key(info.ONID, info.TSID, info.SID);
                        return(ignoreEpgCap || ChSet5.Instance.ChList.ContainsKey(key) && ChSet5.Instance.ChList[key].EpgCapFlag);
                    });
                    //リモコンキー優先のID順ソート。BSはなるべくSID順
                    var bsmin = new Dictionary <ushort, ushort>();
                    foreach (EpgServiceInfo info in sel)
                    {
                        if (ChSet5.IsBS(info.ONID) && (bsmin.ContainsKey(info.TSID) == false || bsmin[info.TSID] > info.SID))
                        {
                            bsmin[info.TSID] = info.SID;
                        }
                    }
                    sel = sel.OrderBy(info => (ulong)(ChSet5.IsDttv(info.ONID) ? (info.remote_control_key_id + 255) % 256 : 0) << 48 |
                                      CommonManager.Create64Key(info.ONID, (ChSet5.IsBS(info.ONID) ? bsmin[info.TSID] : info.TSID), info.SID));
                    for (int i = 0; i < 5; i++)
                    {
                        CustomEpgTabInfo setInfo = null;
                        foreach (EpgServiceInfo info in sel)
                        {
                            string tabName = null;
                            if (i == 0 && ChSet5.IsDttv(info.ONID))
                            {
                                tabName = "地デジ";
                            }
                            else if (i == 1 && ChSet5.IsBS(info.ONID))
                            {
                                tabName = "BS";
                            }
                            else if (i == 2 && ChSet5.IsCS(info.ONID) && ChSet5.IsCS3(info.ONID) == false)
                            {
                                tabName = "CS";
                            }
                            else if (i == 3 && ChSet5.IsCS3(info.ONID))
                            {
                                tabName = "CS3";
                            }
                            else if (i == 4 && ChSet5.IsOther(info.ONID))
                            {
                                tabName = "その他";
                            }
                            if (tabName != null)
                            {
                                if (setInfo == null)
                                {
                                    setInfo         = new CustomEpgTabInfo();
                                    setInfo.TabName = tabName;
                                }
                                setInfo.ViewServiceList.Add(CommonManager.Create64Key(info.ONID, info.TSID, info.SID));
                            }
                        }
                        if (setInfo != null)
                        {
                            defaultList.Add(setInfo);
                        }
                    }
                }
                foreach (CustomEpgTabInfo info in defaultList ?? Settings.Instance.CustomEpgTabList)
                {
                    var tabItem = new TabItem();
                    tabItem.Header = info.TabName;
                    if (info.ViewMode == 1)
                    {
                        //1週間表示
                        var epgView = new EpgWeekMainView(info);
                        epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                        tabItem.Content = epgView;
                    }
                    else if (info.ViewMode == 2)
                    {
                        //リスト表示
                        var epgView = new EpgListMainView(info);
                        epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                        tabItem.Content = epgView;
                    }
                    else
                    {
                        //標準ラテ欄表示
                        var epgView = new EpgMainView(info);
                        epgView.ViewModeChangeRequested += item_ViewModeChangeRequested;
                        tabItem.Content = epgView;
                    }
                    tabControl.Items.Add(tabItem);
                }
                if (tabControl.Items.Count > 0)
                {
                    tabControl.SelectedIndex = 0;
                }
            }
            return(true);
        }