Inheritance: System.Windows.FrameworkElement
コード例 #1
0
ファイル: ProgramView.xaml.cs プロジェクト: friendgo777/EDCB
        public Rect SetProgramList(List <PanelItem <List <ProgramViewItem> > > programGroupList, double height)
        {
            try
            {
                ClearEpgViewPanel();

                //枠線の調整用
                double totalWidth = 0;
                height = ViewUtil.SnapsToDevicePixelsY(height + epgViewPanel.HeightMarginBottom, 2);
                foreach (var programList in programGroupList)
                {
                    var item = new EpgViewPanel();
                    item.ReplaceDictionaryNormal = epgViewPanel.ReplaceDictionaryNormal;
                    item.ReplaceDictionaryTitle  = epgViewPanel.ReplaceDictionaryTitle;
                    item.Background = epgViewPanel.Background;
                    item.SetBorderStyleFromSettings();
                    item.Height = height;
                    item.Width  = programList.Width;
                    Canvas.SetLeft(item, totalWidth);
                    item.ExtInfoMode = epgViewPanel.ExtInfoMode;
                    item.Items       = programList.Data;
                    item.InvalidateVisual();
                    canvas.Children.Add(item);
                    totalWidth += programList.Width;
                }

                canvas.Width        = ViewUtil.SnapsToDevicePixelsX(totalWidth + epgViewPanel.WidthMarginRight, 2);
                canvas.Height       = height;
                epgViewPanel.Width  = Math.Max(canvas.Width, ViewUtil.SnapsToDevicePixelsX(ViewUtil.GetScreenWidthMax()));
                epgViewPanel.Height = Math.Max(canvas.Height, ViewUtil.SnapsToDevicePixelsY(ViewUtil.GetScreenHeightMax()));
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
            return(new Rect(0, 0, canvas.Width, canvas.Height));
        }
コード例 #2
0
ファイル: ProgramView.xaml.cs プロジェクト: xceza7/EDCB
        public Rect SetProgramList(List <PanelItem <List <ProgramViewItem> > > programGroupList, double height)
        {
            try
            {
                ClearEpgViewPanel();

                //枠線の調整用
                double totalWidth = 0;
                height = ViewUtil.SnapsToDevicePixelsY(height + epgViewPanel.HeightMarginBottom, 2);
                foreach (var programList in programGroupList)
                {
                    var item = new EpgViewPanel();
                    item.SetViewData(viewData);
                    item.Height = height;
                    item.Width  = programList.Width;
                    Canvas.SetLeft(item, totalWidth);
                    item.Items = programList.Data;
                    item.InvalidateVisual();
                    canvas.Children.Add(item);
                    totalWidth += programList.Width;
                }

                canvas.Width        = ViewUtil.SnapsToDevicePixelsX(totalWidth + epgViewPanel.WidthMarginRight, 2);
                canvas.Height       = height;
                epgViewPanel.Width  = Math.Max(canvas.Width, ViewUtil.SnapsToDevicePixelsX(SystemParameters.VirtualScreenWidth));
                epgViewPanel.Height = Math.Max(canvas.Height, ViewUtil.SnapsToDevicePixelsY(SystemParameters.VirtualScreenHeight));
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
            return(new Rect(0, 0, canvas.Width, canvas.Height));
        }
コード例 #3
0
ファイル: ProgramView.xaml.cs プロジェクト: xtne6f/EDCB
 public void SetProgramList(List <Tuple <double, List <ProgramViewItem> > > programGroupList, double height)
 {
     try
     {
         for (int i = 0; i < canvas.Children.Count; i++)
         {
             if (canvas.Children[i] is EpgViewPanel)
             {
                 canvas.Children.RemoveAt(i--);
             }
         }
         var itemFontNormal = new EpgViewPanel.ItemFont(EpgSetting.FontName, false, false);
         var itemFontTitle  = new EpgViewPanel.ItemFont(EpgSetting.FontNameTitle, EpgSetting.FontBoldTitle, false);
         var background     = new SolidColorBrush(Color.FromRgb(EpgSetting.EpgBackColorR, EpgSetting.EpgBackColorG, EpgSetting.EpgBackColorB));
         //フリーズしないとかなり重い
         background.Freeze();
         var   dictTitle   = CommonManager.CreateReplaceDictionary(EpgSetting.EpgReplacePatternTitle);
         var   dicNormal   = CommonManager.CreateReplaceDictionary(EpgSetting.EpgReplacePattern);
         Brush brushTitle  = ColorDef.CustColorBrush(EpgSetting.TitleColor1, EpgSetting.TitleCustColor1);
         Brush brushNormal = ColorDef.CustColorBrush(EpgSetting.TitleColor2, EpgSetting.TitleCustColor2);
         //ジャンル別の背景ブラシ
         var contentBrushList = new List <Brush>();
         for (int i = 0; i < EpgSetting.ContentColorList.Count; i++)
         {
             SolidColorBrush brush = ColorDef.CustColorBrush(EpgSetting.ContentColorList[i], EpgSetting.ContentCustColorList[i]);
             contentBrushList.Add(EpgSetting.EpgGradation ? (Brush)ColorDef.GradientBrush(brush.Color) : brush);
         }
         double totalWidth = 0;
         foreach (var programList in programGroupList)
         {
             EpgViewPanel item = new EpgViewPanel();
             item.Background = background;
             item.Height     = Math.Ceiling(height);
             item.Width      = programList.Item1;
             Canvas.SetLeft(item, totalWidth);
             item.Initialize(programList.Item2, EpgSetting.EpgBorderLeftSize, EpgSetting.EpgBorderTopSize,
                             false, EpgSetting.EpgTitleIndent, EpgSetting.EpgExtInfoTable,
                             dictTitle, dicNormal, itemFontTitle, itemFontNormal,
                             EpgSetting.FontSizeTitle, EpgSetting.FontSize, brushTitle, brushNormal,
                             EpgSetting.EpgBackColorA, contentBrushList);
             item.InvalidateVisual();
             canvas.Children.Add(item);
             totalWidth += programList.Item1;
         }
         //包含するCanvasにも直接適用する(Bindingは遅延するため)。GridやStackPanelで包含してもよいはずだが
         //非表示中にここを通るとなぜか包含側のActualHeight(Width)が正しく更新されず、結果スクロール不能になる
         canvasContainer.Height = canvas.Height = Math.Ceiling(height);
         canvasContainer.Width  = canvas.Width = totalWidth;
         itemFontNormal.ClearCache();
         itemFontTitle.ClearCache();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #4
0
 public void SetProgramList(List <Tuple <double, List <ProgramViewItem> > > programGroupList, double height)
 {
     try
     {
         for (int i = 0; i < canvas.Children.Count; i++)
         {
             if (canvas.Children[i] is EpgViewPanel)
             {
                 canvas.Children.RemoveAt(i--);
             }
         }
         var itemFontNormal = new EpgViewPanel.ItemFont(Settings.Instance.FontName, false, false);
         var itemFontTitle  = new EpgViewPanel.ItemFont(Settings.Instance.FontNameTitle, Settings.Instance.FontBoldTitle, false);
         epgViewPanel.Background = CommonManager.Instance.EpgBackColor;
         epgViewPanel.ReplaceDictionaryNormal = CommonManager.CreateReplaceDictionary(Settings.Instance.EpgReplacePattern);
         epgViewPanel.ReplaceDictionaryTitle  = CommonManager.CreateReplaceDictionary(Settings.Instance.EpgReplacePatternTitle);
         double totalWidth = 0;
         foreach (var programList in programGroupList)
         {
             EpgViewPanel item = new EpgViewPanel();
             item.Background              = epgViewPanel.Background;
             item.Height                  = Math.Ceiling(height);
             item.Width                   = programList.Item1;
             item.BorderLeftSize          = Settings.Instance.EpgBorderLeftSize;
             item.BorderTopSize           = Settings.Instance.EpgBorderTopSize;
             item.IsTitleIndent           = Settings.Instance.EpgTitleIndent;
             item.ReplaceDictionaryNormal = epgViewPanel.ReplaceDictionaryNormal;
             item.ReplaceDictionaryTitle  = epgViewPanel.ReplaceDictionaryTitle;
             item.ItemFontNormal          = itemFontNormal;
             item.ItemFontTitle           = itemFontTitle;
             Canvas.SetLeft(item, totalWidth);
             item.Items = programList.Item2;
             item.InvalidateVisual();
             canvas.Children.Add(item);
             totalWidth += programList.Item1;
         }
         canvas.Height = Math.Ceiling(height);
         canvas.Width  = totalWidth;
         itemFontNormal.ClearCache();
         itemFontTitle.ClearCache();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
     }
 }
コード例 #5
0
ファイル: ProgramView.xaml.cs プロジェクト: nekopanda/EDCB
 public void SetProgramList(List <Tuple <double, List <ProgramViewItem> > > programGroupList, double height)
 {
     try
     {
         for (int i = 0; i < canvas.Children.Count; i++)
         {
             if (canvas.Children[i] is EpgViewPanel)
             {
                 canvas.Children.RemoveAt(i--);
             }
         }
         var    itemFontNormal = ViewUtil.ItemFontNormal;
         var    itemFontTitle  = ViewUtil.ItemFontTitle;
         double totalWidth     = 0;
         foreach (var programList in programGroupList)
         {
             EpgViewPanel item = new EpgViewPanel();
             item.Background     = epgViewPanel.Background;
             item.Height         = Math.Ceiling(height);
             item.Width          = programList.Item1;
             item.ItemFontNormal = itemFontNormal;
             item.ItemFontTitle  = itemFontTitle;
             Canvas.SetLeft(item, totalWidth);
             item.Items = programList.Item2;
             item.InvalidateVisual();
             canvas.Children.Add(item);
             totalWidth += programList.Item1;
         }
         canvas.Height = Math.Ceiling(height);
         canvas.Width  = totalWidth;
         itemFontNormal.ClearCache();
         itemFontTitle.ClearCache();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
     }
 }
コード例 #6
0
ファイル: ProgramView.xaml.cs プロジェクト: xtne6f/EDCB
        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;
            }
        }
コード例 #7
0
ファイル: ProgramView.xaml.cs プロジェクト: xtne6f/EDCB
        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;
        }
コード例 #8
0
        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;
            }
        }
コード例 #9
0
        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;
        }
コード例 #10
0
ファイル: ProgramView.xaml.cs プロジェクト: nekopanda/EDCB
 public void SetProgramList(List<Tuple<double, List<ProgramViewItem>>> programGroupList, double height)
 {
     try
     {
         for (int i = 0; i < canvas.Children.Count; i++)
         {
             if (canvas.Children[i] is EpgViewPanel)
             {
                 canvas.Children.RemoveAt(i--);
             }
         }
         var itemFontNormal = ViewUtil.ItemFontNormal;
         var itemFontTitle = ViewUtil.ItemFontTitle;
         double totalWidth = 0;
         foreach (var programList in programGroupList)
         {
             EpgViewPanel item = new EpgViewPanel();
             item.Background = epgViewPanel.Background;
             item.Height = Math.Ceiling(height);
             item.Width = programList.Item1;
             item.ItemFontNormal = itemFontNormal;
             item.ItemFontTitle = itemFontTitle;
             Canvas.SetLeft(item, totalWidth);
             item.Items = programList.Item2;
             item.InvalidateVisual();
             canvas.Children.Add(item);
             totalWidth += programList.Item1;
         }
         canvas.Height = Math.Ceiling(height);
         canvas.Width = totalWidth;
         itemFontNormal.ClearCache();
         itemFontTitle.ClearCache();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
     }
 }