예제 #1
0
        private async Task LoadLights()
        {
            var lights = await lightsManager.GetLights();

            var selected = new List <Light>();

            foreach (var light in lights)
            {
                var item = new ListViewItem
                {
                    Text    = light.Name,
                    Checked = lightsManager.IsLightEnabled(light.Id),
                    Tag     = light
                };

                this.lightsListView.Items.Add(item);

                if (item.Checked)
                {
                    selected.Add(light);
                }
            }

            initialLights = selected.ToArray();
        }