Exemple #1
0
        public EpgDataViewSetting()
        {
            InitializeComponent();

            comboBox_timeH_week.ItemsSource   = Enumerable.Range(0, 24);
            comboBox_timeH_week.SelectedIndex = 4;

            for (int i = 0; i < 5; i++)
            {
                ListBox target = i == 0 ? listBox_serviceTere :
                                 i == 1 ? listBox_serviceBS :
                                 i == 2 ? listBox_serviceCS :
                                 i == 3 ? listBox_serviceCS3 : listBox_serviceOther;
                target.Items.Add(new Tuple <string, ulong>("[" + ((TabItem)target.Parent).Header + "]",
                                                           (ulong)(i == 0 ? CustomEpgTabInfo.SpecialViewServices.ViewServiceDttv :
                                                                   i == 1 ? CustomEpgTabInfo.SpecialViewServices.ViewServiceBS :
                                                                   i == 2 ? CustomEpgTabInfo.SpecialViewServices.ViewServiceCS :
                                                                   i == 3 ? CustomEpgTabInfo.SpecialViewServices.ViewServiceCS3 :
                                                                   CustomEpgTabInfo.SpecialViewServices.ViewServiceOther)));
                foreach (ChSet5Item info in ChSet5.Instance.ChListSelected)
                {
                    if (i == 0 && ChSet5.IsDttv(info.ONID) ||
                        i == 1 && ChSet5.IsBS(info.ONID) ||
                        i == 2 && ChSet5.IsCS(info.ONID) ||
                        i == 3 && ChSet5.IsCS3(info.ONID) ||
                        i == 4 && ChSet5.IsOther(info.ONID))
                    {
                        target.Items.Add(new Tuple <string, ulong>(info.ServiceName, info.Key));
                    }
                }
            }
            listBox_jyanru.ItemsSource = CommonManager.Instance.ContentKindList;
        }
 private void button_other_on2_Click(object sender, RoutedEventArgs e)
 {
     foreach (ServiceItem info in listView_service.Items)
     {
         if (ChSet5.IsOther(info.ServiceInfo.ONID) == true)
         {
             info.IsSelected = true;
         }
     }
 }
Exemple #3
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);
        }
Exemple #4
0
        private void ReloadProgramViewItem(bool enablePrev, bool enableNext)
        {
            try
            {
                if (listBox_service.ItemsSource != null)
                {
                    foreach (ServiceItem info in listBox_service.ItemsSource)
                    {
                        lastChkSID[info.ID] = info.IsSelected;
                    }
                }
                listBox_service.ItemsSource = null;
                var serviceList = new List <ServiceItem>();

                //特殊なサービス指定の展開と重複除去
                var viewIDList = new List <ulong>();
                foreach (ulong id in setViewInfo.ViewServiceList)
                {
                    IEnumerable <EpgServiceAllEventInfo> sel =
                        id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceDttv ?
                        serviceEventList.Values.Where(info => ChSet5.IsDttv(info.serviceInfo.ONID)) :
                        id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceBS ?
                        serviceEventList.Values.Where(info => ChSet5.IsBS(info.serviceInfo.ONID)) :
                        id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceCS ?
                        serviceEventList.Values.Where(info => ChSet5.IsCS(info.serviceInfo.ONID)) :
                        id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceCS3 ?
                        serviceEventList.Values.Where(info => ChSet5.IsCS3(info.serviceInfo.ONID)) :
                        id == (ulong)CustomEpgTabInfo.SpecialViewServices.ViewServiceOther ?
                        serviceEventList.Values.Where(info => ChSet5.IsOther(info.serviceInfo.ONID)) : null;
                    if (sel == null)
                    {
                        if (viewIDList.Contains(id) == false)
                        {
                            viewIDList.Add(id);
                        }
                        continue;
                    }
                    foreach (EpgServiceInfo info in DBManager.SelectServiceEventList(sel).Select(allInfo => allInfo.serviceInfo))
                    {
                        if (viewIDList.Contains(CommonManager.Create64Key(info.ONID, info.TSID, info.SID)) == false)
                        {
                            viewIDList.Add(CommonManager.Create64Key(info.ONID, info.TSID, info.SID));
                        }
                    }
                }
                for (int i = 0; i < viewIDList.Count;)
                {
                    //TSIDが同じでSIDが逆順のときは正順にする
                    int skip = i + 1;
                    while (viewIDList.Count > skip &&
                           viewIDList[skip] >> 16 == viewIDList[skip - 1] >> 16 &&
                           (viewIDList[skip] & 0xFFFF) < (viewIDList[skip - 1] & 0xFFFF))
                    {
                        skip++;
                    }
                    for (int j = skip - 1; j >= i; j--)
                    {
                        ulong id = viewIDList[j];
                        if (serviceEventList.ContainsKey(id))
                        {
                            var item = new ServiceItem(serviceEventList[id].serviceInfo);
                            item.IsSelected = lastChkSID.ContainsKey(id) == false || lastChkSID[id];
                            serviceList.Add(item);
                        }
                    }
                    i = skip;
                }
                listBox_service.ItemsSource = serviceList;
                button_prev.IsEnabled       = enablePrev;
                button_next.IsEnabled       = enableNext;

                UpdateEventList();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #5
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);
        }