示例#1
0
        private void UpdateEffectList()
        {
            if (alerts == null || chatCmds == null || devices == null || alerts.Length == 0 || chatCmds.Length == 0 || devices.Length == 0)
            {
                return;
            }
            for (int i = 0; i < devices.Length; i++)
            {
                if (devices[i] == null)
                {
                    continue;
                }
                string[] el = Nanoleaf.GetEffectList(devices[i]);
                if (el != null)
                {
                    devices[i].SetEffectList(el);
                }
            }

            ArrayList els = new ArrayList();

            for (int i = 0; i < devices.Length; i++)
            {
                if (devices[i] == null)
                {
                    continue;
                }
                string[] el = devices[i].GetEffectList();
                //els.Add("--- Device #" + i + " ---");
                for (int j = 0; j < el.Length; j++)
                {
                    els.Add(el[j]);
                }
            }

            ComboBox[] effects = { comboBox231_default, comboBox232_follow, comboBox233_sub, comboBox234_donation, comboBox235_cheer, comboBox236_host, comboBox237_raid, comboBox241_effect, comboBox242_effect, comboBox243_effect, comboBox244_effect, comboBox245_effect, comboBox246_effect, comboBox247_effect, comboBox248_effect, comboBox249_effect, comboBox2410_effect };
            for (int i = 0; i < effects.Length; i++)
            {
                if (effects[i].Items.Count == 0)
                {
                    if (i == 0)
                    {
                        effects[i].Items.Add(EffectChange.CurrentEffect);
                    }
                    else
                    {
                        effects[i].Items.Add("");
                    }
                }
                foreach (string en in els)
                {
                    effects[i].Items.Add(en);
                }
                if (i < 7 && alerts[i] != null)
                {
                    effects[i].SelectedIndex = effects[i].FindStringExact(alerts[i].GetEffectName());
                    effects[i].SelectedText  = alerts[i].GetEffectName();
                }
                else if (i >= 7 && chatCmds[i - 6] != null)
                {
                    effects[i].SelectedIndex = effects[i].FindStringExact(chatCmds[i - 6].GetEffectName());
                    effects[i].SelectedText  = chatCmds[i - 6].GetEffectName();
                }
            }
        }