Exemple #1
0
        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));
        }
Exemple #2
0
        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));
        }
Exemple #3
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(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());
     }
 }
Exemple #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);
     }
 }
Exemple #5
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 = 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);
     }
 }
Exemple #6
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 = 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);
     }
 }