System.Collections.Generic.List.Add(msInfo)

Here are the examples of the csharp api System.Collections.Generic.List.Add(msInfo) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : frmMain.cs
License : MIT License
Project Creator : JackQChen

private void BindData()
        {
            List<msInfo> mList = new List<msInfo>();
            #region 正式数据
            var vList = new List<BCallModel>();
            try
            {
                vList = cBll.ScreenShowByArea(areaList).Take(rowCount).ToList();
                ShowError = false;
            }
            catch (Exception ex)
            {
                WriterLog("获取大屏显示数据异常,方法[ScreenShowByArea],错误原因:" + ex.Message);
                ShowError = (isShowError == 0 ? false : true);
            }
            int i = 0;
            Font vipFont = new Font(fontName, VIPFontSize, FontStyle.Bold);
            Font msgFont = new Font(fontName, fontSize, FontStyle.Bold);
            if (vList == null || vList.Count == 0)
            {
                this.pnMain.Controls.Clear();
                this.pnMain.ResumeLayout();
                return;
            }

            #region
            foreach (var v in vList)
            {
                var bam = baList.Where(b => b.busiSeq == v.busiSeq && b.unitSeq == v.unitSeq).FirstOrDefault();
                BQueueModel queue = null;
                try
                {
                    queue = qBll.GetModel(q => q.ID == v.qId);
                }
                catch (Exception ex)
                {
                    WriterLog("获取排队数据异常,方法[GetModel],错误原因:" + ex.Message);
                }
                string strVip = "";
                if (bam != null && bam.isGreenChannel == 1)
                {
                    strVip = "绿色\r\n通道";
                }
                else
                {
                    if ((queue != null && queue.type == 0 && queue.appType == 1 && queue.reserveStartTime <= v.handleTime && queue.reserveEndTime >= v.handleTime))
                    {
                        strVip = "网上\r\n预约";
                    }
                    else if (queue != null && queue.type == 1)
                    {
                        strVip = "网上\r\n申办";
                    }
                }
                msInfo ms = new msInfo();
                ms.Index = (i + 1);
                ms.RowHeight = rowHeight;
                ms.TextFont = msgFont;
                ms.WindowColor = window;
                ms.TicketColor = ticket;
                ms.VIPColor = vipColor;
                ms.VIPFont = vipFont;
                ms.VIPText = strVip;
                ms.OtherColor = other;
                ms.WindowNumber = v.windowNumber;
                ms.QueueNumber = v.ticketNumber;
                ms.msClick += ms_Click;
                if (i % 2 != 0)
                {
                    ms.BackColorPage = blue;
                }
                else
                {
                    ms.BackColorPage = gray;
                }
                mList.Add(ms);
                i++;
            }
            #endregion

            #endregion

            if (pnMain.Controls.Count == 0)
            {
                int t = 0;
                foreach (var ms in mList)
                {
                    ms.Location = new Point(0, t);
                    this.pnMain.Controls.Add(ms);
                    t += ms.Height;
                }
                pnMain.ResumeLayout();
            }
            else
            {
                var deleteControl = new List<Control>();
                int jCount = pnMain.Controls.Count;
                for (int j = 0; j < jCount; j++)
                {
                    if ((j + 1) <= mList.Count)
                    {
                        var ctl = pnMain.Controls[j] as msInfo;
                        ctl.WindowNumber = mList[j].WindowNumber;
                        ctl.QueueNumber = mList[j].QueueNumber;
                        ctl.VIPText = mList[j].VIPText;
                        ctl.Refresh();
                        ctl.Invalidate();
                    }
                    else
                    {
                        deleteControl.Add(pnMain.Controls[j]);
                    }
                }
                foreach (var con in deleteControl)
                    pnMain.Controls.Remove(con);
                pnMain.Refresh();
                pnMain.Invalidate();
                pnMain.ResumeLayout();
                int tCount = pnMain.Controls.Count;
                if (tCount < mList.Count)
                {
                    int t = (pnMain.Controls[0] as msInfo).Height * pnMain.Controls.Count;
                    for (int m = 0; m < mList.Count - tCount; m++)
                    {
                        var ms = mList[m + tCount];
                        ms.Location = new Point(0, t);
                        this.pnMain.Controls.Add(ms);
                        t += ms.Height;
                    }
                    pnMain.Refresh();
                    pnMain.Invalidate();
                    pnMain.ResumeLayout();
                }
            }
        }