public void SetBorderStyle(double borderLeft, double borderTop, Thickness textPadding) { borderMax = CommonUtil.Max(1, borderLeft, borderTop); borderThickness.Left = borderLeft <= 1 ? Math.Max(0, borderLeft) : (borderLeft + 1) / 2; borderThickness.Top = borderTop <= 1 ? Math.Max(0, borderTop) : (borderTop + 1) / 2; borderThickness.Right = Math.Min(1, borderThickness.Left); //右へのはみ出し分 borderThickness.Bottom = Math.Min(1, borderThickness.Top); //下へのはみ出し分 borderMargin = new Rect(borderThickness.Left, borderThickness.Top, borderThickness.Left + Math.Max(0, borderThickness.Left - 1), borderThickness.Top + Math.Max(0, borderThickness.Top - 1)); txtMargin = new Rect(borderMargin.Left + textPadding.Left, borderMargin.Top + textPadding.Top, borderMargin.Width + textPadding.Left + textPadding.Right, borderMargin.Height + textPadding.Top + textPadding.Bottom); }
public ErrCode LoadEpgData(ref Dictionary <UInt64, EpgServiceAllEventInfo> serviceDic, EpgViewPeriod period = null, IEnumerable <ulong> keys = null) { ErrCode err = ReloadEpgData(); if (err != ErrCode.CMD_SUCCESS) { return(err); } bool noCurrent = period != null && IsEpgLoaded && period.End <= EventTimeMinCurrent; bool noArc = period == null || EventTimeBaseArc != DateTime.MaxValue && period.End <= EventTimeBaseArc; serviceDic = ServiceEventList.ToDictionary(item => item.Key, item => new EpgServiceAllEventInfo(item.Value.serviceInfo , noCurrent ? null : item.Value.eventList, noArc ? null : item.Value.eventArcList)); var list = new List <EpgServiceEventInfo>(); if (period != null && period.StartLoad < EventTimeBaseArc) { EpgViewPeriod prLoad = new EpgViewPeriod(period.StartLoad, CommonUtil.Min(period.End, EventTimeBaseArc)); //DB更新の判定 DateTime EventTimeBaseArcMin = Settings.Instance.EpgSettingList.Min(set => new EpgViewPeriodDef(set).DefPeriod.StartLoad); bool addDB = prLoad.End > EventTimeBaseArcMin; if (addDB) { prLoad.Start = Settings.Instance.PrebuildEpg ? CommonUtil.Min(EventTimeBaseArcMin, prLoad.Start) : prLoad.Start; prLoad.End = EventTimeBaseArc; } err = LoadEpgArcData(prLoad.Start, prLoad.End, ref list, addDB ? null : keys); if (err != ErrCode.CMD_SUCCESS) { return(err); } //リモコンIDの登録、サービス名の補正 ChSet5.SetRemoconID(list.Select(info => info.serviceInfo), true); CorrectServiceInfo(list); EpgServiceAllEventInfo.AddArcEpgServiceDictionary(serviceDic, list); //DB更新。EventTimeBaseArcが毎回固定でなくて良いなら、この回の取得を全てキャッシュする手もある。 ReloadWork(UpdateNotifyItem.EpgDataAdd, addDB, false, ret => { EventTimeBaseArc = CommonUtil.Max(EventTimeBaseArcMin, prLoad.Start); if (prLoad.Start < EventTimeBaseArcMin) { foreach (var info in list) { info.eventList = info.eventList.FindAll(d => d.start_time >= EventTimeBaseArc); } } EpgServiceAllEventInfo.AddArcEpgServiceDictionary(ServiceEventList, list); foreach (var data in list.SelectMany(info => info.eventList)) { EventUIDList[data.CurrentPgUID()] = data;//通常あり得ないがUID被りは後優先。 } return(ret); }); } //必要なら期間を適用。未適用でもリストは再作成される。 foreach (var info in serviceDic.Values) { info.eventList = PeriodApplied(info.eventList, period.StrictLoad ? period : null); info.eventArcList = PeriodApplied(info.eventArcList, period.StrictLoad ? period : null); } //イベントリストが空の場合もあるが、そのまま返す。 return(err); }
protected override DateTime LimitedStart(IBasicPgInfo info) { return(CommonUtil.Max(info.PgStartTime, ViewPeriod.Start)); }