Example #1
0
        protected override void MoveToProgramItem(EpgEventInfo target, bool IsMarking)
        {
            ulong      PgKey       = target.Create64PgKey();
            SearchItem target_item = lstCtrl.dataList.Find(item => item.EventInfo.Create64PgKey() == PgKey);

            ViewUtil.ScrollToFindItem(target_item, listView_event, IsMarking);
        }
Example #2
0
        public void AddReserveEventCache(ReserveData res, EpgEventInfo info)
        {
            if (info == null || res == null || res is ReserveDataEnd || res.ReserveID == 0)
            {
                return;
            }

            //キャッシュが無い場合は生成
            EpgEventInfo cacheInfo = GetReserveEventList(res);

            if (reserveEventList == null || info.IsSamePg(cacheInfo))
            {
                return;
            }

            reserveEventListCache = reserveEventListCache ?? new Dictionary <ulong, EpgEventInfo>();
            reserveEventListCache[info.Create64PgKey()] = info;
            reserveEventList[res.ReserveID]             = info;
        }
Example #3
0
        public EpgEventInfo GetReserveEventList(ReserveData master, bool isSrv = true)
        {
            if (master == null || master.ReserveID == 0)
            {
                return(null);
            }

            if (reserveEventList == null)
            {
                if (IsEpgLoaded || Settings.Instance.NoReserveEventList == true)
                {
                    reserveEventList = ReserveList.Values.ToDictionary(rs => rs.ReserveID,
                                                                       rs => rs.IsEpgReserve ? MenuUtil.GetPgInfoUid(rs.CurrentPgUID()) : MenuUtil.GetPgInfoLikeThat(rs));
                }
                else
                {
                    reserveEventList      = new Dictionary <uint, EpgEventInfo>();
                    reserveEventListCache = reserveEventListCache ?? new Dictionary <ulong, EpgEventInfo>();

                    //要求はしないが、有効なデータが既に存在していればキーワード予約の追加データを参照する。
                    bool useAppend = epgAutoAddAppendList != null && updateEpgAutoAddAppend == false &&
                                     updateEpgAutoAddAppendReserveInfo == false;

                    //プログラム予約はここで探しても精度低いので諦める
                    var trgList = new List <ReserveData>();
                    foreach (ReserveData data in ReserveList.Values.Where(r => r.IsEpgReserve))
                    {
                        EpgEventInfo info = null;
                        ulong        key  = data.Create64PgKey();
                        if (useAppend == true)
                        {
                            List <EpgAutoAddData> epgAutoList = data.GetEpgAutoAddList();
                            if (epgAutoList.Count != 0)
                            {
                                SearchItem item = epgAutoList[0].GetSearchList()
                                                  .Find(sI => sI.IsReserved == true && sI.ReserveInfo.ReserveID == data.ReserveID);
                                if (item != null)
                                {
                                    info = item.EventInfo;
                                    reserveEventListCache[key] = info;
                                }
                            }
                        }
                        if (info != null || reserveEventListCache.TryGetValue(key, out info))
                        {
                            reserveEventList[data.ReserveID] = info;
                        }
                        else
                        {
                            trgList.Add(data);
                        }
                    }

                    if (isSrv == true && trgList.Any())
                    {
                        var pgIDset = trgList.ToLookup(data => data.Create64PgKey(), data => data.ReserveID);
                        var keys    = pgIDset.Select(lu => lu.Key).ToList();
                        var list    = new List <EpgEventInfo>();
                        try { CommonManager.CreateSrvCtrl().SendGetPgInfoList(keys, ref list); } catch { }

                        foreach (EpgEventInfo info in list)
                        {
                            ulong key = info.Create64PgKey();
                            if (pgIDset.Contains(key) == true)
                            {
                                foreach (uint rID in pgIDset[key])
                                {
                                    reserveEventList[rID] = info;
                                }
                                reserveEventListCache[key] = info;
                            }
                        }
                    }
                }
            }

            EpgEventInfo retv;

            reserveEventList.TryGetValue(master.ReserveID, out retv);
            return(retv);
        }