Пример #1
0
        private void btnSendData_Click(object sender, EventArgs e)
        {
            this.rbHeartbeat.Enabled = false;
            this.rbLogin.Enabled     = false;
            this.rbBlacklist.Enabled = false;
            this.rbCurrency.Enabled  = false;

            DataCounter.Reset();

            this.TargetHeartbeatCount         = this.TargetClientCount * 1;
            this.TargetLoginCount             = this.TargetClientCount * 1;
            this.TargetBlacklistQueryCount    = this.TargetClientCount * 1;
            this.TargetBlacklistDownloadCount = 0;
            this.TargetCurrencyCount          = this.TargetClientCount * this.txtCurrencyCount.Text.Trim().ToInt() * this.txtDay.Text.Trim().ToInt();
            this.LastSencodCount = 0;
            this.MaxSecondCount  = 0;

            if (this.ClientList != null && this.ClientList.Count > 0)
            {
                this.IsSending           = true;
                this.StartTime           = DateTime.Now;
                this.btnSendData.Enabled = false;

                if (this.rbHeartbeat.Checked)
                {
                    Task.Factory.StartNew(() =>
                    {
                        Parallel.ForEach <CurrencyTerminal>(ClientList, obj => obj.SendHeartbeat());
                    });
                }

                if (this.rbLogin.Checked)
                {
                    Task.Factory.StartNew(() =>
                    {
                        Parallel.ForEach <CurrencyTerminal>(ClientList, obj => obj.SendLogin());
                    });
                }

                if (this.rbBlacklist.Checked)
                {
                    Task.Factory.StartNew(() =>
                    {
                        Parallel.ForEach <CurrencyTerminal>(ClientList, obj => obj.SendBlacklist());
                    });
                }

                if (this.rbCurrency.Checked)
                {
                    Task.Factory.StartNew(() =>
                    {
                        Parallel.ForEach <CurrencyTerminal>(ClientList, obj => obj.RestartSendCurrency());
                    });
                }
            }
        }
Пример #2
0
 static DataCounter()
 {
     DataCounter.ClearConnectedClient();
     DataCounter.Reset();
 }