private void HandlePeripheralDetached(object sender, PeripheralEventArgs e) { lock (_peripherals) { _peripherals.RemoveAll(p => !p.IsAlive || object.ReferenceEquals(p.Target, sender)); } RefreshLtoFlashOnlyRoms(); }
private void HandlePeripheralAttached(object sender, PeripheralEventArgs e) { lock (_peripherals) { _peripherals.RemoveAll(p => !p.IsAlive); if (_peripherals.FirstOrDefault(p => p.IsAlive && object.ReferenceEquals(p.Target, sender)) == null) { _peripherals.Add(new System.WeakReference(sender)); } } RefreshLtoFlashOnlyRoms(); }
public void UpdatePeripheralStatus(object sender, EventArgs e) { PeripheralEventArgs p = (PeripheralEventArgs)e; UpdatePeripheralStatus(p.Periperal, p.Status); }