Exemplo n.º 1
0
        /// <summary>
        /// 予約情報の再描画
        /// </summary>
        protected override void ReloadReserveViewItem()
        {
            try
            {
                reserveList.Clear();

                if (comboBox_service.Items.Count == 0)
                {
                    return;
                }

                UInt64 selectID = GetSelectID(true);

                foreach (ReserveData info in CommonManager.Instance.DB.ReserveList.Values)
                {
                    if (selectID == info.Create64Key())
                    {
                        //timeListは番組表ベースなので、chkStartTimeはマージン適用前に作成する。
                        DateTime startTime     = GetWeekMainViewTime(info.StartTime);
                        DateTime chkStartTime  = GetWeekMainViewTime(startTime, TimeSelect.HourOnly);
                        DateTime baseStartTime = startTime;

                        //離れた時間のプログラム予約など、番組表が無いので表示不可
                        if (timeList.ContainsKey(chkStartTime) == false)
                        {
                            continue;
                        }

                        //マージンを適用
                        Int32 duration = (Int32)info.DurationSecond;
                        ViewUtil.ApplyMarginForPanelView(info, ref startTime, ref duration);

                        var viewItem = new ReserveViewItem(info);
                        reserveList.Add(viewItem);

                        DateTime chkDay = GetWeekMainViewTime(info.StartTime, TimeSelect.DayOnly);
                        viewItem.LeftPos = Settings.Instance.ServiceWidth * dayList.IndexOfKey(chkDay);
                        viewItem.Width   = Settings.Instance.ServiceWidth;

                        //最低表示行数の適用の際、最低表示高さを設定しているので、Settings.Instance.MinimumHeight == 0 でも検索するようにする
                        ProgramViewItem pgInfo = null;
                        if (info.IsEpgReserve == true && info.DurationSecond != 0)
                        {
                            //予約情報から番組情報を特定し、枠表示位置を再設定する
                            UInt64 key = info.Create64PgKey();
                            pgInfo = timeList[chkStartTime].Find(info1 => key == info1.EventInfo.Create64PgKey());
                        }

                        if (pgInfo != null)
                        {
                            viewItem.TopPos = pgInfo.TopPos + pgInfo.Height * (startTime - baseStartTime).TotalSeconds / info.DurationSecond;
                            viewItem.Height = Math.Max(pgInfo.Height * duration / info.DurationSecond, ViewUtil.PanelMinimumHeight);
                        }
                        else
                        {
                            int index = timeList.IndexOfKey(chkStartTime);
                            viewItem.TopPos = Settings.Instance.MinHeight * (index * 60 + (startTime - chkStartTime).TotalMinutes);
                            viewItem.Height = Math.Max(duration * Settings.Instance.MinHeight / 60, ViewUtil.PanelMinimumHeight);
                        }
                    }
                }
                epgProgramView.SetReserveList(reserveList);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 予約情報の再描画
        /// </summary>
        protected override void ReloadReserveViewItem()
        {
            try
            {
                reserveList.Clear();

                foreach (ReserveData info in CommonManager.Instance.DB.ReserveList.Values)
                {
                    int mergePos   = 0;
                    int mergeNum   = 0;
                    int servicePos = -1;
                    for (int i = 0; i < serviceList.Count; i++)
                    {
                        //TSIDが同じでSIDが逆順に登録されているときは併合する
                        if (--mergePos < i - mergeNum)
                        {
                            EpgServiceInfo curr = serviceList[i];
                            for (mergePos = i; mergePos + 1 < serviceList.Count; mergePos++)
                            {
                                EpgServiceInfo next = serviceList[mergePos + 1];
                                if (next.ONID != curr.ONID || next.TSID != curr.TSID || next.SID >= curr.SID)
                                {
                                    break;
                                }
                                curr = next;
                            }
                            mergeNum = mergePos + 1 - i;
                            servicePos++;
                        }
                        if (serviceList[mergePos].Create64Key() == info.Create64Key())
                        {
                            //timeListは番組表ベースなので、chkStartTimeはマージン適用前に作成する。
                            DateTime startTime    = info.StartTime;
                            DateTime chkStartTime = new DateTime(startTime.Year, startTime.Month, startTime.Day, startTime.Hour, 0, 0);

                            //離れた時間のプログラム予約など、番組表が無いので表示不可
                            if (timeList.ContainsKey(chkStartTime) == false)
                            {
                                break;
                            }

                            //マージンを適用
                            Int32 duration = (Int32)info.DurationSecond;
                            ViewUtil.ApplyMarginForPanelView(info, ref startTime, ref duration);

                            var viewItem = new ReserveViewItem(info);
                            reserveList.Add(viewItem);

                            viewItem.LeftPos = Settings.Instance.ServiceWidth * (servicePos + (double)((mergeNum + i - mergePos - 1) / 2) / mergeNum);

                            //最低表示行数の適用の際、最低表示高さを設定しているので、Settings.Instance.MinimumHeight == 0 でも検索するようにする
                            ProgramViewItem pgInfo = null;
                            if (info.IsEpgReserve == true && info.DurationSecond != 0)
                            {
                                //予約情報から番組情報を特定し、枠表示位置を再設定する
                                UInt64 key = info.Create64PgKey();
                                pgInfo = timeList[chkStartTime].Find(info1 => key == info1.EventInfo.Create64PgKey());
                            }

                            if (pgInfo != null)
                            {
                                viewItem.TopPos = pgInfo.TopPos + pgInfo.Height * (startTime - info.StartTime).TotalSeconds / info.DurationSecond;
                                viewItem.Height = Math.Max(pgInfo.Height * duration / info.DurationSecond, ViewUtil.PanelMinimumHeight);
                                viewItem.Width  = pgInfo.Width;
                            }
                            else
                            {
                                int index = timeList.IndexOfKey(chkStartTime);
                                viewItem.TopPos = Settings.Instance.MinHeight * (index * 60 + (startTime - chkStartTime).TotalMinutes);
                                viewItem.Height = Math.Max(duration * Settings.Instance.MinHeight / 60, ViewUtil.PanelMinimumHeight);

                                //番組表の統合関係
                                pgInfo = timeList.Values[index].Find(info1 => info1.LeftPos == viewItem.LeftPos &&
                                                                     info1.TopPos <= viewItem.TopPos && viewItem.TopPos < info1.TopPos + info1.Height);
                                if (pgInfo != null)
                                {
                                    viewItem.Width = pgInfo.Width;
                                }
                                else
                                {
                                    viewItem.Width = Settings.Instance.ServiceWidth / mergeNum;
                                }
                            }

                            break;
                        }
                    }
                }
                epgProgramView.SetReserveList(reserveList);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
        }