示例#1
0
        /*从天线配置数组中删除一个天线对象*/
        private void addSettings_delAntenna_Click(object sender, EventArgs e)
        {
            Log.WriteLog(LogType.Trace, "come in addSettings_delAntenna_Click");

            if (AntennaList.Count > 0)
            {
                AntennaConfig RemoveItem = AntennaList[AntennaList.Count - 1];

                AntennaList.Remove(RemoveItem);

                Log.WriteLog(LogType.Trace, "success to remove antenna from memery, the antenna info is: portnumber[" + RemoveItem.PortNumber + "], rxpower[" + RemoveItem.RXPower + "]," +
                             "txpower[" + RemoveItem.TXPower + "]");

                flpAntennaConfig.Controls.Clear();

                if (AntennaList.Count <= 4 && AntennaList.Count >= 1)
                {
                    AntennaList.Where(a => a.PortNumber == "1").FirstOrDefault().BackColor = Color.White;
                }

                AntennaList.ForEach(o =>
                {
                    flpAntennaConfig.Controls.Add(o);
                });

                /*屏蔽删除按钮*/
                if (AntennaList.Count == 0)
                {
                    buttonRemoveAntenna.Enabled = false;
                }
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {
            if (AntennaList.Count < 32)
            {
                AntennaConfig ac = new AntennaConfig();

                ac.PortNumber     = (AntennaList.Count + 1).ToString();
                ac.AntennaEnabled = true;
                ac.RXPower        = -70;
                ac.TXPower        = 30;
                ac.BorderStyle    = BorderStyle.FixedSingle;

                AntennaList.Add(ac);

                flpAntennaConfig.Controls.Clear();

                if (AntennaList.Count > 4)
                {
                    AntennaList.Where(a => a.PortNumber == "1").FirstOrDefault().BackColor = Color.LightBlue;
                }

                AntennaList.ForEach(o =>
                {
                    flpAntennaConfig.Controls.Add(o);
                });
            }
            else
            {
                MessageBox.Show("Sorry 32 antennas, are the maximum number of antennas that the reader can support");
            }
        }
示例#3
0
        /*添加一个天线配置对象,并将其添加到天线数组中*/
        private void addSettings_addAntenna_Click(object sender, EventArgs e)
        {
            Log.WriteLog(LogType.Trace, "come in addSettings_addAntenna_Click");

            if (AntennaList.Count < 32)
            {
                /*申请天线配置对象*/
                AntennaConfig ac = new AntennaConfig();

                ac.PortNumber     = (AntennaList.Count + 1).ToString();
                ac.AntennaEnabled = true;
                ac.RXPower        = -70;
                ac.TXPower        = 30;
                ac.BorderStyle    = BorderStyle.FixedSingle;

                Log.WriteLog(LogType.Trace, "add new antenna config into memery, the antenna info is:portnumber[" + ac.PortNumber + "], rxpower[" + ac.RXPower + "]," +
                             "txpower[" + ac.TXPower + "]");

                /*配置对象添加到天线数组*/
                AntennaList.Add(ac);

                flpAntennaConfig.Controls.Clear();

                if (AntennaList.Count > 4)
                {
                    AntennaList.Where(a => a.PortNumber == "1").FirstOrDefault().BackColor = Color.LightBlue;
                }

                //把天线数组加载到显示控件上
                AntennaList.ForEach(o =>
                {
                    flpAntennaConfig.Controls.Add(o);
                });

                Log.WriteLog(LogType.Trace, "success to load " + AntennaList.Count + " antennas into pages.");

                /*使能删除按钮*/
                if (AntennaList.Count > 0 && buttonRemoveAntenna.Enabled == false)
                {
                    buttonRemoveAntenna.Enabled = true;
                }
            }
            else
            {
                MessageBox.Show("Sorry 32 antennas, are the maximum number of antennas that the reader can support");
            }
        }