예제 #1
0
        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();
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
 protected virtual void OnValidDeviceFound(DeviceCreatedEventArgs e)
 {
     ValidDeviceFound?.Invoke(this, e);
 }
예제 #4
0
 protected virtual void OnDeviceCreated(DeviceCreatedEventArgs e)
 {
     DeviceCreated?.Invoke(this, e);
 }