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(); }
public virtual void SetReturnDateAndProfile(DateTime date, Profile profile) { Heaters h = m_data.LoadHeaters(); List <Schedule> schedules = m_data.LoadSchedules(); m_wifiDevices.SendAlternativeSchedules(h.GetHeaters(), schedules); // sends invalid temperature -- alternative schedule is used m_wifiDevices.SendReturnDateAndTemperature(date, 0); }
public override Heaters FindHeaters() { m_heaters = m_data.LoadHeaters(); if (m_heaters.GetHeaters().Count < 8) { // add new heater in starting configuration m_heaters.AddIfDoesntExist(new Heater("aa", "", "")); } return(m_heaters); }
/// <summary> /// Saves profile to file, replaces profile with same name. /// </summary> /// <param name="heaters">Heaters in profile.</param> /// <param name="name">Profile name.</param> protected void SaveProfile(Heaters heaters, string name) { Profile profile = new Profile(name); foreach (Heater h in heaters.GetHeaters()) { profile.Add(h.Id, h.Schedule); } SaveProfile(profile); }
public override Dictionary <String, double> GetTemperature() { Dictionary <String, double> res = new Dictionary <string, double>(); Random random = new Random(); m_heaters = m_data.LoadHeaters(); foreach (Heater h in m_heaters.GetHeaters()) { res.Add(h.Name, 18 + random.NextDouble() * 5); } return(res); }