示例#1
0
        public void SetTime(List <DateTime> timeList, bool weekMode, bool tunerMode = false)
        {
            {
                stackPanel_time.Children.Clear();
                bool?  use28 = Settings.Instance.LaterTimeUse == true ? null : (bool?)false;
                double h3L   = (12 + 3) * 3;
                double h6L   = h3L * 2;

                foreach (DateTime time1 in timeList)
                {
                    var      timeMod = new DateTime28(time1, use28);
                    DateTime time    = timeMod.DateTimeMod;
                    string   HourMod = timeMod.HourMod.ToString();

                    var item = ViewUtil.GetPanelTextBlock();
                    stackPanel_time.Children.Add(item);
                    item.Margin = new Thickness(1, 0, 1, 1);

                    if (tunerMode == false)
                    {
                        item.Foreground = this.EpgBrushCache().TimeFontColor;
                        item.Background = this.EpgBrushCache().TimeColorList[time1.Hour / 6];
                        item.Height     = 60 * this.EpgStyle().MinHeight - item.Margin.Top - item.Margin.Bottom;
                        if (weekMode == false)
                        {
                            item.Inlines.Add(new Run(time.ToString("M/d\r\n")));
                            if (item.Height >= h3L)
                            {
                                var color   = time.DayOfWeek == DayOfWeek.Sunday ? Brushes.Red : time.DayOfWeek == DayOfWeek.Saturday ? Brushes.Blue : item.Foreground;
                                var weekday = new Run(time.ToString("ddd"))
                                {
                                    Foreground = color, FontWeight = FontWeights.Bold
                                };
                                item.Inlines.AddRange(new Run[] { new Run("("), weekday, new Run(")") });
                            }
                        }
                        if (item.Height >= h3L)
                        {
                            item.Inlines.Add(new LineBreak());
                        }
                        if (item.Height >= h6L)
                        {
                            item.Inlines.Add(new LineBreak());
                        }
                        item.Inlines.Add(new Run(HourMod)
                        {
                            FontSize = 13, FontWeight = FontWeights.Bold
                        });
                    }
                    else
                    {
                        item.Foreground = time.DayOfWeek == DayOfWeek.Sunday ? Brushes.Red : time.DayOfWeek == DayOfWeek.Saturday ? Brushes.Blue : Settings.BrushCache.TunerTimeFontColor;
                        item.Background = Settings.BrushCache.TunerTimeBackColor;
                        item.Height     = 60 * Settings.Instance.TunerMinHeight - item.Margin.Top - item.Margin.Bottom;
                        item.Text       = time.ToString("M/d\r\n" + (item.Height >= h3L ? "(ddd)\r\n" : ""))
                                          + (item.Height >= h6L ? "\r\n" : "") + HourMod;
                    }
                }
            }
        }
示例#2
0
        public void SetService(List <EpgServiceInfo> serviceList)
        {
            stackPanel_service.Children.Clear();
            foreach (EpgServiceInfo info in serviceList)
            {
                var service1 = new StackPanel();
                service1.Width                = Settings.Instance.ServiceWidth - 1;
                service1.Margin               = new Thickness(0, 1, 1, 1);
                service1.Background           = CommonManager.Instance.EpgServiceBackColor;
                service1.MouseLeftButtonDown += (sender, e) =>
                {
                    if (e.ClickCount != 2)
                    {
                        return;
                    }
                    //
                    var serviceInfo = ((FrameworkElement)sender).DataContext as EpgServiceInfo;
                    CommonManager.Instance.TVTestCtrl.SetLiveCh(serviceInfo.ONID, serviceInfo.TSID, serviceInfo.SID);
                };
                service1.DataContext = info;

                var text = ViewUtil.GetPanelTextBlock(info.service_name);
                text.Margin     = new Thickness(1, 0, 1, 0);
                text.Foreground = CommonManager.Instance.EpgServiceFontColor;
                service1.Children.Add(text);

                text            = ViewUtil.GetPanelTextBlock(info.remote_control_key_id != 0 ? info.remote_control_key_id.ToString() : info.network_name + " " + (info.SID & (ChSet5.IsCS(info.ONID) == true ? 0x03FF : 0xFFFF)).ToString());
                text.Margin     = new Thickness(1, 0, 1, 2);
                text.Foreground = CommonManager.Instance.EpgServiceFontColor;
                service1.Children.Add(text);

                service1.ToolTip = Settings.Instance.EpgServiceNameTooltip != true ? null : ViewUtil.ServiceHeaderToToolTip(service1);
                stackPanel_service.Children.Add(service1);
            }
        }
示例#3
0
        public void SetDay(List <DateTime> dayList)
        {
            {
                stackPanel_day.Children.Clear();
                foreach (DateTime time in dayList)
                {
                    TextBlock item = ViewUtil.GetPanelTextBlock(time.ToString("M/d\r\n(ddd)"));
                    item.Tag   = time;
                    item.Width = this.EpgStyle().ServiceWidth - 1;

                    Color backgroundColor;
                    if (time.DayOfWeek == DayOfWeek.Saturday)
                    {
                        item.Foreground = Brushes.DarkBlue;
                        backgroundColor = Colors.Lavender;
                    }
                    else if (time.DayOfWeek == DayOfWeek.Sunday)
                    {
                        item.Foreground = Brushes.DarkRed;
                        backgroundColor = Colors.MistyRose;
                    }
                    else
                    {
                        item.Foreground = Brushes.Black;
                        backgroundColor = Colors.White;
                    }
                    item.Padding           = new Thickness(0, 0, 0, 2);
                    item.VerticalAlignment = VerticalAlignment.Center;
                    item.FontWeight        = FontWeights.Bold;

                    var grid = new UniformGrid();
                    grid.Background = this.EpgStyle().EpgGradationHeader ? (Brush)ColorDef.GradientBrush(backgroundColor, 0.8, 1.2) : new SolidColorBrush(backgroundColor);
                    grid.Background.Freeze();
                    grid.Margin = new Thickness(0, 1, 1, 1);
                    grid.Tag    = time;
                    grid.Children.Add(item);
                    stackPanel_day.Children.Add(grid);
                }
                rect_day.Width = this.EpgStyle().ServiceWidth - 1;
                SetTodayMark();
            }
        }
示例#4
0
        public void SetService(List <EpgServiceInfo> serviceList)
        {
            stackPanel_service.Children.Clear();
            foreach (EpgServiceInfo info in serviceList)
            {
                var service1 = new StackPanel();
                service1.Width                = this.EpgStyle().ServiceWidth - 1;
                service1.VerticalAlignment    = VerticalAlignment.Center;
                service1.MouseLeftButtonDown += (sender, e) =>
                {
                    if (e.ClickCount != 2)
                    {
                        return;
                    }
                    //
                    var serviceInfo = ((FrameworkElement)sender).DataContext as EpgServiceInfo;
                    CommonManager.Instance.TVTestCtrl.SetLiveCh(serviceInfo.ONID, serviceInfo.TSID, serviceInfo.SID);
                };
                service1.DataContext = info;

                var text = ViewUtil.GetPanelTextBlock(CommonManager.ReplaceUrl(info.service_name));
                text.Margin     = new Thickness(1, 0, 1, 0);
                text.Foreground = this.EpgBrushCache().ServiceFontColor;
                service1.Children.Add(text);

                int chnum = ChSet5.ChNumber(info.Key);
                text            = ViewUtil.GetPanelTextBlock((info.IsDttv ? (chnum != 0 ? "地デジ " : "ServiceID:") : CommonManager.ReplaceUrl(info.network_name) + " ") + (chnum != 0 ? chnum : info.SID).ToString());
                text.Margin     = new Thickness(1, 0, 1, 2);
                text.Foreground = this.EpgBrushCache().ServiceFontColor;
                service1.Children.Add(text);

                service1.ToolTip = this.EpgStyle().EpgServiceNameTooltip != true ? null : ViewUtil.ServiceHeaderToToolTip(service1);

                var grid1 = new Grid();
                grid1.Background = this.EpgBrushCache().ServiceBackColor;
                grid1.Margin     = new Thickness(0, 1, 1, 1);
                grid1.Children.Add(service1);
                stackPanel_service.Children.Add(grid1);
            }
        }
        public void SetTunerInfo(List <PanelItem <TunerReserveInfo> > tunerInfo)
        {
            stackPanel_tuner.Children.Clear();
            foreach (var info in tunerInfo)
            {
                var tuner1 = new StackPanel();
                tuner1.Width      = info.Width - 1;
                tuner1.Margin     = new Thickness(0, 1, 1, 1);
                tuner1.Background = CommonManager.Instance.TunerNameBackColor;

                var text = ViewUtil.GetPanelTextBlock(info.Data.tunerName);
                text.Margin     = new Thickness(1, 0, 1, 0);
                text.Foreground = CommonManager.Instance.TunerNameFontColor;
                tuner1.Children.Add(text);

                text            = ViewUtil.GetPanelTextBlock("ID: " + info.Data.tunerID.ToString("X8"));
                text.Margin     = new Thickness(1, 0, 1, 2);
                text.Foreground = CommonManager.Instance.TunerNameFontColor;
                tuner1.Children.Add(text);

                tuner1.ToolTip = Settings.Instance.TunerNameTooltip != true ? null : ViewUtil.ServiceHeaderToToolTip(tuner1);
                stackPanel_tuner.Children.Add(tuner1);
            }
        }
示例#6
0
        public void SetDay(List <DateTime> dayList)
        {
            try
            {
                stackPanel_day.Children.Clear();
                foreach (DateTime time in dayList)
                {
                    var item = ViewUtil.GetPanelTextBlock(time.ToString("M/d\r\n(ddd)"));
                    item.Width = Settings.Instance.ServiceWidth - 1;

                    Color backgroundColor;
                    if (time.DayOfWeek == DayOfWeek.Saturday)
                    {
                        item.Foreground = Brushes.DarkBlue;
                        backgroundColor = Colors.Lavender;
                    }
                    else if (time.DayOfWeek == DayOfWeek.Sunday)
                    {
                        item.Foreground = Brushes.DarkRed;
                        backgroundColor = Colors.MistyRose;
                    }
                    else
                    {
                        item.Foreground = Brushes.Black;
                        backgroundColor = Colors.White;
                    }
                    item.Background = Settings.Instance.EpgGradationHeader ? (Brush)ColorDef.GradientBrush(backgroundColor, 0.8, 1.2) : new SolidColorBrush(backgroundColor);

                    item.Padding    = new Thickness(0, 0, 0, 2);
                    item.Margin     = new Thickness(0, 1, 1, 1);
                    item.FontWeight = FontWeights.Bold;
                    stackPanel_day.Children.Add(item);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
        }