Exemplo n.º 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();
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 protected virtual void OnValidDeviceFound(DeviceCreatedEventArgs e)
 {
     ValidDeviceFound?.Invoke(this, e);
 }
Exemplo n.º 4
0
 protected virtual void OnDeviceCreated(DeviceCreatedEventArgs e)
 {
     DeviceCreated?.Invoke(this, e);
 }