/// <summary>
        /// Creates a new configuration after the last configuration on the list that goes from then until the next plate change.
        /// </summary>
        /// <returns></returns>
        public PlateConfiguration CreateNewConfig()
        {
            // default to one week ago if first thing.
            DateTime begin = DateTime.Today.AddDays(-7);
            DateTime end   = begin;

            if (PlateConfigurations != null && PlateConfigurations.Count > 0)
            {
                begin = PlateConfigurations.Last().EndTime.AddDays(1);
            }

            if (PlateChangeDays.Count > 0)
            {
                while (PlateChangeDays.All(d => d != begin.DayOfWeek))
                {
                    begin = begin.AddDays(-1);
                }
                end = begin.AddDays(1);
                while (PlateChangeDays.All(d => d != end.DayOfWeek))
                {
                    end = end.AddDays(1);
                }
                end = end.AddDays(-1);
            }
            else
            {
                // default to a week
                end = begin.AddDays(7);
            }

            var plateChange = new PlateConfiguration(begin, end);

            PlateConfigurations?.Add(plateChange);
            return(plateChange);
        }
        public static bool Load()
        {
            try
            {
                using (FileStream stream = File.OpenRead(DatFile))
                {
                    BinaryFormatter formatter = new BinaryFormatter();

                    PlateConfigurations.Clear();
                    PlateChangeDays.Clear();
                    PressScheduleWindow.WeekControls?.Clear();

                    int plateCount = (int)formatter.Deserialize(stream);

                    for (; plateCount > 0; plateCount--)
                    {
                        PlateConfiguration plateConfiguration = (PlateConfiguration)formatter.Deserialize(stream);
                        PlateConfigurations.Add(plateConfiguration);
                    }

                    int daysCount = (int)formatter.Deserialize(stream);
                    for (; daysCount > 0; daysCount--)
                    {
                        DayOfWeek day = (DayOfWeek)formatter.Deserialize(stream);
                        PlateChangeDays.Add(day);
                    }

                    NumPlates = (int)formatter.Deserialize(stream);
                }

                //using (BinaryReader reader = new BinaryReader(new FileStream(DatFile, FileMode.Open)))
                //{
                //    return Load(reader);
                //}
            }
            catch (Exception exception)
            {
                return(false);
            }

            return(true);
        }