Ejemplo n.º 1
0
 /// <summary>サービス2やサービス3の結合されているもののメインイベント取得 </summary>
 public EpgEventInfo GetGroupMainEvent()
 {
     if (IsGroupMainEvent == true)
     {
         return(this);
     }
     if (EventGroupInfo.group_type != 1)
     {
         return(null);
     }
     return(EventGroupInfo.eventDataList.Select(data => MenuUtil.SearchEventInfo(data.Create64PgKey()))
            .FirstOrDefault(data => data != null && data.IsGroupMainEvent == true));
 }
Ejemplo n.º 2
0
        public EpgEventInfo SearchEventInfo(bool getSrv = false)
        {
            EpgEventInfo eventInfo = null;

            try
            {
                if (IsEpgReserve == true)
                {
                    eventInfo = MenuUtil.SearchEventInfo(this.Create64PgKey());
                    if (eventInfo == null && getSrv == true)
                    {
                        eventInfo = new EpgEventInfo();
                        CommonManager.CreateSrvCtrl().SendGetPgInfo(Create64PgKey(), ref eventInfo);
                    }
                }
                else
                {
                    eventInfo = SearchEventInfoLikeThat();
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
            return(eventInfo);
        }
Ejemplo n.º 3
0
        public EpgEventInfo GetReserveEventList(ReserveData master)
        {
            if (master == null)
            {
                return(null);
            }

            if (reserveEventList == null)
            {
                if (ServiceEventList.Count != 0 && IsNotifyRegistered(UpdateNotifyItem.EpgData) == false || Settings.Instance.NoReserveEventList == true)
                {
                    reserveEventList = ReserveList.Values.ToDictionary(rs => rs.ReserveID,
                                                                       rs => rs.IsEpgReserve == true ? MenuUtil.SearchEventInfo(rs.Create64PgKey()) : rs.SearchEventInfoLikeThat());
                }
                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)
                    {
                        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);
                        }
                        if (info != null)
                        {
                            reserveEventList[data.ReserveID] = info;
                        }
                        else
                        {
                            trgList.Add(data);
                        }
                    }

                    var pgIDset = trgList.ToLookup(data => data.Create64PgKey(), data => data.ReserveID);
                    if (pgIDset.Any() == true)
                    {
                        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);
        }