Color Highlights for recent and upcoming shows

Developer
Jan 9, 2012 at 6:59 PM
Edited Jan 9, 2012 at 7:00 PM

I've altered the latest release to add the ability to highlight shows being shown in the next 48 hours, or been shown in the last 48 hours.

In the ShowOverviewControl dgvShowOverview_CellFormatting method I added:

try
{
	DateTime airDate = DateTime.Parse(episode.AirDate);
	if (airDate > DateTime.Now.AddHours(-48) && airDate <= DateTime.Now)
		dgvShowOverview[e.ColumnIndex, e.RowIndex].Style.BackColor = MainWindow.Settings.ColorLast48Hours;
	else if (airDate > DateTime.Now && airDate <= DateTime.Now.AddHours(48))
		dgvShowOverview[e.ColumnIndex, e.RowIndex].Style.BackColor = MainWindow.Settings.ColorNext48Hours;
	else
		dgvShowOverview[e.ColumnIndex, e.RowIndex].Style.BackColor = MainWindow.Settings.ColorBackground;
}
catch { }

Then in the TVAgendaSettings class I added the following, btw the XMLSerializer has an issue with Color, so have to do a bit of a hack job (didn't fancy changing it all to use the DataContractSerializer :-D )

        Color _colorLast48Hours = Color.FromArgb(255, 192, 192);
        [XmlIgnore]
        internal Color ColorLast48Hours
        {
            get { return _colorLast48Hours; }
            set { _colorLast48Hours = value; }
        }
        [Category("Display")]
        [DisplayName("Color for past shows")]
        [Description("The color (in hex notation) for episodes that have been shown in the last 48 hours.")]
        [DefaultValue("#FFC0C0")]
        public string StringColorLast48Hours
        {
            get { return ColorTranslator.ToHtml(_colorLast48Hours); }
            set { ColorLast48Hours = ColorTranslator.FromHtml(value); }
        }
 
        Color _colorNext48Hours = Color.FromArgb(192, 255, 192);
        [XmlIgnore]
        internal Color ColorNext48Hours
        {
            get { return _colorNext48Hours; }
            set { _colorNext48Hours = value; }
        }
 
        [Category("Display")]
        [DisplayName("Color for upcoming shows")]
        [Description("The color (in hex notation) for episodes that will be shown in the next 48 hours.")]
        [DefaultValue("#C0FFC0")]
        public string StringColorNext48Hours
        {
            get { return ColorTranslator.ToHtml(_colorNext48Hours); }
            set { ColorNext48Hours = ColorTranslator.FromHtml(value); }
        }
 
        Color _colorBackground = Color.FromArgb(192, 192, 192);
        [XmlIgnore]
        internal Color ColorBackground
        {
            get { return _colorBackground; }
            set { _colorBackground = value; }
        }
 
        [Category("Display")]
        [DisplayName("Color for background")]
        [Description("The color (in hex notation) for episodes that will be shown outside the next/previous 48 hours.")]
        [DefaultValue("#EEEEEE")]
        public string StringColorBackground
        {
            get { return ColorTranslator.ToHtml(_colorBackground); }
            set { ColorBackground = ColorTranslator.FromHtml(value); }
        }

Oh I've got a Visual Studio 2010 project with the changes if you want that...

Coordinator
Jan 10, 2012 at 8:23 AM

Maybe you could check-in your changes since I made you developer for this project :)

Developer
Jan 10, 2012 at 5:53 PM

Done I hope!

And I think I've done it so that I've not overwritten the solution and project files with Visual Studio 2010 versions.

Coordinator
Jan 11, 2012 at 9:03 AM

You can also overwrite the solution and project file to VS2010 if you want ;-)

I'll make a new release later today/tomorrow

Coordinator
Jan 11, 2012 at 9:12 AM

Oh, I see you already create a release for it, nice :-)