public bool GetState(Action <string, LanStatus> cb) { if (NICList.Count > 0) { NICList.ForEach((nic) => { cb(nic.DeviceId, nic.Status); }); return(true); } return(false); }
/// <summary> /// /// </summary> protected void SearchForPhysicalDevices() { try { NICList.Clear(); foreach (EventRecord evento in _LogEntries) { if (evento.Properties.Count > 0) { string idDevice = evento.Properties.Count > Cfg.PropertyIndex ? evento.Properties[Cfg.PropertyIndex].Value.ToString() : "Unknow"; #if DEBUG if (NICList.Contains(new NICItem() { DeviceId = idDevice }) == false) #else if (NICList.Count < 2 && NICList.Contains(new NICItem() { DeviceId = idDevice }) == false) #endif { NICList.Add(new NICItem() { DeviceId = idDevice, Status = LanStatus.Down /*, Index = Index++*/ }); } } } int Index = 0; NICList = NICList.OrderBy(lan => lan.DeviceId).ToList(); NICList.ForEach(i => { i.Index = Index++; }); } catch (Exception x) { RaiseMessageError(x); } }