Example #1
0
        private void FillList()
        {
            if (listComputers.SelectedIndex == -1)           //although I don't know how this could happen
            {
                listComputers.SelectedIndex = 0;
            }
            int selected = listButtons.SelectedIndex;

            listButtons.Items.Clear();
            SigButDef            sigButDef;
            List <SigElementDef> listSigElementDefs;
            string buttonText;

            for (int i = 0; i < _maxNumButtonsInList; i++)
            {
                sigButDef = SigButDefs.GetByIndex(i, _arraySigButDefs);
                if (sigButDef == null)
                {
                    listButtons.Items.Add("-" + (i + 1).ToString() + "-");
                }
                else
                {
                    buttonText         = sigButDef.ButtonText;
                    listSigElementDefs = SigElementDefs.GetElementsForButDef(sigButDef);
                    if (listSigElementDefs.Count > 0)
                    {
                        buttonText += " (" + string.Join(",", listSigElementDefs.Select(x => x.SigText)) + ")";
                    }
                    if (sigButDef.ComputerName == "" && listComputers.SelectedIndex != 0)
                    {
                        buttonText += " " + Lan.g(this, "(all)");
                    }
                    listButtons.Items.Add(buttonText);
                }
            }
        }