Пример #1
0
        /// <summary>
        /// 更新控件上的数据
        /// </summary>
        /// <param name="data"></param>
        private void RefDgvData(战绩数据 data)
        {
            DataGridViewRow row = null;

            foreach (DataGridViewRow r in dgvData.Rows)
            {
                if (r.Cells["colName"].Value.ToString() == data.账号信息.Name)
                {
                    row          = r;
                    row.Selected = true;
                    break;
                }
            }

            if (row == null)
            {
                return;
            }

            row.Cells["colSelected"].Value = false;
            row.Cells["colName"].Value     = data.账号信息.Name;
            row.Cells["colServer"].Value   = areas.First(a => a.AreaID == data.账号信息.Server).AreaName;
            row.Cells["colShenLU"].Value   = data.Shenlu.ToString();
            row.Cells["colDuanwei"].Value  = data.账号信息.Duanwei;
            row.Cells["colWebUrl"].Value   = data.账号信息.WebUrl;
            row.Cells["colTime"].Value     = data.账号信息.Time;
            row.Cells["colShijian"].Value  = data.Shijian;
            row.Cells["colBeizhu"].Value   = data.账号信息.Beizhu;

            int 失败次数 = 0;

            for (int i = 1; i <= (count < data.战绩.Count ? count : data.战绩.Count); i++)
            {
                var coldata = "colData" + i.ToString();
                if (dgvData.Columns.Contains(coldata))
                {
                    row.Cells[coldata].Value = string.Format("{0}{2}{1}", data.战绩[i - 1].Shijian, data.战绩[i - 1].Jieguo, Environment.NewLine);
                    if (data.战绩[i - 1].Jieguo == "失败" && i <= 8)
                    {
                        失败次数++;
                    }
                }
            }
            if (失败次数 >= Lost)
            {
                row.DefaultCellStyle.BackColor = Color.Red;
                player.Play();
            }
            row.Selected = false;
        }
Пример #2
0
        public List <战绩数据> GetGameData()
        {
            var accountList = GetAccounts();

            List <战绩数据> datas = new List <战绩数据>();

            foreach (var item in accountList)
            {
                战绩数据 data = new 战绩数据();
                data.账号信息 = item;
                data.战绩   = GetZhanjiByGameName(item.Name);
                datas.Add(data);
            }
            return(datas);
        }