示例#1
0
        void LoadUserControls()
        {
            List <Models.DeviceAttribute> Devices = new List <Models.DeviceAttribute>();

            Devices = GetData();
            ConnectionRepository     Cr  = new ConnectionRepository();
            Dictionary <string, int> dec = Cr.GetComportCategory();

            foreach (var item in dec)
            {
                List <byte> addList = new List <byte>();
                int         j       = 0;
                foreach (var device in Devices.Select((value, i) => new { i, value }))
                {
                    if (device.value.Comport == item.Key)
                    {
                        addList.Add(device.value.Address);
                        if (j == item.Value - 1)
                        {
                            ETP98 = new ETP98UserCtrl(addList, device.value.Comport);
                            TempPnl.Controls.Add(ETP98);
                        }
                        j++;
                    }
                }
            }
        }