public void ClearInfo() { toolTipTimer.Stop(); toolTip.IsOpen = false; lastPopupInfo = null; popupItem.Visibility = System.Windows.Visibility.Hidden; foreach (Rectangle info in reserveBorder) { canvas.Children.Remove(info); } reserveBorder.Clear(); reserveBorder = null; reserveBorder = new List <Rectangle>(); canvas.ReleaseMouseCapture(); isDrag = false; for (int i = 0; i < canvas.Children.Count; i++) { if (canvas.Children[i] is EpgViewPanel) { canvas.Children.RemoveAt(i--); } } canvas.Height = 0; canvas.Width = 0; }
protected override void MoveToProgramItem(EpgEventInfo target, bool IsMarking) { ulong PgKey = target.Create64PgKey(); ProgramViewItem target_item = this.programList.Find(item => item.EventInfo.Create64PgKey() == PgKey); this.programView.ScrollToFindItem(target_item, IsMarking); }
protected override void OnRender(DrawingContext dc) { dc.DrawRectangle(Background, null, new Rect(RenderSize)); if (Items != null && textDrawLists != null && Items.Count >= textDrawLists.Count && ContentBrushList != null && ContentBrushList.Count >= 17) { double selfLeft = Canvas.GetLeft(this); Brush bgBrush = Background; Brush filteredBrush = null; if (bgBrush is SolidColorBrush) { Color c = ((SolidColorBrush)bgBrush).Color; filteredBrush = new SolidColorBrush(Color.FromArgb(FilteredAlpha, c.R, c.G, c.B)); filteredBrush.Freeze(); } //位置がずれないように枠線の幅が1より大きいときは両側で分け合う double borderLeft = _borderLeftSize > 1 ? _borderLeftSize / 2 : _borderLeftSize; double borderTop = _borderTopSize > 1 ? _borderTopSize / 2 : _borderTopSize; for (int i = 0; i < textDrawLists.Count; i++) { ProgramViewItem info = Items[i]; double bgHeight = Math.Min(borderTop, info.Height); if (info.Width > _borderLeftSize && bgHeight > 0) { dc.DrawRectangle(bgBrush, null, new Rect(info.LeftPos + borderLeft - selfLeft, info.TopPos, info.Width - _borderLeftSize, bgHeight)); dc.DrawRectangle(bgBrush, null, new Rect(info.LeftPos + borderLeft - selfLeft, info.TopPos + info.Height - bgHeight, info.Width - _borderLeftSize, bgHeight)); } if (info.Width > _borderLeftSize && info.Height > _borderTopSize) { Brush contentBrush = ContentBrushList[0x10]; if (info.EventInfo.ContentInfo != null) { foreach (EpgContentData nibble in info.EventInfo.ContentInfo.nibbleList) { if (nibble.content_nibble_level_1 <= 0x0B || nibble.content_nibble_level_1 == 0x0F) { contentBrush = ContentBrushList[nibble.content_nibble_level_1]; break; } } } var textArea = new Rect(info.LeftPos + borderLeft - selfLeft, info.TopPos + borderTop, info.Width - _borderLeftSize, info.Height - _borderTopSize); dc.DrawRectangle(contentBrush, null, textArea); dc.PushClip(new RectangleGeometry(textArea)); foreach (Tuple <Brush, GlyphRun> txtinfo in textDrawLists[i]) { dc.DrawGlyphRun(txtinfo.Item1, txtinfo.Item2); } dc.Pop(); if (info.Filtered && filteredBrush != null) { dc.DrawRectangle(filteredBrush, null, textArea); } } } } }
private void canvas_MouseLeave(object sender, MouseEventArgs e) { if (EpgSetting.EpgPopup) { popupItem.Visibility = System.Windows.Visibility.Hidden; lastPopupInfo = null; lastPopupPos = new Point(-1, -1); } }
protected virtual ReserveViewItem AddReserveViewItem(ReserveData resInfo, ref ProgramViewItem refPgItem, bool SearchEvent = false) { //マージン適用前 DateTime startTime = GetViewTime(resInfo.StartTime); DateTime chkStartTime = startTime.Date.AddHours(startTime.Hour); //離れた時間のプログラム予約など、番組表が無いので表示不可 int index = timeList.BinarySearch(chkStartTime); if (index < 0) { return(null); } //EPG予約の場合は番組の外側に予約枠が飛び出さないようなマージンを作成。 double StartMargin = resInfo.IsEpgReserve == false ? resInfo.StartMarginResActual : Math.Min(0, resInfo.StartMarginResActual); double EndMargin = resInfo.IsEpgReserve == false ? resInfo.EndMarginResActual : Math.Min(0, resInfo.EndMarginResActual); //duationがマイナスになる場合は後で処理される startTime = startTime.AddSeconds(-StartMargin); double duration = resInfo.DurationSecond + StartMargin + EndMargin; var resItem = new ReserveViewItem(resInfo); reserveList.Add(resItem); //予約情報から番組情報を特定し、枠表示位置を再設定する refPgItem = null; programList.TryGetValue(resInfo.CurrentPgUID(), out refPgItem); if (refPgItem == null && SearchEvent == true) { EpgEventInfo epgInfo = resInfo.ReserveEventInfo(); if (epgInfo != null) { EpgEventInfo epgRefInfo = epgInfo.GetGroupMainEvent(); if (epgRefInfo != null) { programList.TryGetValue(epgRefInfo.CurrentPgUID(), out refPgItem); } } } if (resInfo.IsEpgReserve == true && refPgItem != null && resInfo.DurationSecond != 0) { resItem.Height = Math.Max(refPgItem.Height * duration / resInfo.DurationSecond, ViewUtil.PanelMinimumHeight); resItem.TopPos = refPgItem.TopPos + Math.Min(refPgItem.Height - resItem.Height, refPgItem.Height * (-StartMargin) / resInfo.DurationSecond); } else { resItem.Height = Math.Max(duration * Settings.Instance.MinHeight / 60, ViewUtil.PanelMinimumHeight); resItem.TopPos = Settings.Instance.MinHeight * (index * 60 + (startTime - chkStartTime).TotalMinutes); } return(resItem); }
// サービスID/開始日付/TopPos 順にソート public static int Compare(ProgramViewItem x, ProgramViewItem y) { //nullが最も小さいとする if (x == null && y == null) { return 0; } if (x == null) { return -1; } if (y == null) { return 1; } if (x.EventInfo.service_id < y.EventInfo.service_id) { return -1; } else if (x.EventInfo.service_id > y.EventInfo.service_id) { return 1; } else { if (x.EventInfo.start_time < y.EventInfo.start_time) { return -1; } else if (x.EventInfo.start_time > y.EventInfo.start_time) { return 1; } else { return 0; //// 不必要? //if (x.TopPos < y.TopPos) //{ // return -1; //} //else if (x.TopPos > y.TopPos) //{ // return 1; //} //else //{ // return 0; //} } } }
private void epgViewPanel_MouseLeave(object sender, MouseEventArgs e) { popupItem.Visibility = System.Windows.Visibility.Hidden; popupItemReserveRect.Visibility = System.Windows.Visibility.Hidden; lastPopupInfo = null; lastPopupPos = new Point(-1, -1); if (popupReserve != null) { popupReserve.Visibility = System.Windows.Visibility.Visible; popupReserve = null; } }
protected override void InitCommand() { base.InitCommand(); //コマンド集の初期化の続き mc.SetFuncGetDataList(isAll => isAll == true ? reserveList.GetDataList() : reserveList.GetHitDataList(clickPos)); mc.SetFuncGetEpgEventList(() => { ProgramViewItem hitItem = programView.GetProgramViewData(clickPos); return(hitItem != null && hitItem.EventInfo != null ? CommonUtil.ToList(hitItem.EventInfo) : new List <EpgEventInfo>()); }); }
// サービスID/開始日付/TopPos 順にソート public static int Compare(ProgramViewItem x, ProgramViewItem y) { //nullが最も小さいとする if (x == null && y == null) { return(0); } if (x == null) { return(-1); } if (y == null) { return(1); } if (x.EventInfo.service_id < y.EventInfo.service_id) { return(-1); } else if (x.EventInfo.service_id > y.EventInfo.service_id) { return(1); } else { if (x.EventInfo.start_time < y.EventInfo.start_time) { return(-1); } else if (x.EventInfo.start_time > y.EventInfo.start_time) { return(1); } else { return(0); //// 不必要? //if (x.TopPos < y.TopPos) //{ // return -1; //} //else if (x.TopPos > y.TopPos) //{ // return 1; //} //else //{ // return 0; //} } } }
protected override object GetJumpTabItemNear() { double voffset = programView.scrollViewer.VerticalOffset; if (clickPos.X >= 0 && clickPos.Y < 0) { clickPos.X += programView.scrollViewer.HorizontalOffset; //サービス名付近から実行しているときはX位置を調整(サービス結合関連) clickPos.X -= clickPos.X % viewData.EpgStyle().ServiceWidth; clickPos.Y = Math.Max(0, clickPos.Y) + voffset; } ProgramViewItem hitItem = programView.GetProgramViewDataNear(clickPos, voffset, voffset + timeView.ActualHeight); return(hitItem != null && hitItem.Data != null ? new SearchItem(hitItem.Data) : null); }
public void ClearInfo() { toolTipTimer.Stop(); toolTip.IsOpen = false; lastPopupInfo = null; popupItem.Visibility = System.Windows.Visibility.Hidden; canvas.ReleaseMouseCapture(); isDrag = false; for (int i = 0; i < canvas.Children.Count; i++) { if (canvas.Children[i] is EpgViewPanel || canvas.Children[i] is Rectangle) { canvas.Children.RemoveAt(i--); } } canvasContainer.Height = canvas.Height = 0; canvasContainer.Width = canvas.Width = 0; }
protected override PanelItem GetPopupItem(Point cursorPos, bool onClick) { ProgramViewItem popInfo = GetProgramViewData(cursorPos); ReserveViewItem lastPopInfoRes = popInfoRes; popInfoRes = reserveList == null ? null : reserveList.Find(pg => pg.IsPicked(cursorPos)); if (Settings.Instance.EpgPopupMode == 2 && popInfoRes == null && ( onClick == false && !(lastPopInfoRes == null && popInfo == lastPopInfo) || onClick == true && lastPopInfo != null)) { return(null); } //予約枠を通過したので同じ番組でもポップアップを書き直させる。 if (lastPopInfoRes != popInfoRes) { base.PopupClear(); } return(popInfo); }
protected override PanelItem GetPopupItem(Point cursorPos, bool onClick) { ProgramViewItem popInfo = GetProgramViewData(cursorPos); ReserveViewItem lastPopInfoRes = popInfoRes; popInfoRes = GetReserveViewData(cursorPos).FirstOrDefault(); if (this.EpgStyle().EpgPopupMode == 2 && popInfoRes == null && ( onClick == false && !(lastPopInfoRes == null && popInfo == lastPopInfo) || onClick == true && lastPopInfo != null)) { return(null); } //予約枠を通過したので同じ番組でもポップアップを書き直させる。 if (lastPopInfoRes != popInfoRes) { base.PopupClear(); } return(popInfo); }
protected override void OnRender(DrawingContext dc) { dc.DrawRectangle(Background, null, new Rect(RenderSize)); if (Items == null || textDrawLists == null || Items.Count < textDrawLists.Count) { return; } { double selfLeft = Canvas.GetLeft(this); Brush bgBrush = Background; //位置がずれないように枠線の幅が1より大きいときは両側で分け合う double borderLeft = BorderLeftSize > 1 ? BorderLeftSize / 2 : BorderLeftSize; double borderTop = BorderTopSize > 1 ? BorderTopSize / 2 : BorderTopSize; for (int i = 0; i < textDrawLists.Count; i++) { ProgramViewItem info = Items[i]; double bgHeight = Math.Min(borderTop, info.Height); if (info.Width > BorderLeftSize && bgHeight > 0) { dc.DrawRectangle(bgBrush, null, new Rect(info.LeftPos + borderLeft - selfLeft, info.TopPos, info.Width - BorderLeftSize, bgHeight)); dc.DrawRectangle(bgBrush, null, new Rect(info.LeftPos + borderLeft - selfLeft, info.TopPos + info.Height - bgHeight, info.Width - BorderLeftSize, bgHeight)); } if (info.Width > BorderLeftSize && info.Height > BorderTopSize) { var textArea = new Rect(info.LeftPos + borderLeft - selfLeft, info.TopPos + borderTop, info.Width - BorderLeftSize, info.Height - BorderTopSize); dc.DrawRectangle(info.ContentColor, null, textArea); dc.PushClip(new RectangleGeometry(textArea)); foreach (Tuple <Brush, GlyphRun> txtinfo in textDrawLists[i]) { dc.DrawGlyphRun(txtinfo.Item1, txtinfo.Item2); } dc.Pop(); } } } }
protected override void InitCommand() { base.InitCommand(); //コマンド集の初期化の続き mc.SetFuncGetDataList(isAll => isAll == true ? dataItemList.GetDataList() : programView.GetReserveViewData(clickPos).GetDataList()); mc.SetFuncGetEpgEventList(() => { ProgramViewItem hitItem = programView.GetProgramViewData(clickPos); return(hitItem != null && hitItem.Data != null ? new List <EpgEventInfo> { hitItem.Data } : new List <EpgEventInfo>()); }); //コマンド集からコマンドを登録 mc.ResetCommandBindings(this, cmdMenu, cmdMenuView); //現在ラインの描画を追加 nowViewTimer = new DispatcherTimer(DispatcherPriority.Normal); nowViewTimer.Tick += (sender, e) => ReDrawNowLine(); this.Unloaded += (sender, e) => nowViewTimer.Stop();//アンロード時にReDrawNowLine()しないパスがある。 this.IsVisibleChanged += (sender, e) => ReDrawNowLine(); }
public void ClearInfo() { lastPopupInfo = null; popupItem.Visibility = System.Windows.Visibility.Hidden; foreach (Rectangle info in reserveBorder) { canvas.Children.Remove(info); } reserveBorder.Clear(); reserveBorder = null; reserveBorder = new List <Rectangle>(); epgViewPanel.ReleaseMouseCapture(); isDrag = false; epgViewPanel.Items = null; epgViewPanel.Height = 0; epgViewPanel.Width = 0; canvas.Height = 0; canvas.Width = 0; programTimeList = null; }
void toolTipTimer_Tick(object sender, EventArgs e) { toolTipTimer.Stop(); try { if (EpgSetting.EpgPopup || EpgSetting.EpgToolTip == false) { return; } if (Window.GetWindow(this).IsActive == false) { return; } Point cursorPos2 = Mouse.GetPosition(scrollViewer); if (cursorPos2.X < 0 || cursorPos2.Y < 0 || scrollViewer.ViewportWidth < cursorPos2.X || scrollViewer.ViewportHeight < cursorPos2.Y) { return; } Point cursorPos = Mouse.GetPosition(canvas); foreach (UIElement child in canvas.Children) { EpgViewPanel childPanel = child as EpgViewPanel; if (childPanel != null && childPanel.Items != null && Canvas.GetLeft(child) <= cursorPos.X && cursorPos.X < Canvas.GetLeft(child) + childPanel.Width) { foreach (ProgramViewItem info in childPanel.Items) { if (info.LeftPos <= cursorPos.X && cursorPos.X < info.LeftPos + info.Width && info.TopPos <= cursorPos.Y && cursorPos.Y < info.TopPos + info.Height) { if (info.TitleDrawErr == false && EpgSetting.EpgToolTipNoViewOnly) { break; } String viewTip = ""; if (info != null) { viewTip += new CommonManager.TimeDuration(info.EventInfo.StartTimeFlag != 0, info.EventInfo.start_time, info.EventInfo.DurationFlag != 0, info.EventInfo.durationSec) + "\r\n"; if (info.EventInfo.ShortInfo != null) { viewTip += info.EventInfo.ShortInfo.event_name + "\r\n\r\n"; viewTip += info.EventInfo.ShortInfo.text_char + "\r\n\r\n"; } if (info.EventInfo.ExtInfo != null) { viewTip += CommonManager.TrimHyphenSpace(info.EventInfo.ExtInfo.text_char); } } toolTipTextBlock.Text = viewTip; toolTipTextBlock.Background = new SolidColorBrush(Color.FromRgb(EpgSetting.EpgTipsBackColorR, EpgSetting.EpgTipsBackColorG, EpgSetting.EpgTipsBackColorB)); toolTipTextBlock.Foreground = new SolidColorBrush(Color.FromRgb(EpgSetting.EpgTipsForeColorR, EpgSetting.EpgTipsForeColorG, EpgSetting.EpgTipsForeColorB)); toolTip.IsOpen = true; toolTipOffTimer.Stop(); toolTipOffTimer.Interval = TimeSpan.FromSeconds(10); toolTipOffTimer.Start(); lastPopupInfo = info; lastPopupPos = cursorPos; } } break; } } } catch { toolTip.IsOpen = false; } }
protected void PopupItem() { if (Settings.Instance.EpgPopup == false) { return; } ProgramViewItem info = null; Point cursorPos2 = Mouse.GetPosition(scrollViewer); if (cursorPos2.X < 0 || cursorPos2.Y < 0 || scrollViewer.ViewportWidth < cursorPos2.X || scrollViewer.ViewportHeight < cursorPos2.Y) { return; } Point cursorPos = Mouse.GetPosition(canvas); foreach (UIElement child in canvas.Children) { EpgViewPanel childPanel = child as EpgViewPanel; if (childPanel != null && childPanel.Items != null && Canvas.GetLeft(child) <= cursorPos.X && cursorPos.X < Canvas.GetLeft(child) + childPanel.Width) { foreach (ProgramViewItem item in childPanel.Items) { if (item.LeftPos <= cursorPos.X && cursorPos.X < item.LeftPos + item.Width && item.TopPos <= cursorPos.Y && cursorPos.Y < item.TopPos + item.Height) { if (item == lastPopupInfo) { return; } info = item; lastPopupInfo = info; break; } } break; } } if (info == null) { popupItem.Visibility = System.Windows.Visibility.Hidden; lastPopupInfo = null; return; } //この番組だけのEpgViewPanelをつくる popupItemPanel.Background = CommonManager.Instance.EpgBackColor; popupItemPanel.Width = info.Width; popupItemPanel.BorderLeftSize = Settings.Instance.EpgBorderLeftSize; popupItemPanel.BorderTopSize = Settings.Instance.EpgBorderTopSize; popupItemPanel.IsTitleIndent = Settings.Instance.EpgTitleIndent; popupItemPanel.ExtInfoMode = Settings.Instance.EpgExtInfoPopup; popupItemPanel.ReplaceDictionaryNormal = CommonManager.CreateReplaceDictionary(Settings.Instance.EpgReplacePattern); popupItemPanel.ReplaceDictionaryTitle = CommonManager.CreateReplaceDictionary(Settings.Instance.EpgReplacePatternTitle); popupItemPanel.ItemFontNormal = new EpgViewPanel.ItemFont(Settings.Instance.FontName, false, true); popupItemPanel.ItemFontTitle = new EpgViewPanel.ItemFont(Settings.Instance.FontNameTitle, Settings.Instance.FontBoldTitle, true); Canvas.SetLeft(popupItemPanel, 0); var items = new List <ProgramViewItem>() { new ProgramViewItem(info.EventInfo, info.Past) }; items[0].Width = info.Width; //テキスト全体を表示できる高さを求める items[0].Height = 4096; popupItemPanel.Items = items; double renderHeight = popupItemPanel.LastItemRenderTextHeight; popupItemPanel.Items = null; items[0].Height = Math.Max(renderHeight, info.Height); popupItemPanel.Height = items[0].Height; popupItemPanel.Items = items; popupItemPanel.InvalidateVisual(); Canvas.SetLeft(popupItem, info.LeftPos); Canvas.SetTop(popupItem, info.TopPos); popupItem.Visibility = System.Windows.Visibility.Visible; }
void toolTipTimer_Tick(object sender, EventArgs e) { toolTipTimer.Stop(); try { if (Settings.Instance.EpgPopup || Settings.Instance.EpgToolTip == false) { return; } if (Window.GetWindow(this).IsActive == false) { return; } Point cursorPos2 = Mouse.GetPosition(scrollViewer); if (cursorPos2.X < 0 || cursorPos2.Y < 0 || scrollViewer.ViewportWidth < cursorPos2.X || scrollViewer.ViewportHeight < cursorPos2.Y) { return; } Point cursorPos = Mouse.GetPosition(canvas); foreach (UIElement child in canvas.Children) { EpgViewPanel childPanel = child as EpgViewPanel; if (childPanel != null && childPanel.Items != null && Canvas.GetLeft(child) <= cursorPos.X && cursorPos.X < Canvas.GetLeft(child) + childPanel.Width) { foreach (ProgramViewItem info in childPanel.Items) { if (info.LeftPos <= cursorPos.X && cursorPos.X < info.LeftPos + info.Width && info.TopPos <= cursorPos.Y && cursorPos.Y < info.TopPos + info.Height) { if (info.TitleDrawErr == false && Settings.Instance.EpgToolTipNoViewOnly == true) { break; } String viewTip = ""; if (info != null) { viewTip += CommonManager.GetTimeDurationText(info.EventInfo.StartTimeFlag != 0, info.EventInfo.start_time, info.EventInfo.DurationFlag != 0, info.EventInfo.durationSec) + "\r\n"; if (info.EventInfo.ShortInfo != null) { viewTip += info.EventInfo.ShortInfo.event_name + "\r\n\r\n"; viewTip += info.EventInfo.ShortInfo.text_char + "\r\n\r\n"; } if (info.EventInfo.ExtInfo != null) { viewTip += info.EventInfo.ExtInfo.text_char; } } Border border = new Border(); border.Background = Brushes.DarkGray; TextBlock block = new TextBlock(); block.Text = viewTip; block.MaxWidth = 400; block.TextWrapping = TextWrapping.Wrap; block.Margin = new Thickness(2); block.Background = CommonManager.Instance.EpgTipsBackColor; block.Foreground = CommonManager.Instance.EpgTipsForeColor; border.Child = block; toolTip.Child = border; toolTip.IsOpen = true; toolTipOffTimer.Stop(); toolTipOffTimer.Interval = TimeSpan.FromSeconds(10); toolTipOffTimer.Start(); lastPopupInfo = info; lastPopupPos = cursorPos; } } break; } } } catch { toolTip.IsOpen = false; } }
protected void PopupItem() { if (EpgSetting.EpgPopup == false) { return; } List <Brush> contentBrushList = null; ProgramViewItem info = null; Point cursorPos2 = Mouse.GetPosition(scrollViewer); if (cursorPos2.X < 0 || cursorPos2.Y < 0 || scrollViewer.ViewportWidth < cursorPos2.X || scrollViewer.ViewportHeight < cursorPos2.Y) { return; } Point cursorPos = Mouse.GetPosition(canvas); foreach (UIElement child in canvas.Children) { EpgViewPanel childPanel = child as EpgViewPanel; if (childPanel != null && childPanel.Items != null && Canvas.GetLeft(child) <= cursorPos.X && cursorPos.X < Canvas.GetLeft(child) + childPanel.Width) { foreach (ProgramViewItem item in childPanel.Items) { if (item.LeftPos <= cursorPos.X && cursorPos.X < item.LeftPos + item.Width && item.TopPos <= cursorPos.Y && cursorPos.Y < item.TopPos + item.Height) { if (item == lastPopupInfo) { return; } contentBrushList = childPanel.ContentBrushList; info = item; lastPopupInfo = info; break; } } break; } } if (info == null) { popupItem.Visibility = System.Windows.Visibility.Hidden; lastPopupInfo = null; return; } //この番組だけのEpgViewPanelをつくる popupItemPanel.Background = new SolidColorBrush(Color.FromRgb(EpgSetting.EpgBackColorR, EpgSetting.EpgBackColorG, EpgSetting.EpgBackColorB)); popupItemPanel.Background.Freeze(); popupItemPanel.Width = info.Width; var dictTitle = CommonManager.CreateReplaceDictionary(EpgSetting.EpgReplacePatternTitle); var dicNormal = CommonManager.CreateReplaceDictionary(EpgSetting.EpgReplacePattern); var itemFontTitle = new EpgViewPanel.ItemFont(EpgSetting.FontNameTitle, EpgSetting.FontBoldTitle, true); var itemFontNormal = new EpgViewPanel.ItemFont(EpgSetting.FontName, false, true); Brush brushTitle = ColorDef.CustColorBrush(EpgSetting.TitleColor1, EpgSetting.TitleCustColor1); Brush brushNormal = ColorDef.CustColorBrush(EpgSetting.TitleColor2, EpgSetting.TitleCustColor2); Canvas.SetLeft(popupItemPanel, 0); var items = new List <ProgramViewItem>() { new ProgramViewItem(info.EventInfo, info.Past, info.Filtered) }; items[0].Width = info.Width; //テキスト全体を表示できる高さを求める items[0].Height = 4096; popupItemPanel.Initialize(items, EpgSetting.EpgBorderLeftSize, EpgSetting.EpgBorderTopSize, false, EpgSetting.EpgTitleIndent, EpgSetting.EpgExtInfoPopup, dictTitle, dicNormal, itemFontTitle, itemFontNormal, EpgSetting.FontSizeTitle, EpgSetting.FontSize, brushTitle, brushNormal, EpgSetting.EpgBackColorA, contentBrushList); double itemHeight = Math.Max(popupItemPanel.LastItemRenderTextHeight, info.Height); double topPos = info.TopPos; if (EpgSetting.EpgAdjustPopup) { //下方にはみ出す部分をできるだけ縮める double trimmableHeight = Math.Max(info.Height - popupItemPanel.LastItemRenderTextHeight, 0); double trimHeight = topPos + itemHeight - (scrollViewer.VerticalOffset + Math.Floor(scrollViewer.ViewportHeight)); trimHeight = Math.Min(Math.Max(trimHeight, 0), trimmableHeight); trimmableHeight -= trimHeight; itemHeight -= trimHeight; //下方にはみ出すなら上げる topPos = Math.Min(topPos, scrollViewer.VerticalOffset + Math.Floor(scrollViewer.ViewportHeight) - itemHeight); //上方にはみ出すなら下げる topPos = Math.Max(topPos, scrollViewer.VerticalOffset); //ポップアップ前よりも下方に伸びる部分をできるだけ縮める trimHeight = topPos + itemHeight - (info.TopPos + info.Height); trimHeight = Math.Min(Math.Max(trimHeight, 0), trimmableHeight); itemHeight -= trimHeight; } items[0].Height = itemHeight; popupItemPanel.Height = itemHeight; popupItemPanel.Initialize(items, EpgSetting.EpgBorderLeftSize, EpgSetting.EpgBorderTopSize, topPos != info.TopPos, EpgSetting.EpgTitleIndent, EpgSetting.EpgExtInfoPopup, dictTitle, dicNormal, itemFontTitle, itemFontNormal, EpgSetting.FontSizeTitle, EpgSetting.FontSize, brushTitle, brushNormal, EpgSetting.EpgBackColorA, contentBrushList); popupItemPanel.InvalidateVisual(); Canvas.SetLeft(popupItem, info.LeftPos); Canvas.SetTop(popupItem, topPos); popupItem.Visibility = System.Windows.Visibility.Visible; }
void toolTipTimer_Tick(object sender, EventArgs e) { toolTipTimer.Stop(); try { if (Settings.Instance.EpgToolTip == false) { return; } if (epgViewPanel.Items != null) { if (MainWindow.GetWindow(this).IsActive == false) { return; } Point cursorPos2 = Mouse.GetPosition(scrollViewer); if (cursorPos2.X < 0 || cursorPos2.Y < 0 || scrollViewer.ViewportWidth < cursorPos2.X || scrollViewer.ViewportHeight < cursorPos2.Y) { return; } Point cursorPos = Mouse.GetPosition(epgViewPanel); foreach (ProgramViewItem info in epgViewPanel.Items) { if (info.LeftPos <= cursorPos.X && cursorPos.X < info.LeftPos + info.Width) { if (info.TopPos <= cursorPos.Y && cursorPos.Y < info.TopPos + info.Height) { if (info.TitleDrawErr == false && Settings.Instance.EpgToolTipNoViewOnly == true) { break; } String viewTip = ""; if (info != null) { if (info.EventInfo.StartTimeFlag == 1) { viewTip += info.EventInfo.start_time.ToString("yyyy/MM/dd(ddd) HH:mm:ss ~ "); } else { viewTip += "未定 ~ "; } if (info.EventInfo.DurationFlag == 1) { DateTime endTime = info.EventInfo.start_time + TimeSpan.FromSeconds(info.EventInfo.durationSec); viewTip += endTime.ToString("yyyy/MM/dd(ddd) HH:mm:ss") + "\r\n"; } else { viewTip += "未定\r\n"; } if (info.EventInfo.ShortInfo != null) { viewTip += info.EventInfo.ShortInfo.event_name + "\r\n\r\n"; viewTip += info.EventInfo.ShortInfo.text_char + "\r\n\r\n"; } if (info.EventInfo.ExtInfo != null) { viewTip += info.EventInfo.ExtInfo.text_char; } } Border border = new Border(); border.Background = Brushes.DarkGray; TextBlock block = new TextBlock(); block.Text = viewTip; block.MaxWidth = 400; block.TextWrapping = TextWrapping.Wrap; block.Margin = new Thickness(2); block.Background = CommonManager.Instance.EpgTipsBackColor; block.Foreground = CommonManager.Instance.EpgTipsForeColor; border.Child = block; toolTip.Child = border; toolTip.IsOpen = true; toolTipOffTimer.Start(); lastPopupInfo = info; lastPopupPos = cursorPos; } } } } } catch { toolTipTimer.Stop(); toolTipOffTimer.Stop(); toolTip.IsOpen = false; } }
protected void PopupItem() { if (Settings.Instance.EpgPopup == false) { return; } ProgramViewItem info = null; if (programTimeList != null) { Point cursorPos2 = Mouse.GetPosition(scrollViewer); if (cursorPos2.X < 0 || cursorPos2.Y < 0 || scrollViewer.ViewportWidth < cursorPos2.X || scrollViewer.ViewportHeight < cursorPos2.Y) { return; } Point cursorPos = Mouse.GetPosition(epgViewPanel); int index = (int)(cursorPos.Y / epgViewPanel.Height * programTimeList.Count); if (0 <= index && index < programTimeList.Count) { foreach (ProgramViewItem item in programTimeList.Values[index]) { if (item.LeftPos <= cursorPos.X && cursorPos.X < item.LeftPos + item.Width) { if (item.TopPos <= cursorPos.Y && cursorPos.Y < item.TopPos + item.Height) { if (item == lastPopupInfo) { return; } info = item; lastPopupInfo = info; break; } } } } } if (info == null) { popupItem.Visibility = System.Windows.Visibility.Hidden; lastPopupInfo = null; return; } double sizeNormal = Settings.Instance.FontSize; double sizeTitle = Settings.Instance.FontSizeTitle; FontFamily fontNormal = null; FontFamily fontTitle = null; try { if (Settings.Instance.FontName.Length > 0) { fontNormal = new FontFamily(Settings.Instance.FontName); } if (Settings.Instance.FontNameTitle.Length > 0) { fontTitle = new FontFamily(Settings.Instance.FontNameTitle); } if (fontNormal == null) { fontNormal = new FontFamily("MS UI Gothic"); } if (fontTitle == null) { fontTitle = new FontFamily("MS UI Gothic"); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } popupItemContainer.Background = info.ContentColor; Canvas.SetLeft(popupItem, info.LeftPos); Canvas.SetTop(popupItem, info.TopPos); popupItemContainer.Width = info.Width; popupItemContainer.MinHeight = info.Height; FontWeight titleWeight = Settings.Instance.FontBoldTitle ? FontWeights.Bold : FontWeights.Normal; string min; if (info.EventInfo.StartTimeFlag == 1) { min = info.EventInfo.start_time.Minute.ToString("d02"); } else { min = "未定"; } minText.Text = min; minText.FontFamily = fontTitle; minText.FontSize = sizeTitle - 0.5; minText.FontWeight = titleWeight; minText.Foreground = CommonManager.Instance.CustTitle1Color; minText.Margin = new Thickness(0.5, -0.5, 0, 0); minGrid.Width = new GridLength(sizeNormal * 1.7 + 1); if (info.EventInfo.ShortInfo != null) { //必ず文字単位で折り返すためにZWSPを挿入 titleText.Text = System.Text.RegularExpressions.Regex.Replace(info.EventInfo.ShortInfo.event_name, "\\w", "$0\u200b"); titleText.FontFamily = fontTitle; titleText.FontSize = sizeTitle; titleText.FontWeight = titleWeight; titleText.Foreground = CommonManager.Instance.CustTitle1Color; titleText.Margin = new Thickness(1, 1.5, 5.5, sizeNormal / 2); titleText.LineHeight = sizeTitle + 2; infoText.Text = System.Text.RegularExpressions.Regex.Replace(info.EventInfo.ShortInfo.text_char, "\\w", "$0\u200b"); infoText.FontFamily = fontNormal; infoText.FontSize = sizeNormal; infoText.FontWeight = FontWeights.Normal; infoText.Foreground = CommonManager.Instance.CustTitle2Color; infoText.Margin = new Thickness(epgViewPanel.IsTitleIndent ? minGrid.Width.Value + 1 : 1, 0, 9.5, 1); infoText.LineHeight = sizeNormal + 2; } else { titleText.Text = null; infoText.Text = null; } popupItem.Visibility = System.Windows.Visibility.Visible; }
private void epgViewPanel_MouseLeave(object sender, MouseEventArgs e) { popupItem.Visibility = System.Windows.Visibility.Hidden; lastPopupInfo = null; lastPopupPos = new Point(-1, -1); }
protected void CreateDrawTextList() { textDrawDict.Clear(); textDrawDict = null; textDrawDict = new Dictionary <ProgramViewItem, List <TextDrawItem> >(); Matrix m = PresentationSource.FromVisual(Application.Current.MainWindow).CompositionTarget.TransformToDevice; this.VisualTextRenderingMode = TextRenderingMode.ClearType; this.VisualTextHintingMode = TextHintingMode.Fixed; this.UseLayoutRounding = true; if (Items == null) { return; } if (Settings.Instance.MinimumHeight > 0) { // Items を表示順にソートする Items.Sort(Compare); // 前番組へのリンク ProgramViewItem wkPrev = null; String wkPrevDate = ""; foreach (ProgramViewItem info in Items) { if (wkPrev != null) { if (wkPrev.EventInfo.service_id != wkPrev.EventInfo.service_id) { // サービスIDが変わる => 局が変わる => その局の一番先頭の番組 wkPrev = null; } if (!wkPrevDate.Equals(info.EventInfo.start_time.AddHours(-4).ToShortDateString())) { // 1週間モード時、先頭は4時に切り替わる=4時間前に日付が変わるタイミング wkPrev = null; } } info.prevItem = wkPrev; wkPrev = info; wkPrevDate = info.EventInfo.start_time.AddHours(-4).ToShortDateString(); } double minimum = (Settings.Instance.FontSizeTitle + 2) * Settings.Instance.MinimumHeight; foreach (ProgramViewItem info in Items) { // 非表示の番組は変更しない if (info.Hidden) { continue; } // 最低表示dot数よりも小さければ if (info.Height < minimum) { double wk1 = minimum - info.Height; // 調整幅(Total) double wk2 = 0; // 調整可能幅 double wk3 = wk1; // 調整後の要再調整幅 ProgramViewItem pr = info.prevItem; if (pr != null) // 先頭ならやりようがない { while (pr.Height < minimum + wk3) // 調整できるだけの十分な高さが無い { wk2 = pr.Height - minimum; // 無理にでも調整可能な幅を求める if (wk2 > 0) { } else { wk2 = 0; } // 念の為マイナスを排除 wk3 = wk3 - wk2; // 調整後の要再調整幅 if (pr.prevTop == 0) { pr.prevTop = pr.TopPos; } pr.Height -= wk2; // 高さと if (pr.Height >= minimum) { pr.TopPos -= wk3; } // 開始位置の調整 pr = pr.prevItem; // 次(前) if (pr == null) { break; } // が無い?なら終わり } if (pr != null) { if (pr.prevTop == 0) { pr.prevTop = pr.TopPos; } pr.Height -= wk3; // 高さと if (info.prevTop == 0) { info.prevTop = info.TopPos; } } info.TopPos -= wk1; // 開始位置の調整 info.Height = minimum; // 最低表示dot数 } else { info.TopPos -= wk1; // 先頭位置をずらす info.Height = minimum; // 最低表示dot数 } } } } Typeface typefaceNormal = null; Typeface typefaceTitle = null; GlyphTypeface glyphTypefaceNormal = null; GlyphTypeface glyphTypefaceTitle = null; try { if (Settings.Instance.FontName.Length > 0) { typefaceNormal = new Typeface(new FontFamily(Settings.Instance.FontName), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal); } if (Settings.Instance.FontNameTitle.Length > 0) { if (Settings.Instance.FontBoldTitle == true) { typefaceTitle = new Typeface(new FontFamily(Settings.Instance.FontNameTitle), FontStyles.Normal, FontWeights.Bold, FontStretches.Normal); } else { typefaceTitle = new Typeface(new FontFamily(Settings.Instance.FontNameTitle), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal); } } if (!typefaceNormal.TryGetGlyphTypeface(out glyphTypefaceNormal)) { typefaceNormal = null; } if (!typefaceTitle.TryGetGlyphTypeface(out glyphTypefaceTitle)) { typefaceTitle = null; } if (typefaceNormal == null) { typefaceNormal = new Typeface(new FontFamily("MS UI Gothic"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal); if (!typefaceNormal.TryGetGlyphTypeface(out glyphTypefaceNormal)) { MessageBox.Show("フォント指定が不正です"); return; } } if (typefaceTitle == null) { typefaceTitle = new Typeface(new FontFamily("MS UI Gothic"), FontStyles.Normal, FontWeights.Bold, FontStretches.Normal); if (!typefaceTitle.TryGetGlyphTypeface(out glyphTypefaceTitle)) { MessageBox.Show("フォント指定が不正です"); return; } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } try { double sizeNormal = Settings.Instance.FontSize; double sizeTitle = Settings.Instance.FontSizeTitle; foreach (ProgramViewItem info in Items) { List <TextDrawItem> textDrawList = new List <TextDrawItem>(); textDrawDict[info] = textDrawList; if (info.Hidden) { info.TitleDrawErr = true; continue; } if (info.Height > 2) { if (info.Height < sizeTitle + 3) { //高さ足りない info.TitleDrawErr = true; } double totalHeight = -2; //分 string min; if (info.EventInfo.StartTimeFlag == 1) { min = info.EventInfo.start_time.Minute.ToString("d02") + " "; } else { min = "未定 "; } double useHeight = 0; if (RenderText(min, ref textDrawList, glyphTypefaceTitle, sizeTitle - 0.5, info.Width - 4, info.Height + 10, info.LeftPos - 1, info.TopPos - 1, ref useHeight, CommonManager.Instance.CustTitle1Color, m) == false) { info.TitleDrawErr = true; continue; } double widthOffset = sizeNormal * 1.7; //番組情報 if (info.EventInfo.ShortInfo != null) { //タイトル if (info.EventInfo.ShortInfo.event_name.Length > 0) { if (RenderText(info.EventInfo.ShortInfo.event_name, ref textDrawList, glyphTypefaceTitle, sizeTitle, info.Width - 6 - widthOffset, info.Height - 1 - totalHeight, info.LeftPos + widthOffset, info.TopPos + totalHeight, ref useHeight, CommonManager.Instance.CustTitle1Color, m) == false) { info.TitleDrawErr = true; continue; } totalHeight += Math.Floor(useHeight + (sizeNormal / 2)); } if (IsTitleIndent == false) { widthOffset = 0; } //説明 if (info.EventInfo.ShortInfo.text_char.Length > 0) { if (RenderText(info.EventInfo.ShortInfo.text_char, ref textDrawList, glyphTypefaceNormal, sizeNormal, info.Width - 10 - widthOffset, info.Height - 5 - totalHeight, info.LeftPos + widthOffset, info.TopPos + totalHeight, ref useHeight, CommonManager.Instance.CustTitle2Color, m) == false) { continue; } totalHeight += useHeight + sizeNormal; } //詳細 // if (info.EventInfo.ExtInfo != null) // { // if (info.EventInfo.ExtInfo.text_char.Length > 0) // { // if (RenderText(info.EventInfo.ExtInfo.text_char, ref textDrawList, glyphTypefaceNormal, sizeNormal, info.Width - 6 - widthOffset, info.Height - 6 - totalHeight, info.LeftPos + widthOffset, info.TopPos + totalHeight, ref useHeight, CommonManager.Instance.CustTitle2Color, m) == false) // { // continue; // } // totalHeight += useHeight; // } // } } } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public void ClearInfo() { lastPopupInfo = null; popupItem.Visibility = System.Windows.Visibility.Hidden; foreach (Rectangle info in reserveBorder) { canvas.Children.Remove(info); } reserveBorder.Clear(); reserveBorder = null; reserveBorder = new List<Rectangle>(); epgViewPanel.ReleaseMouseCapture(); isDrag = false; epgViewPanel.Items = null; epgViewPanel.Height = 0; epgViewPanel.Width = 0; canvas.Height = 0; canvas.Width = 0; programTimeList = null; }
protected void PopupItem() { if (Settings.Instance.EpgPopup == false) return; ProgramViewItem info = null; if (programTimeList != null) { Point cursorPos2 = Mouse.GetPosition(scrollViewer); if (cursorPos2.X < 0 || cursorPos2.Y < 0 || scrollViewer.ViewportWidth < cursorPos2.X || scrollViewer.ViewportHeight < cursorPos2.Y) { return; } Point cursorPos = Mouse.GetPosition(epgViewPanel); int index = (int)(cursorPos.Y / epgViewPanel.Height * programTimeList.Count); if (0 <= index && index < programTimeList.Count) { foreach (ProgramViewItem item in programTimeList.Values[index]) { if (item.LeftPos <= cursorPos.X && cursorPos.X < item.LeftPos + item.Width) { if (item.TopPos <= cursorPos.Y && cursorPos.Y < item.TopPos + item.Height) { if (item == lastPopupInfo) return; info = item; lastPopupInfo = info; break; } } } } } if (info == null) { popupItem.Visibility = System.Windows.Visibility.Hidden; lastPopupInfo = null; return; } double sizeNormal = Settings.Instance.FontSize; double sizeTitle = Settings.Instance.FontSizeTitle; FontFamily fontNormal = null; FontFamily fontTitle = null; try { if (Settings.Instance.FontName.Length > 0) { fontNormal = new FontFamily(Settings.Instance.FontName); } if (Settings.Instance.FontNameTitle.Length > 0) { fontTitle = new FontFamily(Settings.Instance.FontNameTitle); } if (fontNormal == null) { fontNormal = new FontFamily("MS UI Gothic"); } if (fontTitle == null) { fontTitle =new FontFamily("MS UI Gothic"); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } popupItemContainer.Background = info.ContentColor; Canvas.SetLeft(popupItem, info.LeftPos); Canvas.SetTop(popupItem, info.TopPos); popupItemContainer.Width = info.Width; popupItemContainer.MinHeight = info.Height; FontWeight titleWeight = Settings.Instance.FontBoldTitle ? FontWeights.Bold : FontWeights.Normal; string min; if (info.EventInfo.StartTimeFlag == 1) { min = info.EventInfo.start_time.Minute.ToString("d02"); } else { min = "未定"; } minText.Text = min; minText.FontFamily = fontTitle; minText.FontSize = sizeTitle - 0.5; minText.FontWeight = titleWeight; minText.Foreground = CommonManager.Instance.CustTitle1Color; minText.Margin = new Thickness(0.5, -0.5, 0, 0); minGrid.Width = new GridLength(sizeNormal * 1.7 + 1); if (info.EventInfo.ShortInfo != null) { //必ず文字単位で折り返すためにZWSPを挿入 titleText.Text = System.Text.RegularExpressions.Regex.Replace(info.EventInfo.ShortInfo.event_name, "\\w", "$0\u200b"); titleText.FontFamily = fontTitle; titleText.FontSize = sizeTitle; titleText.FontWeight = titleWeight; titleText.Foreground = CommonManager.Instance.CustTitle1Color; titleText.Margin = new Thickness(1, 1.5, 5.5, sizeNormal / 2); titleText.LineHeight = sizeTitle + 2; infoText.Text = System.Text.RegularExpressions.Regex.Replace(info.EventInfo.ShortInfo.text_char, "\\w", "$0\u200b"); infoText.FontFamily = fontNormal; infoText.FontSize = sizeNormal; infoText.FontWeight = FontWeights.Normal; infoText.Foreground = CommonManager.Instance.CustTitle2Color; infoText.Margin = new Thickness(epgViewPanel.IsTitleIndent ? minGrid.Width.Value + 1 : 1, 0, 9.5, 1); infoText.LineHeight = sizeNormal + 2; } else { titleText.Text = null; infoText.Text = null; } popupItem.Visibility = System.Windows.Visibility.Visible; }
protected void PopupItem() { ProgramViewItem info = null; if (epgViewPanel.Items != null) { Point cursorPos2 = Mouse.GetPosition(scrollViewer); if (cursorPos2.X < 0 || cursorPos2.Y < 0 || scrollViewer.ViewportWidth < cursorPos2.X || scrollViewer.ViewportHeight < cursorPos2.Y) { return; } Point cursorPos = Mouse.GetPosition(epgViewPanel); foreach (ProgramViewItem item in epgViewPanel.Items) { if (item.LeftPos <= cursorPos.X && cursorPos.X < item.LeftPos + item.Width) { if (item.TopPos <= cursorPos.Y && cursorPos.Y < item.TopPos + item.Height) { if (item == lastPopupInfo) { return; } info = item; lastPopupInfo = info; break; } } } } if (popupReserve != null) { popupReserve.Visibility = System.Windows.Visibility.Visible; popupReserve = null; popupItemReserveRect.Visibility = System.Windows.Visibility.Hidden; } if (info == null) { popupItem.Visibility = System.Windows.Visibility.Hidden; lastPopupInfo = null; return; } double sizeNormal = Settings.Instance.FontSize; double sizeTitle = Settings.Instance.FontSizeTitle; FontFamily fontNormal = null; FontFamily fontTitle = null; try { if (Settings.Instance.FontName.Length > 0) { fontNormal = new FontFamily(Settings.Instance.FontName); } if (Settings.Instance.FontNameTitle.Length > 0) { fontTitle = new FontFamily(Settings.Instance.FontNameTitle); } if (fontNormal == null) { fontNormal = new FontFamily("MS UI Gothic"); } if (fontTitle == null) { fontTitle = new FontFamily("MS UI Gothic"); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } popupItemContainer.Background = info.ContentColor; Canvas.SetTop(popupItem, info.TopPos); popupItemContainer.MinHeight = info.Height; Canvas.SetLeft(popupItem, info.GroupLeftPos); popupItemContainer.Width = info.GroupWidth; FontWeight titleWeight = Settings.Instance.FontBoldTitle ? FontWeights.Bold : FontWeights.Normal; string min; if (info.EventInfo.StartTimeFlag == 1) { min = info.EventInfo.start_time.Minute.ToString("d02"); } else { min = "未定"; } minText.Text = min; minText.FontFamily = fontTitle; minText.FontSize = sizeTitle - 0.5; minText.FontWeight = titleWeight; minText.Foreground = CommonManager.Instance.CustTitle1Color; minText.Margin = new Thickness(0.5, -0.5, 0, 0); minGrid.Width = new GridLength(sizeNormal * 1.7 + 1); if (info.EventInfo.ShortInfo != null) { titleText.Text = info.EventInfo.ShortInfo.event_name; titleText.FontFamily = fontTitle; titleText.FontSize = sizeTitle; titleText.FontWeight = titleWeight; titleText.Foreground = CommonManager.Instance.CustTitle1Color; titleText.Margin = new Thickness(1, 1.5, 5.5, sizeNormal / 2); titleText.LineHeight = sizeTitle + 2; infoText.Text = info.EventInfo.ShortInfo.text_char; infoText.FontFamily = fontNormal; infoText.FontSize = sizeNormal; infoText.FontWeight = FontWeights.Normal; infoText.Foreground = CommonManager.Instance.CustTitle2Color; infoText.Margin = new Thickness(1, 0, 9.5, 1); infoText.LineHeight = sizeNormal + 2; } else { titleText.Text = null; infoText.Text = null; } popupItem.Visibility = System.Windows.Visibility.Visible; foreach (Rectangle rect in reserveBorder) { if (Canvas.GetLeft(rect) == info.LeftPos && Canvas.GetTop(rect) == info.TopPos) { popupReserve = rect; rect.Visibility = System.Windows.Visibility.Hidden; popupItemReserveRect.Stroke = rect.Stroke; popupItemReserveRect.Fill = rect.Fill; popupItemReserveRect.Visibility = System.Windows.Visibility.Visible; break; } } }
protected virtual ReserveViewItem AddReserveViewItem(ReserveData resInfo, ref ProgramViewItem refPgItem, bool SearchEvent = false) { //LimitedStart()の関係で判定出来ないものを除外 if (timeList.Any() == false || resInfo.IsManual && resInfo.IsOver(timeList[0]) && resInfo.OnTimeBaseOnAir(timeList[0]) > 0) { return(null); } //マージン適用前 DateTime startTime = GetViewTime(LimitedStart(resInfo)); DateTime chkStartTime = startTime.Date.AddHours(startTime.Hour); //離れた時間のプログラム予約など、番組表が無いので表示不可 int index = timeList.BinarySearch(chkStartTime); if (index < 0) { return(null); } var resItem = new ReserveViewItem(resInfo) { EpgSettingIndex = viewInfo.EpgSettingIndex, ViewMode = viewMode }; (resInfo is ReserveDataEnd ? recinfoList : reserveList).Add(resItem); //予約情報から番組情報を特定し、枠表示位置を再設定する refPgItem = null; programList.TryGetValue(resInfo.CurrentPgUID(), out refPgItem); if (refPgItem == null && SearchEvent == true) { EpgEventInfo epgInfo; if (viewData.EventUIDList.TryGetValue(resInfo.CurrentPgUID(), out epgInfo)) { EpgEventInfo epgRefInfo = epgInfo.GetGroupMainEvent(viewData.EventUIDList); if (epgRefInfo != null) { programList.TryGetValue(epgRefInfo.CurrentPgUID(), out refPgItem); } } } //EPG予約の場合は番組の外側に予約枠が飛び出さないようなマージンを作成。 double StartMargin = resInfo.IsEpgReserve == false ? resInfo.StartMarginResActual : Math.Min(0, resInfo.StartMarginResActual); double EndMargin = resInfo.IsEpgReserve == false ? resInfo.EndMarginResActual : Math.Min(0, resInfo.EndMarginResActual); //duationがマイナスになる場合は後で処理される double duration = resInfo.DurationSecond + StartMargin + EndMargin; if (resInfo.IsEpgReserve && resInfo.DurationSecond != 0 && refPgItem != null) { resItem.Height = Math.Max(refPgItem.Height * duration / resInfo.DurationSecond, ViewUtil.PanelMinimumHeight); resItem.TopPos = refPgItem.TopPos + Math.Min(refPgItem.Height - resItem.Height, refPgItem.Height * (-StartMargin) / resInfo.DurationSecond); } else { //週間番組表のプログラム録画の予約前マージン対応があるので、マージンの反映はGetViewTime()の後 startTime = GetViewTime(resInfo.PgStartTime).AddSeconds(-StartMargin); resItem.TopPos = this.EpgStyle().MinHeight *(index * 60 + (startTime - chkStartTime).TotalMinutes); resItem.Height = Math.Max(duration * this.EpgStyle().MinHeight / 60 + Math.Min(resItem.TopPos, 0), ViewUtil.PanelMinimumHeight); resItem.TopPos = Math.Max(resItem.TopPos, 0); } return(resItem); }