Exemplo n.º 1
0
        private void btnInit_Click(object sender, EventArgs e)
        {
            this.btnInit.Enabled        = false;
            this.btnStartInsert.Enabled = true;

            this.txtClientCount.Enabled        = false;
            this.txtCurrencyCount.Enabled      = false;
            this.txtDay.Enabled                = false;
            this.txtBatchCount.Enabled         = false;
            this.cbInsertCurrencyImage.Enabled = false;

            int  clientCount           = this.txtClientCount.Text.Trim().ToInt();
            int  currencyCount         = this.txtCurrencyCount.Text.Trim().ToInt();
            int  day                   = this.txtDay.Text.Trim().ToInt();
            int  batchCount            = this.txtBatchCount.Text.Trim().ToInt();
            bool isInsertCurrencyImage = this.cbInsertCurrencyImage.Checked;

            this.TargetCurrencyCount = clientCount * currencyCount * day;

            SourceData.Create(isInsertCurrencyImage);
            DataCounter.Reset();

            this.LastSecondCount = 0;
            this.MaxSecondCount  = 0;

            this.BatcherList = new List <Batcher>();

            Task.Factory.StartNew(() =>
            {
                for (int i = 0; i < clientCount; i++)
                {
                    Batcher client = new Batcher(batchCount, currencyCount * day);

                    this.BatcherList.Add(client);

                    this.BeginInvoke(new EventHandler((a, b) =>
                                                      { this.lblRealClientCount.Text = this.BatcherList.Count.ToString(); })).AsyncWaitHandle.WaitOne(10);
                }
            });
        }
Exemplo n.º 2
0
 static DataCounter()
 {
     DataCounter.Reset();
 }