Ejemplo n.º 1
0
        protected bool ReloadEpgData()
        {
            try
            {
                if (setViewInfo == null)
                {
                    return(true);
                }
                if (CommonManager.Instance.IsConnected == false)
                {
                    return(false);
                }

                if (setViewInfo.SearchMode == false)
                {
                    ErrCode err = CommonManager.Instance.DB.ReloadEpgData();
                    if (CommonManager.CmdErrMsgTypical(err, "EPGデータの取得") == false)
                    {
                        return(false);
                    }
                    serviceEventList = new Dictionary <UInt64, EpgServiceEventInfo>(CommonManager.Instance.DB.ServiceEventList);
                }
                else
                {
                    //番組情報の検索
                    var list = new List <EpgEventInfo>();
                    EpgSearchKeyInfo setKey = setViewInfo.SearchKey.Clone();
                    if (setViewInfo.SearchServiceFromView == true)
                    {
                        setKey.serviceList = setViewInfo.ViewServiceList.Select(sv => (long)sv).ToList();
                    }
                    ErrCode err = cmd.SendSearchPg(CommonUtil.ToList(setKey), ref list);
                    if (CommonManager.CmdErrMsgTypical(err, "EPGデータの取得") == false)
                    {
                        return(false);
                    }

                    //サービス毎のリストに変換
                    serviceEventList = new Dictionary <UInt64, EpgServiceEventInfo>();
                    foreach (EpgEventInfo eventInfo in list)
                    {
                        UInt64 id = eventInfo.Create64Key();
                        EpgServiceEventInfo serviceInfo;
                        if (serviceEventList.TryGetValue(id, out serviceInfo) == false)
                        {
                            if (ChSet5.ChList.ContainsKey(id) == false)
                            {
                                //サービス情報ないので無効
                                continue;
                            }
                            serviceInfo             = new EpgServiceEventInfo();
                            serviceInfo.serviceInfo = CommonManager.ConvertChSet5To(ChSet5.ChList[id]);

                            serviceEventList.Add(id, serviceInfo);
                        }
                        serviceInfo.eventList.Add(eventInfo);
                    }
                }

                return(true);
            }
            catch (Exception ex) { CommonUtil.DispatcherMsgBoxShow(ex.Message + "\r\n" + ex.StackTrace); }
            return(false);
        }