private void LoadPVOutputDaysSub()
        {
            pvOutputDayList = new ObservableCollection<PVOutputDaySettings>();

            XmlElement days = GetElement("pvoutputdaylist");
            if (days == null)
                days = AddElement(settings, "pvoutputdaylist");

            foreach (XmlElement e in days.ChildNodes)
            {
                if (e.Name == "pvoutputday")
                {
                    PVOutputDaySettings day = new PVOutputDaySettings(ApplicationSettings, e);

                    pvOutputDayList.Add(day);
                }
            }
        }
        private void AdjustPVOutputDayList(bool initialLoadx = false)
        {
            int dayCount = LiveDays == null ? 2 : LiveDays.Value;
            if (dayCount < 1)
                dayCount = 1;
            //else if (dayCount > 14)
            //    dayCount = 14;

            XmlElement days = GetElement("pvoutputdaylist");

            int i = 0;

            DateTime date = DateTime.Today;

            while (i < dayCount)
            {
                date = DateTime.Today - TimeSpan.FromDays(i);

                PVOutputDaySettings day;

                XmlElement e;

                if (pvOutputDayList.Count > i)
                {
                    day = pvOutputDayList[i];
                    if (day.Day < date)
                    {
                        e = AddElement(days, "pvoutputday", day.settings);
                        day = new PVOutputDaySettings(ApplicationSettings, e);
                        day.Day = date;
                        day.ForceLoad = false;
                        LoadPVOutputDaysSub();
                    }
                }
                else
                {
                    e = AddElement(days, "pvoutputday");
                    day = new PVOutputDaySettings(ApplicationSettings, e);
                    day.Day = date;
                    day.ForceLoad = false;
                    LoadPVOutputDaysSub();
                }

                i++;
            }

            while (pvOutputDayList.Count > dayCount)
            {
                PVOutputDaySettings day = pvOutputDayList[pvOutputDayList.Count - 1];
                pvOutputDayList.Remove(day);
                days.RemoveChild(day.settings);
            }

            LoadPVOutputDaysSub();
        }