Exemplo n.º 1
0
        public override void SaveHeatersAndActiveProfile(List <Heater> heaters, string profileName)
        {
            Heaters       h       = m_data.LoadHeaters();
            List <Heater> changed = new List <Heater>();

            foreach (Heater heater in heaters)
            {
                if (!h.GetHeaters().Contains(heater))
                {
                    changed.Add(heater);
                }
            }

            foreach (Heater heater in changed)
            {
                if (heater.Id.Equals(Heaters.StartId))
                {
                    heater.Id = Heaters.NextId();
                    h.AddHeater(heater);
                    continue;
                }
                h.Replace(heater);
            }

            m_data.SaveHeaters(h);
            SaveProfileAsActive(h, profileName);
            List <Schedule> schedules = m_data.LoadSchedules();
        }
Exemplo n.º 2
0
        public override void SaveNewHeatersAndNonactiveProfile(List <Heater> heaters, string profileName)
        {
            Heaters       h         = m_data.LoadHeaters();
            List <Heater> newHeater = new List <Heater>();

            foreach (Heater heater in heaters)
            {
                if (heater.Id.Equals(Heaters.StartId))
                {
                    heater.Id = Heaters.NextId();
                    h.AddHeater(heater);
                    newHeater.Add(heater);
                }
            }

            m_data.SaveHeaters(h);
            SaveProfile(h, profileName);
            List <Schedule> schedules = m_data.LoadSchedules();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Changes new heaters id and saves schedule.
        /// </summary>
        /// <param name="heaters"></param>
        /// <param name="profileName"></param>
        public virtual void SaveNewHeatersAndNonactiveProfile(List <Heater> heaters, string profileName)
        {
            Heaters       h         = m_data.LoadHeaters();
            List <Heater> newHeater = new List <Heater>();

            foreach (Heater heater in heaters)
            {
                if (heater.Id.Equals(Heaters.StartId))
                {
                    heater.Id = Heaters.NextId();
                    h.AddHeater(heater);
                    newHeater.Add(heater);
                    m_wifiDevices.ChangeIdfromStartId(Heaters.LastId);
                }
            }

            m_data.SaveHeaters(h);
            SaveProfile(h, profileName);
            List <Schedule> schedules = m_data.LoadSchedules();

            m_wifiDevices.SendSchedules(newHeater, schedules);
        }