void powerInterface_MicroPowerStatusReceived(object sender, MicroPowerStatusEventArgs e) { foreach (MicrocontrollerListViewItem item in Items) { if (item.powerPort >= 1 && item.powerPort <= e.Count) { item.OnPowerMessage(e.GetEnabled(item.powerPort), e.GetPowerState(item.powerPort)); } } }
private void OnStatusReceived(MicroPowerStatusEventArgs e) { try { if (MicroPowerStatusReceived != null) { if (syncInvoke != null) { syncInvoke.Invoke(MicroPowerStatusReceived, new object[] { this, e }); } else { MicroPowerStatusReceived(this, e); } } } catch (Exception ex) { Debug.WriteLine("exception in power callback: \n" + ex.Message); } }