private void LoadSingleAP(AccessPoint ap) { AccessPoint old = APs.FirstOrDefault(x => x.Id == ap.Id); if (old == null) { APs.Add(ap); ap.Start(); } else { old.UpdateInfo(ap.Description, ap.Ip, ap.SshPort, ap.SshUser, ap.SshPassword, ap.Alarm, ap.Service); } }
/// <summary> /// Actualiza Los equipos desde la base de datos /// </summary> public void LoadAccessPoints() { List <int> updates = new List <int>(); foreach (AccessPoint ap in RepositoryAP.All()) { updates.Add(ap.Id); LoadSingleAP(ap); } for (int i = 0; i < APs.Count; i++) { if (!updates.Contains(APs[i].Id)) { APs[i].Stop(); APs.RemoveAt(i--); } } }