Example #1
0
        /// <summary>EPGデータ更新</summary>
        protected override bool ReloadInfoData()
        {
            EpgViewPeriod newPeriod = RestoreState.isDefPeriod == true ? DefPeriod.DefPeriod : RestoreState.period ?? (IsDataDefPeriod ? DefPeriod.DefPeriod : ViewPeriod);

            if (!viewData.ReloadEpgData(newPeriod, !this.IsVisible))
            {
                return(false);
            }
            ViewPeriod = DataPeriod.DeepClone();
            RefreshMoveButtonStatus();

            ReloadReserveInfoFlg = true;
            ReloadProgramViewItem();
            if (ReloadReserveInfoFlg == true)
            {
                ReloadReserveInfoFlg = !ReloadReserveInfoData();
            }
            restoreState = null;

            if (viewData.EpgTabInfo.SearchMode && Settings.Instance.NgAutoEpgLoadNW && Settings.Instance.PrebuildEpg == false &&
                ViewPeriod.End > CommonUtil.EdcbNowEpg && CommonManager.Instance.DB.ReserveList.Values.Any(r => r.IsManual))
            {
                CommonManager.MainWindow.MainProc(MainProcItem.EpgDataSearch);
            }
            return(true);
        }
Example #2
0
 public void JumpDate(EpgViewPeriod period = null)
 {
     period = period ?? DefPeriod.DefPeriod;
     if (period.Equals(ViewPeriod))
     {
         return;
     }
     ViewPeriod = period.DeepClone();
     UpdateInfo(true);
 }
Example #3
0
 public void SetDate(EpgViewPeriod period = null, DateTime?limit = null)
 {
     if (period != null)
     {
         picker_start.SelectedDate = period.Start;
         text_days.Text            = period.Days.ToString();
     }
     if (limit != null)
     {
         label_Limit.Text = limit != DateTime.MaxValue ? ((DateTime)limit).ToString(modeText + "可能期間 yyyy\\/MM\\/dd(ddd) 以降") : "*過去番組データなし";
     }
 }
Example #4
0
        protected virtual void InitCommand()
        {
            base.updateInvisible = true;

            //ビューコードの登録
            mBinds.View = CtxmCode.EpgView;

            //コマンド集の初期化
            mc = new CmdExeReserve(this);
            mc.SetFuncGetRecSetting(() => viewInfo.RecSetting);
            mc.SetFuncGetSearchKey(() => viewInfo.SearchMode ? viewInfo.SearchKey : null);

            //コマンド集にないものを登録
            mc.AddReplaceCommand(EpgCmds.ViewChgSet, (sender, e) => viewFunc.ViewSetting(-1));
            mc.AddReplaceCommand(EpgCmds.ViewChgReSet, (sender, e) => viewFunc.ViewSetting(-2));
            mc.AddReplaceCommand(EpgCmds.ViewChgMode, mc_ViewChgMode);

            //コマンド集を振り替えるもの
            mc.AddReplaceCommand(EpgCmds.JumpTable, mc_JumpTable);

            //過去番組関係
            ViewPeriod = DefPeriod.DefPeriod;
        }
Example #5
0
        public void SetTime(List <DateTime> timeList, EpgViewPeriod period)
        {
            ClearInfo();
            if (timeList.Any() == false)
            {
                return;
            }

            span = 6;
            DateTime start = CommonUtil.Max(timeList[0], period.Start);
            DateTime end   = CommonUtil.Min(timeList[timeList.Count - 1], period.End);

            for (DateTime itemTime = start.Date; itemTime == start.Date || itemTime < end; itemTime += TimeSpan.FromDays(1))
            {
                var day = new Button();
                day.Padding = new Thickness(1);
                day.Content = itemTime.ToString("M\\/d(ddd)");
                if (itemTime.DayOfWeek == DayOfWeek.Saturday)
                {
                    day.Foreground = Brushes.Blue;
                }
                if (itemTime.DayOfWeek == DayOfWeek.Sunday)
                {
                    day.Foreground = Brushes.Red;
                }
                day.Tag               = itemTime;
                day.Height            = 21;
                day.VerticalAlignment = VerticalAlignment.Top;
                day.Click            += (sender, e) => TimeButtonClick((DateTime)((Button)sender).Tag, true);//itemTimeはC#4以下でNG

                var uGrid = new UniformGrid();
                uGrid.Margin = new Thickness {
                    Top = day.Height
                };
                uGrid.Rows = 1;
                for (int i = 0; i < 24; i += span)
                {
                    DateTime time = itemTime.AddHours(i);
                    var      hour = new Button();
                    hour.Padding = new Thickness();
                    hour.Content = new TextBlock {
                        Text = i.ToString()
                    };
                    hour.Tag       = time;
                    hour.Height    = 21;
                    hour.Click    += (sender, e) => TimeButtonClick((DateTime)((Button)sender).Tag, false);
                    hour.IsEnabled = start.AddHours(-span) < time && time <= end;
                    uGrid.Children.Add(hour);
                }

                //日付のマーキング。
                var rect = new Rectangle();
                rect.Stroke          = day.Foreground;
                rect.StrokeThickness = 2;
                rect.RadiusX         = 1;
                rect.RadiusY         = 1;
                rect.Tag             = itemTime;

                //別のUniformGridに並べるとSetScrollTime()の後装飾でずれる場合があるようなので、Gridでまとめる
                var grid = new Grid();
                grid.Children.Add(day);
                grid.Children.Add(uGrid);
                grid.Children.Add(rect);
                uniformGrid_main.Children.Add(grid);
            }
            columnDefinition.MaxWidth = uniformGrid_main.Children.Count * 120;
            SetTodayMark();
        }
Example #6
0
        public bool ReloadEpgData(EpgViewPeriod newPeriod = null, bool noMsg = false)
        {
            try
            {
                newPeriod = newPeriod ?? DefPeriod.DefPeriod;
                if (Period.Equals(newPeriod) == true && IsEpgLoaded == true)
                {
                    return(true);
                }

                if (CommonManager.Instance.WaitingSrvReady == true)
                {
                    StatusManager.StatusNotifySet("EpgTimerSrv準備完了待ち");
                    return(false);
                }
                if (CommonManager.Instance.IsConnected == false)
                {
                    return(false);
                }

                ErrCode err;
                var     serviceDic = new Dictionary <UInt64, EpgServiceAllEventInfo>();
                if (EpgTabInfo.SearchMode == false)
                {
                    err = CommonManager.Instance.DB.LoadEpgData(ref serviceDic, newPeriod, EpgTabInfo.ViewServiceList);
                }
                else
                {
                    //番組情報の検索
                    err = CommonManager.Instance.DB.SearchPgLists(EpgTabInfo.GetSearchKeyReloadEpg().IntoList(), ref serviceDic, newPeriod);
                }
                if ((noMsg && err != ErrCode.CMD_SUCCESS) ||
                    CommonManager.CmdErrMsgTypical(err, "EPGデータの取得", err == ErrCode.CMD_ERR_BUSY ?
                                                   "EPGデータの読み込みを行える状態ではありません。\r\n(EPGデータ読み込み中など)" :
                                                   "エラーが発生しました。\r\nEPGデータが読み込まれていない可能性があります。") == false)
                {
                    return(false);
                }

                //並び順はViewServiceListによる。eventListはこの後すぐ作り直すのでとりあえずそのままもらう。
                ServiceEventList = CommonManager.Instance.DB.ExpandSpecialKey(EpgTabInfo.ViewServiceList, serviceDic.Values.Select(info => info.serviceInfo))
                                   .Where(id => serviceDic.ContainsKey(id)).Select(id => serviceDic[id])
                                   .Select(info => new EpgServiceEventInfo {
                    serviceInfo = info.serviceInfo, eventList = info.eventMergeList.ToList()
                }).ToList();

                EventUIDList      = new Dictionary <ulong, EpgEventInfo>();
                EventFilteredHash = new HashSet <ulong>();
                var viewContentMatchingHash = new HashSet <UInt32>(EpgTabInfo.ViewContentList.Select(d => d.MatchingKeyList).SelectMany(x => x));
                foreach (EpgServiceEventInfo item in ServiceEventList)
                {
                    item.eventList = item.eventList.FindAll(eventInfo =>
                    {
                        //開始時間未定を除外
                        bool ret = (eventInfo.StartTimeFlag != 0)

                                   //自動登録されたりするので、サービス別番組表では表示させる
                                   //&& (eventInfo.IsGroupMainEvent == true)

                                   //表示抑制
                                   && (eventInfo.IsOver(newPeriod.Start) == false && eventInfo.PgStartTime < newPeriod.End);

                        if (ret == false)
                        {
                            return(false);
                        }

                        //ジャンル絞り込み
                        bool filtered = !ViewUtil.ContainsContent(eventInfo, viewContentMatchingHash, EpgTabInfo.ViewNotContentFlag);
                        if (EpgTabInfo.HighlightContentKind && filtered)
                        {
                            EventFilteredHash.Add(eventInfo.CurrentPgUID());
                        }

                        return(EpgTabInfo.HighlightContentKind || !filtered);
                    });
                    item.eventList.ForEach(data => EventUIDList[data.CurrentPgUID()] = data);
                }

                IsEpgLoaded = true;
                Period      = newPeriod.DeepClone();
                IsDefPeriod = Period.Equals(DefPeriod.DefPeriod);
                return(true);
            }
            catch (Exception ex) { CommonUtil.DispatcherMsgBoxShow(ex.ToString()); }
            return(false);
        }
Example #7
0
 public StateBase(EpgViewBase view)
 {
     viewMode    = view.viewMode;
     period      = view.ViewPeriod.DeepClone();
     isDefPeriod = view.IsDataDefPeriod;
 }