private void OnDeviceCreated(object sender, DeviceCreatedEventArgs e) { WLEDDevice toAdd = e.CreatedDevice; if (toAdd != null) { foreach (WLEDDevice d in deviceList) { //ensure there is only one device entry per IP if (toAdd.NetworkAddress.Equals(d.NetworkAddress)) { if (toAdd.NameIsCustom) { d.Name = toAdd.Name; d.NameIsCustom = true; ReinsertDeviceSorted(d); } return; } } InsertDeviceSorted(toAdd); toAdd.PropertyChanged += DevicePropertyChanged; if (e.RefreshRequired) { _ = toAdd.Refresh(); } UpdateElementsVisibility(); } }
private void OnDeviceCreated(object sender, DeviceCreatedEventArgs e) { //this method only gets called by mDNS search, display found devices devicesFoundCount++; if (devicesFoundCount == 1) { discoveryResultLabel.Text = "Found " + e.CreatedDevice.Name + "!"; } else { discoveryResultLabel.Text = "Found " + e.CreatedDevice.Name + " and " + (devicesFoundCount - 1) + " other lights!"; } OnDeviceCreated(e); }
protected virtual void OnValidDeviceFound(DeviceCreatedEventArgs e) { ValidDeviceFound?.Invoke(this, e); }
protected virtual void OnDeviceCreated(DeviceCreatedEventArgs e) { DeviceCreated?.Invoke(this, e); }