Пример #1
0
        /// <summary>
        ///     更新线程验证数据
        /// </summary>
        public void UpdateDataGrid()
        {
            if (null == dataGridThreads ||
                null == Config.MainForm ||
                null == Config.MainForm.ProxyPage ||
                null == Config.MainForm.ProxyPage.Tester ||
                Config.MainForm.ProxyPage.Tester.Threads.Count == 0)
            {
                return;
            }

            try
            {
                if (dataGridThreads.InvokeRequired)
                {
                    UpdateDataGridCallback callback = UpdateDataGrid;
                    Invoke(callback, new object[] {});
                }
                else
                {
                    dataGridThreads.DataSource = typeof(List <TestThread>);
                    dataGridThreads.DataSource = Config.MainForm.ProxyPage.Tester.Threads;
                }
            }
            catch (ObjectDisposedException odEx)
            {
                Config.ConsoleEx.Debug(odEx);
            }
        }
Пример #2
0
        /// <summary>
        /// 更新线程测试数据
        /// </summary>
        public void UpdateDataGrid()
        {
            if (null == this.dataGridView1 ||
                null == refresher ||
                null == refresher.Threads)
            {
                return;
            }

            try
            {
                if (this.dataGridView1.InvokeRequired)
                {
                    UpdateDataGridCallback callback = new UpdateDataGridCallback(UpdateDataGrid);
                    this.Invoke(callback, new object[] { });
                }
                else
                {
                    this.dataGridView1.DataSource = typeof(List <RefreshThread>);
                    this.dataGridView1.DataSource = refresher.Threads;
                    this.dataGridView1.Refresh();
                }

                Thread.Sleep(1000);
            }
            catch (Exception ex)
            {
                application.WriteExceptionLog(ex);
            }
        }
Пример #3
0
 /// <summary>
 /// 更新表格
 /// </summary>
 /// <param name="c"></param>
 private void UpdateDataGrid(Linker c)
 {
     try
     {
         if (this.xyDataGridView1.InvokeRequired)
         {
             UpdateDataGridCallback callback = new UpdateDataGridCallback(UpdateDataGrid);
             this.Invoke(callback, new object[] { c });
         }
         else
         {
             try
             {
                 //lock (xyDataGridView1)
                 //{
                 //    xyDataGridView1.DataSource = null;
                 //    xyDataGridView1.DataSource = LinkHelper.dtEmail;
                 //    xyDataGridView1.Columns["Email"].Width = 150;
                 //    //this.xyDataGridView1.FirstDisplayedScrollingRowIndex = this.xyDataGridView1.Rows.Count - 1;
                 //    //this.xyDataGridView1.Rows[this.xyDataGridView1.Rows.Count - 1].Selected = true;
                 //    //this.xyDataGridView1.CurrentCell = this.xyDataGridView1[0, this.xyDataGridView1.Rows.Count - 1];
                 //}
                 //for (int i = this.xyDataGridView1.Rows.Count; i < LinkHelper.dtEmail.Rows.Count; ++i)
                 //{
                 //    int index = this.xyDataGridView1.Rows.Add();
                 //    this.xyDataGridView1.Rows[index].Cells[0].Value = LinkHelper.dtEmail.Rows[i]["Email"].ToString();
                 //    this.xyDataGridView1.Rows[index].Cells[1].Value = LinkHelper.dtEmail.Rows[i]["Url"].ToString();
                 //}
                 //this.xyDataGridView1.DataSource = null;
                 this.xyDataGridView1.DataSource = LinkHelper.dtEmail;
                 this.label4.Text = LinkHelper.dtEmail.Rows.Count.ToString();
                 //this.xyDataGridView1.FirstDisplayedScrollingRowIndex = this.xyDataGridView1.Rows.Count - 1;
                 //this.xyDataGridView1.Rows[this.xyDataGridView1.Rows.Count - 1].Selected = true;
                 //this.xyDataGridView1.CurrentCell = this.xyDataGridView1[0, this.xyDataGridView1.Rows.Count - 1];
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
     catch (ObjectDisposedException)
     {
     }
 }