private void Removed(object sender, CpDeviceReprogramListRepeater.CpDeviceReprogrammableEventArgs e) { UserLog.WriteLine(DateTime.Now + ": CpDeviceAdvancedList: Device- Udn{" + e.Device.Udn + "}"); CpDeviceAdvanced device = null; lock (iLock) { if (iDisposed) { return; } foreach (CpDeviceAdvanced d in iDeviceListAdvanced) { if (d.MacAddress == e.Device.MacAddress) { device = d; iDeviceListAdvanced.Remove(d); e.Device.Changed -= HandleChanged; break; } } } if (iRemoved != null) { iRemoved(this, device); device.Dispose(); } }
//private void Removed(CpDeviceReprogramList aList, CpDeviceReprogrammable aDevice) private void Removed(object sender, CpDeviceReprogramListRepeater.CpDeviceReprogrammableEventArgs e) { CpDeviceReprogrammable aDevice = e.Device; CpDeviceUpdate device = null; lock (iLock) { if (iDisposed) { return; } foreach (CpDeviceReprogrammable d in iPendingList) { if (d.Udn == aDevice.Udn) { iPendingList.Remove(d); aDevice.Changed -= HandleChanged; break; } } foreach (CpDeviceUpdate d in iDeviceUpdateList) { if (d.MacAddress == aDevice.MacAddress) { UserLog.WriteLine(DateTime.Now + ": CpDeviceUpdateList: DeviceUpdateable- MacAddress{" + aDevice.MacAddress + "}"); device = d; iDeviceUpdateList.Remove(d); break; } } } if (device != null) { if (iRemoved != null) { iRemoved(this, device); } device.Dispose(); } }
private void Added(object sender, CpDeviceReprogramListRepeater.CpDeviceReprogrammableEventArgs e) { UserLog.WriteLine(DateTime.Now + ": CpDeviceAdvancedList: Device+ Udn{" + e.Device.Udn + "}"); CpDeviceAdvanced device = new CpDeviceAdvanced(e.Device, iVersionReader.GetDeviceVariant(e.Device.PcbNumberList), iAdapterAddress, iUpdateListener); lock (iLock) { if (iDisposed) { return; } iDeviceListAdvanced.Add(device); e.Device.Changed += HandleChanged; } if (iAdded != null) { iAdded(this, device); } }
//private void Added(CpDeviceReprogramList aList, CpDeviceReprogrammable aDevice) private void Added(object sender, CpDeviceReprogramListRepeater.CpDeviceReprogrammableEventArgs e) { CpDeviceReprogrammable aDevice = e.Device; CpDeviceUpdate device = null; lock (iLock) { if (iDisposed) { return; } if (iVersionInfoAvailable) { Firmware firmware = CheckForSoftwareUpdate(aDevice); if (firmware != null) { UserLog.WriteLine(DateTime.Now + ": CpDeviceUpdateList: DeviceUpdateable+ MacAddress{" + aDevice.MacAddress + "}"); device = new CpDeviceUpdate(aDevice, firmware, iCache, iAdapterAddress, iUpdateListener); iDeviceUpdateList.Add(device); } } iPendingList.Add(aDevice); aDevice.Changed += HandleChanged; } if (device != null) { if (iAdded != null) { iAdded(this, device); } } }